View Full Version : drawing pixelmaps(RGB arrays) to screen/textures

11-02-2000, 02:07 AM
I have been trying to draw pixel maps to textures

I have defined a RGB class made up of the attributes of unsigned char r,g,b

I have then created a 2d array of RGB's called pixel and then used this command to draw it:
glTexImage2D(GL_TEXTURE_2D,0,GL_RGB,nCols,nRows,0, GL_RGB.GL_UNSIGNED_BYTE,pixel);

if I use a certain size of pixelmap (64) it draws it to the model but it gets completely corrupted and looks like a scottish tartan check, for a selection of pixelmaps.

Am I doing something wrong? Hows does openGL know how to maniplulate the "pixel" or the RGB if there user defined?

Please could someone help?

11-02-2000, 03:03 AM
If 64*64 is working for you, you got the basic steps right.
Other texture sizes have to be power of two in that function.
Have a look at the settings you can do with glPixelStore.