PDA

View Full Version : glDrawPixels



grimoire
07-12-2004, 03:58 PM
Why doesn't this create a red square
void makeImage(void){
int a,b;
for(a=0;a<99;a++){
for(b=0;b<99;b++){
rasters[a][B][0]=1;
rasters[a][B][1]=0;
rasters[a][B][2]=0;
}
}
}here is the glDrawPixels function
glDrawPixels(100,100,GL_RGB,GL_UNSIGNED_BYTE,raste rs);

07-12-2004, 04:06 PM
Try this instead:


void makeImage(void){
int a,b;
for(a=0;a<99;a++){
for(b=0;b<99;b++){
rasters[a][B][0]=0xff;
rasters[a][B][1]=0;
rasters[a][B][2]=0;
}
}
}

mikael_aronsson
07-12-2004, 11:26 PM
Hi !

You do get a red square, it's just very little red :cool: each byte has a value between 0-255 so the example above should give you a very red square, 0x80 (128) a dull red square and so on.

Mikael

grimoire
07-13-2004, 01:59 PM
I still have a black screen here is my code now
GLubyte rasters[100][100][3];

void makeImage(void){
int a,b;
for(a=0;a<100;a++){
for(b=0;b<100;b++){
rasters[a][B][0]=255;
rasters[a][B][1]=0;
rasters[a][B][2]=0;
}
}
}
glPixelStorei (GL_UNPACK_ALIGNMENT, 1);
glDrawPixels(100,100,GL_RGB,GL_UNSIGNED_BYTE,raste rs);

mikael_aronsson
07-13-2004, 11:26 PM
Hi !

Look's ok to me, are you sure the rest of the code is correct, can you render something else ?

Mikael

grimoire
07-14-2004, 02:10 PM
I don't know what was wrong but I retyped the whole code and now it works thanx. Do these functions ex: glDrawPixels glCopy Pixels... only work in ortho view?