Create a texture from a [OpenGL-type] bitmap

Started by
9 comments, last by spiffgq 21 years, 1 month ago
quote:
const int BITMAP_ROWS = 12;
const int BITMAP_COLS = 8 * BITMAP_PITCH;

If these are the width and height of the texture, the width is wrong. Your image is still 8 bits wide, not 8*4. The extra padding has nothing to do with the texture data, but with pointer alignment after each row is read.

And after looking in the spec (you should look there too concerning what parameters to pass), you should pass GL_BITMAP as the second last parameter, and if you do, you must pass GL_COLOR_INDEX as third last parameter. Like this.
glTexImage2D (   ...   GL_COLOR_INDEX,    GL_BITMAP,    BITMAP_DATA);

This is the only valid combination including GL_BITMAP.

After reading through the specification quickly, I get the impression you can''t use bitmaps as "normal" textures. I strongly suggest you have a look in the specification, you find it here.

This topic is closed to new replies.

Advertisement