projecting and unprojecting

Started by
-1 comments, last by nihilisticod 18 years, 9 months ago
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?

This topic is closed to new replies.

Advertisement