Hi,
I have a problem with these two functions. I have managed to run them on a primitive (triangle). However when it comes to a 3D textured object I couldn’t get them to work. Is it because I am not using glPixelStorei function properly?
Here is the piece of code I am working on. I already have a rendered object and what I want to do is read the pixels clear everything and draw the original object again. Any help will be greatly appreciated…
/////////////////////////////////////////////////////////////////////////////////////////
int width=556, height=556;
long NbBytes = 4 * width * height;
char *pixels = new char[NbBytes];
unsigned char *pixels2 = new unsigned char[NbBytes];
glPixelStorei( GL_PACK_ALIGNMENT, 1);
glReadPixels(0,0,width,height,GL_RGBA,GL_UNSIGNED_BYTE,pixels);
// glClear(GL_COLOR_BUFFER_BIT);
glEnd();
glRasterPos2i(-12,-12);
// glDrawBuffer(GL_FRONT);
glDrawPixels(width,height,GL_RGBA,GL_UNSIGNED_BYTE,pixels);
glEnd();
//////////////////////////////////////////////////////////////////////////////////
glRotated(-fz, 0, 0, 1);
glRotated(-fy, 0, 1, 0);
glRotated(-fx, 1, 0, 0);
double sc = (5 + m_dy) / (5 + dy) ;
glScaled(sc, sc, 1);
glTranslated( 0, 0, m_dz-dz);
// glTranslated(m_dx-dx, m_dy-dy, m_dz-dz);
glRotated(m_fx, 1, 0, 0);
glRotated(m_fy, 0, 1, 0);
glRotated(m_fz, 0, 0, 1);
glFinish();
} // -----------------------------------