Curtain
Curtain

Reputation: 1972

Change OpenGL origin

I want to change the origin of my OpenGL origin. Pictures will explain:

This is how it is now:

As now

This is how I want it:

enter image description here

Current code

gl.glViewport(0, 0, width, height); 
gl.glMatrixMode(GL10.GL_PROJECTION);
gl.glLoadIdentity(); 
GLU.gluPerspective(gl, 45.0f,
    (float)width / (float)height, 0.1f, 100.0f);
 gl.glMatrixMode(GL10.GL_MODELVIEW);
 gl.glLoadIdentity();

Upvotes: 0

Views: 1836

Answers (1)

vmpstr
vmpstr

Reputation: 5211

try

gl.glTranslatef (0, height / 2.0, 0);

after the second glLoadIdentity call

(+ or - height)

Upvotes: 1

Related Questions