Advertisement Jump to content
Sign in to follow this  
saransiva_ps

OpenGL Align object in 3D space with respect to (View port) Window Coordinates

This topic is 1757 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,

   We have to draw a reference axis (XYZ) placed at the bottom left corner of the view port. I am using OpenGL 4.3 Core profile.
I found some methods implementing it using Orthographic projection in another view port and positioning it in window coordinates.

   But I need some help in placing the reference axis aligned with the (bottom left corner)view port using perspective projection.
That is the 3D object (XYZ axis) even though it has world space position it has to align itself with the view port and orient accordingly with
respect to the camera

Thanks
Saravanan

Share this post


Link to post
Share on other sites
Advertisement

I am not sure I get what you want.

 

Probably the easiest way would be to use a vertex shader that doesn't multiply the quad you are position by the modelview matrix. That way the coordinates you have to sent to OpenGL are coordinates relative to the camera, and it will always be shown at the same place on the screen regardless of how the camera move.

 

You can do this without a custom shaders, also, but then you have to apply the inverse of the view matrix to your quad every frame to neutralize the view transformation.

 

Note that what I am telling you still uses the projection matrix, so what you show will be "distorted" by it. If you didn't want that, then simply use the technique you already know (ortho + new viewport).

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!