writing to the framebuffer

Hey guys,

i have a problem with writing both RGBA and Depth info to the framebuffer.

i successfully filled an array with the Color info and another with the depth info using
glreadpixels(0,0,width,height,GL_RGBA,GL_UNSIGNED_INT_8_8_8_8,&somebuffer);
glreadpixels(0,0,width,height,GL_DEPTH_COMPONENT,GL_FLOAT,&someotherbuffer);

what i want to do is write them to a cleared framebuffer. so i used gldrawpixels like this:

for the color:
glWindowPos2i(0,0);
gldrawpixels(width,height,GL_RGBA,GL_UNSIGNED_INT_8_8_8_8,&somebuffer);

and for the depth:
glWindowPos2i(0,0);
gldrawpixels(width,height,GL_DEPTH_COMPONENT,GL_FLOAT,&someotherbuffer);

when i call gldrawpixels for the color only it works perfectly fine, but with the two of them the image gets all green … is there something i’m doing wrong…?

i avoided glrasterpos because i didn’t want anything to do with the current transformation. i just wanted to clear the buffer and just fill it with the data i already saved.

thanks in advance.

As per the DrawPixels documentation:

  1. COLOR groups will pull the depth value from the current raster position
  2. DEPTH groups will pull the color value from the current raster position

If you don’t want COLOR DrawPixels to modify the depth buffer, then disable depth testing or depthmask.

If you don’t want DEPTH DrawPixels to modify the color buffer, then disable colormask. Note that you must have depth testing enabled in order to modify the depth buffer at all, so you probably also want to set DepthFunc to ALWAYS.

Thanks, i’ll try that.