How fast can you texture?

Hi, I’m looking for some performance advice for texture mapping, specifically how to achieve the highest frame rates with ‘large’ texture files.

I use my texture as a background for coding GIS type data on top off (i.e. my texture is an a aerial photograph). Because of this my texture could be much more than the maximum of 1024x1024 pixels allowed by OpenGl (is that correct ?). Currently I restrict the max texture size I can use to 1024x124.

So my question is which will render faster, one large texture (say 1024x124) or X number of small textures (say 4 x 512x512) ?

If it’s the case that many small textures can be drawn faster than one large texture, how should I approach splitting up my one large texture into multiple 2^X smaller textures ? More importantly how can I scale/stretch my texture (the char* part ) to make sure the many smaller parts conform to 2^X while marinating the integrity of the image ? Any code suggestions etc. are welcome as this has me completely stumped !

Currently when I render my single texture (max size 1024x124) I map it to a simple Quad, I use the code below to carry out the mapping/rendering; the drawing part of this code is inside a display list to help improve re-draw times. Is there a quicker way ?

Any help etc. is appreciated, I’m stuck !

Thanks in advance,

/* =====================================================

  • Bind the texture data to the gl texture object ‘new_texture_id’ , only used

  • once when the texture file (a BMP) is processed */
    glBindTexture(GL_TEXTURE_2D, new_texture_id);
    glPixelStorei(GL_UNPACK_ALIGNMENT, 1);

    /* scaling a streching */

    /* bind the texture */
    glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, width, height, no_boarder,
    GL_RGB, GL_UNSIGNED_BYTE, texture_rgb_char_data);

/* =====================================================

  • now map the texture to the quad, this section is inside the display list */

glBindTexture(GL_TEXTURE_2D, id);

/* lower left corner /
glVertex3f(-texture_width/2, -texture_height/2, texture_z_offset);
lower right corner /
glTexCoord2f(1.0f, 0.0f);
glVertex3f(texture_width/2, -texture_height/2, texture_z_offset);
upper right corner /
glTexCoord2f(1.0f, 1.0f);
glVertex3f(texture_width/2, texture_height/2, texture_z_offset);
upper left corner */
glTexCoord2f(0.0f, 1.0f);
glVertex3f(-texture_width/2, texture_height/2, texture_z_offset);
glEnd ();

glDisable (GL_TEXTURE_2D); 


  • about splitting up the texture its a case of test + see. one advantage i see though is if you use mipmapping and say the textures at the bottom are using mipmap level 0 + at the top using mipmap level 1. this is gonna give you a speed advantage. cause if its just one polygon u would have to use the same level on the whole of the polygon.
  • try decresing the size of your internal texture format eg GL_R5_G6_B5 instead of GL_RGB (in 32 bit colour this might use GL_RGB8)
  • display lists/vertex arrays i cant really see helping out with so few polygons. and so few statechanges.

The maximum texture size in OpenGL is implementation dependant. For TNT and higher nVidia cards, it is 2048x2048. Probably the same thing for the Radeon and Voodoo 4/5. Voodoo 3 can only handle 256x256.