OpenGL renderer and offline image creation


#1

Hi Jules,

 

I'm encounetring a strange issue when using the OpenGl Renderer (on both OSX and Win)

In a component, I'm using an Image which I'm tweaking in a timer, drawing some audio related value and then display it in the paint method.

This works fine with the default renderer but the image looks like empty with the openGL renderer.

 

One interresting point is that I do not recreate the Image in each timer callback but if I do it works fine.

 

Does this ring a bell ?

 

Thanks,


#2

Nothing springs to mind.. a threading issue, maybe? You could debug into the GL code and see what happens when it tries to convert it to a texture?


#3

it doesn't look at all like a threading issue as everything is done in the UI thread.

Myabe this is related to GL not updating the texture when the image is changed ?

 

Thanks,

 


#4

Maybe - impossible to tell without more info.


#5

ok found the issue.

 

When the image is modified, OpenGLTexture::release() is called as expected, except that 

it's currently in the timer callback so the ownerContext is not equals to OpenGLContext::getCurrentContext() 

as the current context is nullptr

 

Not sure what the right fix would be in that case.

Maybe some lazy evaluation.

 


#6

I just got exactly the same problem. I did an ugly trick to make this work : just before painting the image, I set one pixel of it to an arbitrary colour, so the OpenGLTexture::release() function can be used in a context where OpenGLContext::getCurrentContext() is not null. Then the image is updated, and displayed as expected... That's not really very efficient however