Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

OpenGL: Set position instead of translating?

Can I set the current render position to be an arbitrary value, instead of just giving it an offset from the current location?

This is what I'm doing currently:

gl.glTranslatef(3.0f, 0.0f, 2.0f);

It allows me to say "I want to move left" but not "I want to move to point (2, 1, 2)". Is there a way to do the latter?

I'm using OpenGL with JOGL.

Update:

@Bahbar suggests the following:

gl.glLoadIdentity();
gl.glTranslatef(...);

When I do this, everything except six lines disappears. I'm not sure why. I'm having a problem with the far clipping plane being too close, so perhaps they're too far away to be rendered.

like image 277
Nick Heiner Avatar asked Sep 17 '10 18:09

Nick Heiner


1 Answers

Yes. Just start from the identity matrix.

gl.glLoadIdentity();
gl.glTranslatef(...);
like image 115
Bahbar Avatar answered Oct 20 '22 00:10

Bahbar