I'm not sure what you mean by which Matrix Library, unless you mean LWJGL's implementation of this?
The methods I use to accomplish the transformations are as follows:
[source lang="java"]glLoadIdentity();glTransform3f(camera.x, camera.y, camera.z);glRotate3f(camera.yaw, 0.0f, 1.0f, 0.0f);glRotate3f(camera.pitch, 1.0f, 0.0f, 0.0f);[/source]
So, if I were trying to draw an object in the world, I'd call the above code first, then this:
[source lang="java"]// move to the object's coordinatesglTranslate3f(position.x, position.y, position.z);// rotate the object (Y axis only)glRotate3f(rotation.y, 0.0f, 1.0f, 0.0f);// draw the objectglBegin(GL_QUADS); // vertex draw operationsglEnd();[/source]
Show differencesHistory of post edits
#3PixelPrime11
Posted 09 November 2012 - 01:46 PM
I'm not sure what you mean by which Matrix Library, unless you mean LWJGL's implementation of this?
The methods I use to accomplish the transformations are as follows:
[source lang="java"]glLoadIdentity();glTransform3f(camera.x, camera.y, camera.z);glRotate3f(camera.yaw, 0.0f, 1.0f, 0.0f);glRotate3f(camera.pitch, 1.0f, 0.0f, 0.0f);[/source]
So, if I were trying to draw an object in the world, I'd call the above code first, then this:
[source lang="java"]// move to the object's coordinatesglTranslate3f(position.x, position.y, position.z);// rotate the object (Y axis only)glRotate3f(rotation.y, 0.0f, 1.0f, 0.0f);// draw the objectglBegin(GL_QUADS); // vertex draw operationsglEnd();[/source]
The methods I use to accomplish the transformations are as follows:
[source lang="java"]glLoadIdentity();glTransform3f(camera.x, camera.y, camera.z);glRotate3f(camera.yaw, 0.0f, 1.0f, 0.0f);glRotate3f(camera.pitch, 1.0f, 0.0f, 0.0f);[/source]
So, if I were trying to draw an object in the world, I'd call the above code first, then this:
[source lang="java"]// move to the object's coordinatesglTranslate3f(position.x, position.y, position.z);// rotate the object (Y axis only)glRotate3f(rotation.y, 0.0f, 1.0f, 0.0f);// draw the objectglBegin(GL_QUADS); // vertex draw operationsglEnd();[/source]
#2PixelPrime11
Posted 09 November 2012 - 01:45 PM
I'm not sure what you mean by which Matrix Library, unless you mean LWJGL's implementation of this?
The methods I use to accomplish the transformations are as follows:
[source lang="java"]glLoadIdentity();glTransform3f(camera.x, camera.y, camera.z);glRotate3f(camera.yaw, 0.0f, 1.0f, 0.0f);glRotate3f(camera.pitch, 1.0f, 0.0f, 0.0f);[/source]
So, if I were trying to draw an object in the world, I'd call the above code first, then this:
[source lang="java"]// move to the object's coordinatesglTranslate3f(position.x, position.y, position.z);// rotate the object (Y axis only)glRotate3f(rotation.y, 0.0f, 1.0f, 0.0f);// draw the objectglBegin(GL_QUADS); // vertex draw operationsglEnd();[/source]
The methods I use to accomplish the transformations are as follows:
[source lang="java"]glLoadIdentity();glTransform3f(camera.x, camera.y, camera.z);glRotate3f(camera.yaw, 0.0f, 1.0f, 0.0f);glRotate3f(camera.pitch, 1.0f, 0.0f, 0.0f);[/source]
So, if I were trying to draw an object in the world, I'd call the above code first, then this:
[source lang="java"]// move to the object's coordinatesglTranslate3f(position.x, position.y, position.z);// rotate the object (Y axis only)glRotate3f(rotation.y, 0.0f, 1.0f, 0.0f);// draw the objectglBegin(GL_QUADS); // vertex draw operationsglEnd();[/source]
#1PixelPrime11
Posted 09 November 2012 - 01:45 PM
I'm not sure what you mean by which Matrix Library, unless you mean LWJGL's implementation of this?
The methods I use to accomplish the transformations are as follows:
[source lang="java"]glLoadIdentity();glTransform3f(camera.x, camera.y, camera.z);glRotate3f(camera.yaw, 0.0f, 1.0f, 0.0f);glRotate3f(camera.pitch, 1.0f, 0.0f, 0.0f);[/source]
So, if I were trying to draw an object in the world, I'd call the above code first, then this:
[source lang="java"]// move to the object's coordinatesglTranslate3f(position.x, position.y, position.z);// rotate the object (Y axis only)glRotate3f(rotation.y, 0.0f, 1.0f, 0.0f);// draw the objectglBegin(GL_QUADS); // vertex draw operationsglEnd();[/source]
The methods I use to accomplish the transformations are as follows:
[source lang="java"]glLoadIdentity();glTransform3f(camera.x, camera.y, camera.z);glRotate3f(camera.yaw, 0.0f, 1.0f, 0.0f);glRotate3f(camera.pitch, 1.0f, 0.0f, 0.0f);[/source]
So, if I were trying to draw an object in the world, I'd call the above code first, then this:
[source lang="java"]// move to the object's coordinatesglTranslate3f(position.x, position.y, position.z);// rotate the object (Y axis only)glRotate3f(rotation.y, 0.0f, 1.0f, 0.0f);// draw the objectglBegin(GL_QUADS); // vertex draw operationsglEnd();[/source]