Jump to content
  • Advertisement

Archived

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

nildo

Something like the car's mirror (that you see the cars that are behing you)

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

Hello! I wish to put in a square or in a litle frame on the top left of my game''s screen (first person, 3D world) something like a car''s mirror (that on that you can see the cars thats behind you). Working like a Spy Camera that you can see whats behind you (working like that mirror that I told). How to do this?? I have no Idea... Thank you!

Share this post


Link to post
Share on other sites
Advertisement
I have no idea of how to do that... Any code will be apreciated!
What I want is: I want to put on a square whats behind the player

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
your problem is similar to what people who want dynamic cube mapping have to do... you have to draw the scene rotated 180 around (so that the scene actually is what is behind you) you have to save that scene to a texture using glCopyTexImage2D() & then erase that scene without actually ever switching buffers (so that the fake scene is never seen) & draw your real scene & draw a quad somewhere & map that texture to the quad. then you switch buffers. So if you think about it... you have to render twice as many scenes for this one simple effect. You can speed things up if you make the resolution of the texture you save the scene to fairly small, like 128x128 or maybe 256x256.

Share this post


Link to post
Share on other sites
So basically you''ve either borrowed or stolen code for a "(first person, 3D world)" game and know nothing about programming. And you thought maybe someone here would do your work for you.

quote:
Original post by nildo
I have no idea of how to do that... Any code will be apreciated!
What I want is: I want to put on a square whats behind the player


Share this post


Link to post
Share on other sites
Guest Anonymous Poster
or, maybe this could be done via glScisors (spelling?). in that way don''t have to bother creating texture, simple render from the a$$ would be enough.

Share this post


Link to post
Share on other sites
Coz I tought I was not clear on the first 2 questions... So I''ve tryied to simplify the things for who was going to answer.

Sorry bout all and thank you all!

Share this post


Link to post
Share on other sites
You have to:

*Render the real scene!

*Set glWievport to the mirror rect you want (if you are using gl)
(you have to compensate for the perspective, if the rect
isnt the same shape as the screen, glPerspective... )

*clear the z-buffer

*Turn the camera 180deg ,

Render the world one more time
(this time it will show inside the glWievport rect)

reset the glWievport and glPerspective

done!

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.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!