Archived

This topic is now archived and is closed to further replies.

Rendering to a texture

This topic is 5589 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi, my intent is to render a scene to a texture as in the tutorial on gametutorials. The only difference is: I want the scene rendered to the texture from a different point of view. Say i want the scene to be rendered with:
gluLookAt(0,0,0,  0,0,-5,  0,1,0) 
but the "texturized" one to be rendered with
gluLookAt(0,100,0,  0,-1,0,  0,1,0) 
so i can have an overview of the scene from the top looking to bottom. I''ve tried:
glu.gluLookAt(0, 0, 0,
              0, 0, -5,
              0, 1, 0);
// do lights...
gl.glPushMatrix();
   glu.gluLookAt(0, 100, 0,
                 0,-1,0,
                 0, 1, 0);
   gl.glViewport(0, 0, 512, 512);
   gl.glCallList(MY_SCENE);
   gl.glBindTexture(GL_TEXTURE_2D, mirror[0]);
   gl.glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 0, 0, 512, 512, 0);
   gl.glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
   gl.glViewport(0, 0, width, height);
gl.glPopMatrix();
gl.glCallList(MY_SCENE);
 
but it doesn''t work... How can I do this ? Thanks!

Share this post


Link to post
Share on other sites