Jump to content
  • Advertisement
Sign in to follow this  
mast10

Viewport perril

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

Hi everybody, I am building an application with support for multiple windows with multiple viewports. For each window i create a swapchain and a zbuffer. However, when i try to render my geometry it won't display exept if the viewports Width/Height == Rendertarget Width/Height. Is this normal or am i making a mistake with my projectionmatrix in the FovY part which is PI/4 by default? Thanx in advance

Share this post


Link to post
Share on other sites
Advertisement
The viewport and projection matrix are independent, such that if the projection matrix works for the full viewport, it'll work just as well for the smaller viewport. From your description, I'm not sure what the issue is.

- What is the state of the depth stencil in conjunction with the viewport.
- What values are you trying to use for the viewport?

Share this post


Link to post
Share on other sites
What Im trying to say is:

My geometry is only rendered is the aspect ratio of my viewport and my renderwindow are the same.
Example:

rederwindow = 500x500 thus has an aspect ratio of 1;
when i try to split my 500 x 500 in half (for example to use a split screen) the size of my viewports become:

0,0,250,500 and
250,0,250,500

At this stage directx doesn't render anything because 250/500 is not an aspect ratio of 1.

My question:

Is this normal and can a viewport anly have the aspect ratio of its render window or can it have a different aspect ratio (it should be posible hence split screens)?

The general flow of my program is as follows

set swapchain (one per render window)
set zbuffer (one per render window)
set viewport (multiple per render window)
clear
beginscene
draw
endscene
set viewport
clear
begiscene
draw endscene
swapchain.present

for your information : i initialized the directx device with an invisible window and for each window that is created i create an aditional swapchain and an aditional zbuffer.

Any ideas?

Share this post


Link to post
Share on other sites
You're setting the viewport after the target, which is good (setting the target sometimes mucks with the existing viewport settings).

You're probably missing a cast to a float somewhere and your aspect ratio is calculated with an integer divide, and coming up with 0.

Share this post


Link to post
Share on other sites
Namethatnobodyelsetook is probably correct. If reviewing your calc for the aspect ratio (as suggested) doesn't seem to work, post the code for the aspect ratio calc, and the code segments where you set the viewports.

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!