PDA

View Full Version : My textures show up as white blocks - help!



Bryan Taylor
12-23-2007, 10:12 PM
I'm attempting to write a slideshow style screensaver. I have created a mock up using glut, and everything works beautifully. However, when I use the exact same code (same files, same functions) in my screensaver framework, the slideshow images show up as large white blocks.

I had this happen to me before when I was loading the textures in a background thread. My solution then was to load the textures in the same thread that would be displaying them. This isn't ideal.

So, how do you load textures in one thread (via gluBuild2DMipmaps) and use them in another? I think if I can get that to work then my problem might go away. Thanks in advance!

Bryan Taylor
12-23-2007, 10:38 PM
Well, I'd made a stupid mistake, and I can get the images to properly display now if everything happens in the same thread. However, I'm still unable to load textures in a background thread and use them in another thread. Any ideas?

Zengar
12-24-2007, 04:31 AM
You could use the ARB_pixel_buffer_object extension. You will still have to call texture functions in your main thread, but they are asynchroneous, and actual loading can be done using buffer mapping -- in a helper thread.

Or you may create a second context with shared namespace for your helper thread, and load textures there.

Bryan Taylor
12-24-2007, 02:09 PM
Thanks for pointing me in the right direction. I ended up using your second suggestion, and now everything works smoothly.