OpenGL: set position instead of translation?

Is it possible to set the current render position as an arbitrary value, and not just assign it an offset from the current location?

This is what I am doing now:

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

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

I am using OpenGL with JOGL.

Update

@Bahbar offers the following:

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

When I do this, everything but the six lines disappears. I do not know why. I have a problem with a flat clipping environment that is too close, so maybe they are too far away to be visible.

+3
source share
2 answers

. .

gl.glLoadIdentity();
gl.glTranslatef(...);
+5

, gluLookAt. FAQ OpenGL, , : 8.060 "" ?

/ / . , - Y, , :

gluLookAt(camera[0], camera[1], camera[2], /* look from camera XYZ */
          0, 0, 0, /* look at the origin */
          0, 1, 0); /* positive Y up vector */ 
glRotatef(orbitDegrees, 0.f, 1.f, 0.f); /* orbit the Y axis */ 
          /* ...where orbitDegrees is derived from mouse motion */
glCallList(SCENE); /* draw the scene */

, .

gluLookAt() ( ).

, gluLookAt: 3. , , .

. , , . (0, 0, 0).

, , : GLU.gluLookAt Java OpenGL .

0

Source: https://habr.com/ru/post/1765346/


All Articles