OpenGL 3D Cartesian coordinates?

http://img401.imageshack.us/img401/923/newbitmapimageiak.png

So, I decided to move to 3D after fooling around in 2D for a while with OpenGL.

I start up the camera with gluPerspective; worked perfect as you can see above.

Now I’m wondering, how do I convert the matrix coordinate system into a Cartesian coordinate system? I messed with using glOrtho along with gluPerspective, but it was to no avail. Is there another command for it? I’ve googled this many times, and I find long papers that supposedly teaches me how, but instead explain vanishing point and philosophical questions on what the third dimension actually is, instead of a command to do what I need to do. Hahah.

Anyway, any insight is great. Thanks!

(Just in case it’s relevant, here’s gluPerspectives initialization)

public static void main(String args[]){
		try{
			Display.setTitle("I'm not an idiot!");
			Display.setDisplayMode(new DisplayMode(800, 600));
			Display.setResizable(true);
			Display.create();
		}catch(LWJGLException ex){
			ex.printStackTrace();
		}
		
		glMatrixMode(GL_PROJECTION);
		glLoadIdentity();
		//glOrtho(0, Display.getWidth(), Display.getHeight(), 0, -1, 1);
		Project.gluPerspective(45, (float)Display.getWidth()/(float)Display.getHeight(), 0.1f, 100f);
		
		//Main m = new Main();
		Main2 m = new Main2();
		m.loop();
	}

I’m not sure I follow - surely you’re already using a cartesian coord system (as opposed to say, radial). What are you trying to do?

Just guessing here, but if you’re not getting a good enough “3D feel”, try to increase the FOV (currently at 45). For most games it’s between 60 and 90. It’s also somewhat hard to notice it with only a cube.

It uses floats, like, since the screen is 800/600. So:

x = 0.5f = 400

I don’t want to use floats to define places on screen, because admittedly, it’s a bit hassling. glOrtho “converts” the coordinate system to a more standard “Cartesian” style. That’s what I’m going for, get me? Just, I don’t understand if I can use glOrtho to define 3d normally the same way as gluPerspective or if I should use them together.

I already know that I can just do division to get this too, but if there’s a built in way to do this, I’d like that a lot more ^-^

Both of those are cartesian, just with different ranges. Cartesian is just a regular rectangular coord system with the x/y/z axies at right angles to each other.

Anyway, what you’re after is just an orthographic projection. Just replace your calls to gluProjection with glOrtho or gluOrtho2d calls. All of those are just easy ways to set up the projection matrix so you only really use one at a time.

And don’t forget to put your matrix mode back to MODELVIEW afterwards.

Thanks, got it working. I was able to convert it exactly how I wanted with glOrtho and glScale and glRotate.
I know to change to modelview too, thanks :slight_smile:

This OpenGL stuff really sparks my nerdy mathematical interests lol. It’s so nifty!