Jump to content

  • Log In with Google      Sign In   
  • Create Account

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


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
1 reply to this topic

#1 saransiva_ps   Members   -  Reputation: 176

Like
0Likes
Like

Posted 28 March 2014 - 02:50 AM

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



Sponsor:

#2 Javier Meseguer de Paz   Members   -  Reputation: 371

Like
0Likes
Like

Posted 28 March 2014 - 07:06 AM

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).


“We should forget about small efficiencies, say about 97% of the time; premature optimization is the root of all evil” -  Donald E. Knuth, Structured Programming with go to Statements

 

"First you learn the value of abstraction, then you learn the cost of abstraction, then you're ready to engineer" - Ken Beck, Twitter





Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS