View Full Version : Texture Mapping

Rajiv Mishra
11-23-2001, 02:23 AM
What i seen most of Texture mapping in opengl samples even in NeHe tutorial,use the bitmap having the pixel lenght 64,128,256.
Now please tell me how i map the bitmap other than this dimension ?

11-23-2001, 03:00 AM
Once again, don't crosspost...

Now, to answer your question: without extensions, OpenGL wants dimensions that are a power of 2 so you HAVE to use bitmaps of dimensions 64,128,256,...

Now, if you want to use another dimension, find the rectangle that has dimensions as powers of 2 that encloses your bitmap. Then calculate the proper texture coordinates for your object...

Does that make sense ?



11-23-2001, 03:19 AM
Make an empty texture with the power of two dimensions enclosing the original texture:
glTexImage2D(....., 0);
Then call glTexSubImage2D(..., bitmapdata)
and calculate the texcoords as Eric suggested to render the bitmap.