Jump to content
  • Advertisement
Sign in to follow this  
codingsolo

Overlapping viewports - can this be done?

This topic is 4414 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'm trying to use a second viewport that overlaps the first viewport. My code does this: Switches to the first viewport. Clears it. Presents on it. Switch to the second viewport. Clears it. Presents on it. Needless to say, of course, there is epileptic seizure inducing flicker on the second viewport because of the double clears. Any suggestions? Brandon

Share this post


Link to post
Share on other sites
Advertisement
Present doesn't "Present" just the current viewport. Present makes the entire backbuffer the image that's on the screen now. As such, you should only be calling Present once per-frame.

I think what you're trying to do is something like this:

BeginScene()
SetViewport(1)
Clear()
Draw stuff on this viewport
SetViewport(2)
Clear()
Draw stuff on this viewport
EndScene()
Present()

Also, keep in mind that Clear clears the entire surface, and is not limited by the current viewport.

Hope this helps.

Share this post


Link to post
Share on other sites
Thanks! It works now! Had issues where I wasn't calling End() on my sprite before going to the next viewport, but fixed that and everything works perfectly!

Thanks again, comrade!

Brandon

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!