Jump to content
  • Advertisement

Archived

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

Virgus

Rendering to a texture

This topic is 5894 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
Advertisement
glu.gluLookAt(0, 100, 0, 0,-1,0, 0, 1, 0);

The up vector must not be parallel to the line of sight from the eye to the reference point.



Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!