Jump to content
  • Advertisement

Archived

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

paulbird

how do you make a mirror?

This topic is 5735 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

A. Is there a simple way to make a flat mirror in openGL - how about a spherical mirror. B. What about a lens? C. What if I wanted to draw a virtual world with a virtual computer in openGL and on the screen of that computer is the same virtual world?

Share this post


Link to post
Share on other sites
Advertisement
quote:
Original post by paulbird
A. Is there a simple way to make a flat mirror in openGL - how about a spherical mirror.

B. What about a lens?

C. What if I wanted to draw a virtual world with a virtual computer in openGL and on the screen of that computer is the same virtual world?


A:
Render everything 2 times.
First the reflection (the the original geometry mirrored, for example glScalef(1,-1,1)), then a transperent polygon as the mirror surface and finally the "real" geometry.

For spherical mirrors you need to use cube maps or environment mapping.

B:
Refractions are hard to do. Cube maps might work.

C:
Render the scene in to a texture and use that texture as the computer screen.

Share this post


Link to post
Share on other sites
Have you got any example code of environment mapping such as sphere-mapping or cube-mapping? I''m not sure I understand exactly how that all works.

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.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!