Jump to content
  • Advertisement
Sign in to follow this  
sepoto

DX11 Setting up an orthographic projection.

This topic is 2095 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 posting a link to the Visual Studio 2013 project:

https://skydrive.live.com/redir?resid=DB0189AA1CD22777!146648&authkey=!AGLSkYMJDxU8o5Q&ithint=folder%2c.sln

 

What I have done is combine aspects of http://www.rastertek.com/tutdx11.html Tutorial 4 and Tutorial 11. I have also updated the code to use DirectXMath and also to use the latest incarnations of DirectX11 functions for the Windows 8.1 SDK.

 

I have three triangles drawn and two of them are closer to the camera than the first. It appears so since what I have right now is a vertex shader and pixel shader that are set up for a projection. What I have done is incorporate the disable the z buffer code with the vertex and pixel shader and model rendering capability from rastertek.com Tutorial 4.

 

What I am trying to create is an orthographic projection just like blenders top view where the change in the triangles size would not be apparent even though the triangles have different z values so I can set up a way to zoom in and zoom out. I'm pretty sure what has to be done is that the vertex shader has to be modified to project orthographically but I'm not really sure about how to go about that yet.

 

I tried following the texture shader code in Tutorial 11 but it's only for rendering a texture I think and what I am trying to render orthographically are three meshes.

 

I know the destructors need work. It is functional right now I need to work on memory de allocation I know that. There are a lot more changes that would have to be made to the code but whats getting to me right now is the displaying the projection. I tried replacing the projectionMatrix with orthoMatrix but for some reason it dose not display so I have to find out why. My goal at this point is to add instead of triangles some cylinders and I do have already some samples for assimp which is going to import cylinders instead of triangles so that I can set up an orthographic projection and change a zoom level on the what is now the triangles. 

 

I'm referring to Luna right now on how this might be done.

 

There is some question in my mind about how the zoom might be accomplished.

 

Thanks for any help...

Edited by sepoto

Share this post


Link to post
Share on other sites
Advertisement

For an orthographic projection, you should take a look in the DirectX documentation (in the downloadable SDK or online).  There are functions described in the docs that explain how to create an orthographic projection.

 

However, I would also recommend that you check with the license information of the projects that you are modifying to ensure that you can re-publish them online.  I'm not a lawyer, and I don't know how the Rastertek tutorials are licensed, but you probably shouldn't be posting modified code unless you are sure you are compliant...

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.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!