PDA

View Full Version : Maximum Number of Texture Objects



kushaura
03-02-2008, 04:09 PM
I am working on developing a particle system modeler using OpenGL and texture-bound point sprites. It works fine, up to the point that I really crank up the number of points generated, and I hit a limit on the number of texture objects I can render (I guess?). Stranger still is that I'm only using a single texture (I only call glBindTexture once), so I assumed I should be able to render a great deal of points that share a single texture. Does anyone know how to increase this limit? Or if I'm making a common noob mistake. Here is a code example:

glEnable(GL_TEXTURE_2D);
glEnable(GL_POINT_SPRITE);
glTexEnvi(GL_POINT_SPRITE, GL_COORD_REPLACE, GL_TRUE);
glPointSize(4.0f);
glBegin(GL_POINTS);
//can only call glVertex3f here so many times before I stop seeing rendered points
glEnd();

I know this is a texture issue, since if I instead just render primitive points, I can generate as many as I want.

Seth Hoffert
03-02-2008, 08:39 PM
I'm guessing that you're probably hitting some kind of immediate mode limitation, and so I would recommend storing the points inside a VBO instead.

Jan
03-03-2008, 04:15 AM
Hm, difficult, but what HexCat said does make sense. Did you try it on another PC (with another vendor's hardware) ?

Point-sprites are evil, anyway (in my opinion), because they have some serious limitations regarding their size. You might want to switch to billboarded quads.

If HexCat is right, it might be possible to render more sprites, by limiting the number of glVertex calls between glBegin/glEnd, and just do several glBegin/glEnd calls.

Ie:
loop over n calls
{
glBegin (GL_POINTS);

loop over m sprites
{
glVertex...
}

glEnd ();
}


Hope that helps,
Jan.

kushaura
03-03-2008, 07:39 AM
Seems that simply calling glEnd/begin (as suggested by Jan) every so many particles is a quick fix. Although I'm going to try to use VBOs eventually as I understand it will help with performance.