Thread: OpenGL ES 2.0 how to implement matrix transforms in OpenGL such as glLoadIdentity

  1. #1
    Registered User
    Join Date
    Aug 2010

    OpenGL ES 2.0 how to implement matrix transforms in OpenGL such as glLoadIdentity

    Dear everyone:
    For my OpenGL ES 2.0 program requiring to achieve some necessary matrices that supported by OpenGL such as glLoadIdentity, glLoadMatrix, glMultMatrix, glTranslate, glRotate, glFrustum, gluPerspective, gluOrtho2D, inverse of coordinate transforms, .etc.
    But as we known, in <OpenGL ES 2.0 Commom Specification> has specified that "The fixed function transformation pipeline is no longer supported. The application can compute the necessary matrices (can be the combined modelview and projection matrix, or an array of matrices for skinning) and load them as uniform variables in the vertex shader."
    You may doubt that why I should implement these functions for OpenGL ES 2.0 vertex shader can do this for me, but sometimes my application need to use these matrices.
    So I want to know how can I realize it, I don't want to do by the help of EGL,.etc. What I want to realize just somehow likewise EGL.
    and I have write a brief code to realize matric-----glLoadIdentity, and I then want to use an OpenGL program to test wether my code was right or not.

    Here is my brief code to realize glLoadIdentity.
    typedef struct  
    	GLfloat m[4][4];
    extern void mat_LoadIdentity(A3Matrix *result)
    	memset(result, 0x0, sizeof(A3Matrix));
    	result->m[0][0] = 1.0f;
    	result->m[1][1] = 1.0f;
    	result->m[2][2] = 1.0f;
    	result->m[3][3] = 1.0f;
    and here is part of my code to use my code above in an actual OpenGL example.
    void display(void)
    	/* display callback, clear frame buffer and z buffer,
    	rotate cube and draw, swap buffers */
    	mat_LoadIdentity(???);  //here I use my code,but I don't know what is the current martix 
    	glRotatef(theta[0], 1.0, 0.0, 0.0);
    	glRotatef(theta[1], 0.0, 1.0, 0.0);
    	glRotatef(theta[2], 0.0, 0.0, 1.0);
    as the question produces above by calling my function mat_LoadIdentity(), because I don't know how can I get the current matric.

    I run on the open source of OpenGL code-----mesa3D

    I do really wish who can tell me? maybe my thought above was wrong, wish you can give directions to me on how to implement matrix transforms in OpenGL such as glLoadIdentity , do not use any API that OpenGL ES doesn't support .
    Thank you very very very very much.
    Wait for your answer soon ! Thank you again loyally !

  2. #2
    Programming Wraith GReaper's Avatar
    Join Date
    Apr 2009
    Devoted my life to programming...

  3. #3
    Registered User
    Join Date
    Aug 2010
    Quote Originally Posted by Sipher View Post
    I wish I have present myself what I want to do clearly, although you may think it's a silly thing. But I do need to achieve this features.

  4. #4
    Frequently Quite Prolix dwks's Avatar
    Join Date
    Apr 2005
    Well, it seems someone has ported Nehe's OpenGL tutorial source code to OpenGL ES 1.x and SDL 1.3: QOpenCD: OpenGL ES 1.x Tutorials, Codesamples and Lessons
    It might be a bit out of date and not so useful if you're not using the SDL, but the OpenGL functions that are called should still be useful.

    Another nice link: OpenGL ES Implementations, Tutorials and Sample Code

    Seek and ye shall find. quaere et invenies.

    "Simplicity does not precede complexity, but follows it." -- Alan Perlis
    "Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
    "The only real mistake is the one from which we learn nothing." -- John Powell

    Other boards: DaniWeb, TPS
    Unofficial Wiki FAQ:

    My website:
    Projects: codeform, xuni, atlantis, nort, etc.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Sorting Matrix
    By alex 2010 in forum C++ Programming
    Replies: 0
    Last Post: 06-24-2010, 09:40 AM
  2. Matrix Help
    By HelpmeMark in forum C++ Programming
    Replies: 27
    Last Post: 03-06-2008, 05:57 PM
  3. matrix class
    By shuo in forum C++ Programming
    Replies: 2
    Last Post: 07-13-2007, 01:03 AM
  4. Weird errors.
    By Desolation in forum C++ Programming
    Replies: 20
    Last Post: 05-09-2007, 01:10 PM