Jump to content
  • Advertisement


This topic is now archived and is closed to further replies.


Strange results with orthographic rendering

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

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)
	v3 pn	= pp.normal();	// Plane Normal

	v3 auab	= pp.A + pn;	// A + unit_vector(normal)


	gluOrtho2D(0,xs,0,ys);	// Cartesian



	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]

Share this post

Link to post
Share on other sites

Hey, I solved my own problem: I didn''t have the correct up vector for each of the views (0,1,0 just happened to be correct for XY).

Sorry about that, I''ll leave the post up for anyone else who might run into the same silly problem.

Thanks, ~SPH

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!