I am trying to implement environment mapping. For now, I have a quad in the middle of my environment (4 walls and a floor) and I want to texture map the part of the wall that is facing the quad to the quad. Eventually, I hope to create a disco ball which will be made up of several quads that reflects the environment in this way.
Having done A LOT of online research, it seems that the function glCopyTexImage2d is a good function to use and I’ve actually got it working… somewhat.
The problem I am having is that glCopyTexImage2d seems to be limited to the current scene within the viewport.
So a call like,
glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 0, 0, 128, 64, 0);
will map the bottom left of the screen.
However, the camera will always be inside of my environment so it won’t see the wall behind it which is the wall that should be mapped to my quad.
How do I capture the area of the back wall that needs to be mapped to the quad when glCopyTexImage2D only copies from the current scene?
I’ve also tried this,
glPushMatrix(); gluLookAt(x, y, z, // middle of quad x, y, z+1, // look along +z axis (for now) 0.0, 1.0, 0.0); // up vector glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 0, 0, 128, 64, 0); glPopMatrix();
expecting to at least get the bottom left 128x64 portion of the screen from this view but I still only get the view from the current scene? I’ve provided an image.
Any suggestions? Perhaps I should use a different function?