Jump to content
  • Advertisement
Sign in to follow this  
Maverick Programmer

OpenGL Portal making in OpenGL

This topic is 4025 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 was thinking of something I could try to do in OpenGL. I sit down and think... what could I try to recreate? Portals hit me, could it be simple or very complex. I'm trying to do a portal that you can see that next place but if you walk around the portal, it's flat and there is nothing and you can't go through. So tell me, how would you go about making a portal in OpenGL?

Share this post


Link to post
Share on other sites
Advertisement
Use a scene graph to determine whats on the other side, then you render that scene to a texture then apply the texture to your object in the current scene that lets you "see" into the other scene.

Share this post


Link to post
Share on other sites
I was thinking about that, but how do you get the scene rendered to an image if you can't actually see that scene? Or is there something else I'm missing? Say an enemy see's that portal and they walk through it as well, I'm going to need to find some way to be able to copy that area down to an image file.

Share this post


Link to post
Share on other sites
- Position the 'camera' at the location the portal looks into
- render to texture the scene the camera can see
- reposition the camera to whatever viewpoint the play can see
- render scene

Share this post


Link to post
Share on other sites
Alternatively you can use the stencil buffer and clip planes to restrict your drawing to the portal's surface and recursivly render your scene (starting at the current section of the camera) and applying the portal transformation to the camera setup at each point.

IIRC this is the way the Unreal engine handled portals back in the Unreal 1 days. Don't know if it still does it that way or not though.

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!