[Qt-interest] Loading OpenGL Textures In A Separate Thread
andrew.m.goth at l-3com.com
andrew.m.goth at l-3com.com
Wed Apr 22 23:54:20 CEST 2009
Karol Krizka wrote:
> On Wed, 2009-04-22 at 15:28 -0500, andrew.m.goth at l-3com.com wrote:
> > You could load the images from disk in the separate thread
> > and make textures out of them in the main thread.
>
> I'm actually using a third party library to load the textures and
> perform the rendering, so that won't work.
Does this third-party library insist on loading textures from a file on disk? Or will it accept a buffer source? Loading the textures yourself is pretty easy, and Qt can help. The trick may be to convince this third-party library to use the OpenGL texture names that you prepared without its cooperation.
> > Karol Krizka wrote:
> > > create a new OpenGL context in the loader thread and have
> > > it share it's lists with the original OpenGL context.
>
> It's possible with pure OpenGL:
> http://hacksoflife.blogspot.com/2008/02/creating-opengl-objects-in-second.html
> http://veelck.wordpress.com/2008/11/28/multithread-texture-loading-in-opengl/
Interesting, but just from these articles it looks like this technique doesn't work well in Linux. I'd have to read more. Anyway, despite what I said earlier, my current situation is okay with me. Even though the stalls are annoying on my development computer, the target machine has much better performance and doesn't exhibit any noticeable slowdowns.
> But I'm not sure if Qt's OpenGL would allow this too.
It doesn't look like it. Maybe you could subclass.
--
Andy Goth
<amgoth at link.com>
More information about the Qt-interest-old
mailing list