Advertisement

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

Started by February 26, 2004 12:35 PM
19 comments, last by nildo 21 years ago
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!
render view you want to texture, then apply it to quad you want mirror on.
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
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.
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


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.
Advertisement
aldisd he just said his game was a 1st person 3d.........he didnt say how good it was maybe its just a camera in a box?

its friday be happy!
i apologise for my last post aldisd after i find nildo has multiple posts on this topic on the forum why oh why?
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!
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!
-Anders-Oredsson-Norway-

This topic is closed to new replies.

Advertisement