I’m currently dumping a screenshot of my rendered scene into the texture memory with this code:
glBindTexture(GL_TEXTURE_RECTANGLE_NV, rendered_texture_rectid);
if (tex_rect_width != m_nWidth | | tex_rect_height != m_nHeight)
{
tex_rect_width = m_nWidth;
tex_rect_height = m_nHeight;
if (bif)
bif = (GLubyte )realloc(bif,tex_rect_widthtex_rect_height4);
else
bif = (GLubyte )malloc(tex_rect_widthtex_rect_height4);
glReadPixels(0, 0, tex_rect_width, tex_rect_height, GL_RGBA, GL_UNSIGNED_BYTE, bif);
glTexImage2D(GL_TEXTURE_RECTANGLE_NV, 0, GL_RGBA,
tex_rect_width, tex_rect_height, 0, GL_RGBA, GL_UNSIGNED_BYTE, bif);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
}
else
glCopyTexSubImage2D(GL_TEXTURE_RECTANGLE_NV, 0, 0, 0, 0, 0, tex_rect_width, tex_rect_height);
Now I want to take all the pixels in my texture and invert the intensity. So I want all my dark pixel to become light, and the light ones to become dark.
Suggestions anyone???
Mogu