PDA

View Full Version : for experimented in drawing pixels image with "glDrawPixels"



philm
02-20-2003, 09:55 AM
Hi
I want to draw an image using "glDrawPixels" command :
void glDrawPixels(
GLsizei width,
GLsizei height,
GLenum format,
GLenum type,
const GLvoid *pixels
).
My buffer "buffer" specified in the last parameter of "glDrawPixels" is defined as follow :

////////////////////////////////////////////
#define checkImageWidth 256
#define checkImageHeight 256
#define dim3 2
GLbyte buffer[checkImageWidth][ checkImageHeight][dim3];
////////////////////////////////////////////

I fill the buffer from a file of UNSIGNED SHORT ( file obtained from image
monochrome(black and white)); each pixel is represented by an UNSIGNED SHORT.

In the call of "glDrawPixels" i do :

////////////////////////////////////////
glRasterPos2i(0, 0);
glDrawPixels(checkImageWidth,
checkImageHeight,
GL_LUMINANCE,
GL_UNSIGNED_SHORT
buffer);
////////////////////////////////////////

the problem is that nothing is drawn( screen's black).
I dont know if the "format" and "type" parameters of "glDrawPixels" are correct or not!!.

thanks for help

zed
02-20-2003, 10:14 AM
GLbyte != unsitgned short