LWJGL Forum

Programming => OpenGL => Topic started by: Estraven on November 13, 2013, 09:39:51

Title: Textures Count limitations
Post by: Estraven on November 13, 2013, 09:39:51
Hello!

I'm working on a project that displays a rather large screen (3660x800) using 4 video projectors
I've a 3D rendering on the first layer, and the background is animated by a sequences of images.

I have a basic quad that renders the background using a simple GLSL shader reading a texture2D.

At startup, i load all the images (2048x512) into GPU memory, getting one unique openGL id for each texture, all stored into a single array.
then on each frame, i just set the shader uniform pointer to the "next" texture id (looping over the array)

It performs quite well (on a Quadro K4000) for a few hundreds textures. running at more than 100FPS,
but when I load more images, a get a very suddent FPS drop.
at 450 images, i get around 100 FPS,
at 500 images, i get no more than 10FPS.

My guess is that I get more cache fault into the GPU structure, but I can't be sure of this.
Do anyone have any idea of how to bypass this ?

Best,
Estraven

Title: Re: Textures Count limitations
Post by: Fool Running on November 13, 2013, 13:25:46
You are probably hitting the upper limit of the amount of memory on the GPU card. This causes the textures to need to be put into system memory until they are actually used, then streamed to the GPU. I would strongly suggest you create a single texture and stream the new images to the GPU each frame instead of creating a texture for each image ahead of time.

Another possibility is to load 200 images and then as you display them, replace the contents of the textures with the next set of images so they will be ready to display when the time comes.

NOTE: For either of these options, you will, more then likely, need to use multi-threading to get good speed.
Title: Re: Textures Count limitations
Post by: Estraven on November 13, 2013, 15:28:26
I see

Indeed, I though of using a single texture and streaming each images at each frame.
I was actually trying to avoid this, as I'm not sure how to set up multi-threaded image loading. But if I have no choice, I will definitively look into that.

thanks for the quick reply.