v3 pn = pp.normal(); // Plane Normal
v3 auab = pp.A + pn; // A + unit_vector(normal)
//...
glViewport(x0,ly,isx,isy);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluOrtho2D(0,xs,0,ys); // Cartesian
glMatrixMode(GL_MODELVIEW);
glDisable(GL_DEPTH_TEST);
glLoadIdentity();
glTranslatef(vd.x/2,vd.y/2,0.0f);
glTranslatef(-cc.x,-cc.y,0.0f);
glColor3f(0.0f,1.0f,0.0f);
gluLookAt(pp.A.x, // Eye X
pp.A.y, // Eye Y
pp.A.z, // Eye Z
auab.x, // Object X
auab.y, // Object Y
auab.z, // Object Z
0.0f, // Up X
1.0f, // Up Y
0.0f // Up Z
);
// Draw
All help is appreciated, Thanks, ~SPH
NOTE: I have just realized that my XZ projection doesn't work because the viewing vector is perpendicular to the up vector... *DOH* : But this still doesn't explain my strange results with my YZ projection...
[edited by - ShmeeBegek on May 27, 2004 8:52:23 PM]
Strange results with orthographic rendering
Hello,
I'm using OpenGL to project a 3d scene onto a plane, orthographically. I'm getting some strange results, my XY projection works perfectly but my XZ projection does not work at all; and my YZ projection has very strange results. I know that the problem is not in my drawing code because I manually project some points and they come out well.
So I must be setting up my modelview matrix incorrectly, my only thought on it was that maybe things behind the 'camera' were not being rendered, so I tried rendering twice once facing in each direction (this didn't seem to help).
Here is how I set things up:
(Note that my viewing plane is defined by 'pp', which contains a point A and two vectors, E and V, and pp.normal() returns V x E)
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement