Jump to content
  • Advertisement
Sign in to follow this  
Eitsch

Mirror in my racing simulation

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

i want to create a mirror on my vehicles in the game. my first idea was: create second viewport (small) and render the scene for the image of the mirror readthepixels from the viewport draw the normal scene in the other viewport and bind the texture over the mirror but have worries about the performace. are there better methods? hope you understand me thanks

Share this post


Link to post
Share on other sites
Advertisement
Hmm mirror in a car, as long as your talking about rear view mirrors for a first person style racing game, you can use the stencil buffer, to cut out your mirror, then draw the back ground in the cut out section. or you could Render a texture of your mirror and then use that texture, useing pbuffers/fbo or whatever you prefer. If you have any questions just ask =D

Share this post


Link to post
Share on other sites
the problem is: i think the generation of the texture is slow. the glReadPixels and the Texturegeneration. i don't understand your description with the stencil buffer. if i use the stencilbuffer and glScissor i still have to render the scene 2 times because of the different view right?

Share this post


Link to post
Share on other sites
Quote:
Original post by Eitsch
the problem is: i think the generation of the texture is slow. the glReadPixels and the Texturegeneration.

Don't use ReadPixels. It will kill performance, since your data will make a roundtrip over the AGP to the CPU and back. So either use glCopyTexSubImage2D() (keeping everything on VRAM), or render directly to the texture through pbuffers / FBO.

Quote:

i don't understand your description with the stencil buffer. if i use the stencilbuffer and glScissor i still have to render the scene 2 times because of the different view right?

You'll have to render it twice anyway, even if you render to a texture: once from the reflected view point, and once the actual player view. But since the mirror surface is usually very small compared to your actual screen size, you will be able to cull away a large percentage of the geometry when rendering the reflection. Using glScissor() in addition to geometric culling will help with fillrate.

Share this post


Link to post
Share on other sites
thanks. only one thing: do you have a good example or tutorial on pbuffers and FBO. i have never read something about it so far and i have no idea how to program it.

thanks

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • 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!