Advertisement Jump to content
Sign in to follow this  
nihilisticod

projecting and unprojecting

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

Iv'e got a video card that doesnt support screenbuffer objects. What I am trying to is take a small capture of the screen of some pre-selected sqare size centered at one point, Then reproject this square point at that depth back into the scene using a shader. Now, here's what im trying: I do a gluProject(m_Pos[0],m_Pos[1],m_Pos[2],pMod,pProj,pView,&dpx,&dpy,&dpz) All of the non-matrix arguments are doubles, and I know that this is correct by drawing a shape at that point on the screen. dpx and dpy are in coordinates between 0 and my resolution dimensions if the point is on the screen. What I try next, is GLdouble nul[3]; GLdouble nlr[3]; gluUnProject(dpx-64,dpy-64,dpz,pMod,pProj,pView,nul+0,nul+1,nul+2); gluUnProject(dpx+64,dpy+64,dpz,pMod,pProj,pView,nlr+0,nlr+1,nlr+2); nul and nlr appear to give me two coordinates centered around the original point (m_Pos) that I want. This is true, except they are always aligned with a certain axis. I get a projected square like i want, just not one that is facing my camera. What is wrong with my logic? Also, are there any better ways of doing this?

Share this post


Link to post
Share on other sites
Advertisement
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!