Advanced Getting Started: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
(11 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
= Moving from OpenGL Fixed Functions = | |||
== pmvMatrix == | == pmvMatrix == | ||
com.jogamp.opengl.util.PMVMatrix | |||
pmvMatrix can make a matrix by using glTranslate/glRotate etc. FFP instructions. | |||
=== Camera setup example === | |||
pmvMatrix.glMatrixMode(GLMatrixFunc.GL_PROJECTION); | |||
pmvMatrix.glLoadIdentity(); | |||
pmvMatrix.gluPerspective(fov, aspect, zNear, zFar); | |||
pmvMatrix.glMatrixMode(GLMatrixFunc.GL_MODELVIEW); | |||
pmvMatrix.glLoadIdentity(); | |||
pmvMatrix.glRotatef(360 - pitch, 1, 0, 0); | |||
pmvMatrix.glRotatef(360 - yaw, 0, 1, 0); | |||
pmvMatrix.glRotatef(360 - roll, 0, 0, 1); | |||
pmvMatrix.glTranslatef(-position.x, -position.y, -position.z); | |||
pmvMatrix.update(); | |||
=== Using with shaders example === | |||
GLUniformData pmvMatrixUniform; | |||
init code... | |||
PMVMatrix pmvMatrix = ...; | |||
state.attachObject("pmvMatrix", pmvMatrix); | |||
pmvMatrixUniform = new GLUniformData("pmvMatrix", 4, 4, pmvMatrix.glGetPMvMatrixf()); | |||
state.ownUniform(pmvMatrixUniform); | |||
state.uniform(gl, pmvMatrixUniform); | |||
display code... | |||
state.uniform(gl, pmvMatrixUniform); | |||
== immModeSink == | == immModeSink == | ||
com.jogamp.opengl.util.ImmModeSink | |||
ImmModeSink can make VBO by using FFP instructions |
Latest revision as of 23:15, 27 October 2012
Moving from OpenGL Fixed Functions
pmvMatrix
com.jogamp.opengl.util.PMVMatrix
pmvMatrix can make a matrix by using glTranslate/glRotate etc. FFP instructions.
Camera setup example
pmvMatrix.glMatrixMode(GLMatrixFunc.GL_PROJECTION); pmvMatrix.glLoadIdentity(); pmvMatrix.gluPerspective(fov, aspect, zNear, zFar); pmvMatrix.glMatrixMode(GLMatrixFunc.GL_MODELVIEW); pmvMatrix.glLoadIdentity(); pmvMatrix.glRotatef(360 - pitch, 1, 0, 0); pmvMatrix.glRotatef(360 - yaw, 0, 1, 0); pmvMatrix.glRotatef(360 - roll, 0, 0, 1); pmvMatrix.glTranslatef(-position.x, -position.y, -position.z); pmvMatrix.update();
Using with shaders example
GLUniformData pmvMatrixUniform;
init code...
PMVMatrix pmvMatrix = ...; state.attachObject("pmvMatrix", pmvMatrix); pmvMatrixUniform = new GLUniformData("pmvMatrix", 4, 4, pmvMatrix.glGetPMvMatrixf()); state.ownUniform(pmvMatrixUniform); state.uniform(gl, pmvMatrixUniform);
display code...
state.uniform(gl, pmvMatrixUniform);
immModeSink
com.jogamp.opengl.util.ImmModeSink
ImmModeSink can make VBO by using FFP instructions