Login  Register

Re: Best way to prepare an Image

Posted by Sven Gothel on Feb 25, 2014; 5:24pm
URL: https://forum.jogamp.org/Best-way-to-prepare-an-Image-tp4031731p4031732.html

On 02/25/2014 06:13 PM, Vasilij [via jogamp] wrote:

> Hello dear Community,
>
> I have a problem and I hope you can put me to right way.
> I make an application with JOGL but it does not run smoothly.
>
> What i have done is:
> in the init-Methode I load Images from Raspi. Its need a lot of Time, but it
> is not a problem. I use this images as backstage and they are always the same.
> After init I make a Thread, that makes BuffferedImages. That BufferedImage
> should be placed in the middle of the screen.
> In the draw method I make a texture from the BufferedImage and an VBO with
> vertices. I do this at this step because texture and VBO needs current
> GLContext. And that step take a lot of time.
>
> I think the draw-method should paint and not calculate.
>
>
> How can i do that in another way? - How can I prepare texture in a Thread? I
> have read there is some Solution: FBO, PBuffer, multilpe Context... something
> else?
>
> In this repositories i don't see Threads:
> https://github.com/xranby/jogl-demos/tree/master/src/demos/es2
> http://jogamp.org/git/?p=jogl.git;a=tree;f=src/test/com/jogamp/opengl/test/junit/jogl/acore
>
> And maybe you can write a little bit more words for solution and not only "use
> FBO" =)
GLMediaPlayer's StreamWorker fetches textures off-thread
using a shared GL context.

This is probably what you want, create an image loader thread
using a shared context to prepare your textures.
Then you need to signal your other thread when the texture is available.

This has been discussed here multiple times :)

BTW .. RaspPi and BufferedImage ? The latter is an AWT class AFAIK.

~Sven




signature.asc (894 bytes) Download Attachment