then you can use the following code
//To retrieve the current Modelview matrix: GLfloat m[16]; glGetFloatv (GL_MODELVIEW_MATRIX, m); [left] [/left]this comes from http://www.opengl.org/resources/faq/technical/transformations.htm so I would say it was the recommended way to deal with fixed-function (pre 3.1 openGL).
I'm trying to implement the glsl_pseudo_instancing nvidia example in my terrain engine project.
I've already setup the proper initialization routines (loading the shaders etc.) but I'd like to ask some explanations about the render() routine.
Here is the upper part of the original nVidia code:void renderScene(void) { assert(gCurrentMesh != NULL); int i; int count; matrix4f view; vec3f light; vec3f lightWorldSpace(0.0f, 100.0f, 0.0f); vec3f lightPositionView; // Set state for rendering the mesh gCurrentMesh->setState(); // Get the view transform from the mouse interactor view = gMouseInteractor.get_transform(); // HERE IS WHERE I NEED HELP // Compute the light's position in view space view.mult_matrix_vec(lightWorldSpace, lightPositionView); lightPositionView = vec3f(0.0f, 0.0f, 0.0f); ....... // Download the view matrix glProgramLocalParameter4fARB(GL_VERTEX_PROGRAM_ARB, 4, view(0, 0), view(0, 1), view(0, 2), view(0, 3)); glProgramLocalParameter4fARB(GL_VERTEX_PROGRAM_ARB, 5, view(1, 0), view(1, 1), view(1, 2), view(1, 3)); glProgramLocalParameter4fARB(GL_VERTEX_PROGRAM_ARB, 6, view(2, 0), view(2, 1), view(2, 2), view(2, 3)); glProgramLocalParameter4fARB(GL_VERTEX_PROGRAM_ARB, 7, view(3, 0), view(3, 1), view(3, 2), view(3, 3)); // Download the light position glProgramLocalParameter4fARB(GL_VERTEX_PROGRAM_ARB, 11, lightPositionView[0], lightPositionView[1], lightPositionView[2], 1.0f);
From what I understood, I need to retrieve the current view transform and pass the matrix parameters to the vertex program using the glProgramLocalParameter4fARB calls beow.
I have a very simple camera routine that just set pitch,yaw,roll and xyz positions.
How could I calculate the matrix4f view (the view transform matrix) using my camera information?
Thanks for any help!

Find content
Not Telling