I am having a bit of a problem I have noticed within the first 10 mins of working with OpenGLES that really the function calls are mostly the same however how you set up your methods is completely different.
I understand the basics of animating a polygon in OpenGL. The idea of changing the modelmatrix and then re-drawing the scene and using double buffering to cut down on the lag that you see when moving things quickly or updating things quickly and alot.
So here my question. How would I accomplish the same. In OpenGl in C or C++ I could have my own method that calls the display() function that will re-draw the scene.
I have looked around and had to re-learn how to draw a simple polygon. I assume that it is completely different. I have looked around on here and I have found some tutorials for things but nothing seems to really drive home what the methodology is behind the change. I am interested in understanding it vs copying.
Thanks
New Material:
Here is what I am trying to achieve in android. This code is in C. From my reading the way that I understand OpenGL is deprecated but I feel like I should still be able to achieve the same thing.
This code reflects that you have a listener that waits for a button to be pressed and once it is then it does the associated code and re-draws the display. This from my understanding if different in OpenGL ES.
void main(int argc, char** argv)
{
/* Standard GLUT initialization */
glutInit(&argc,argv);
/* default, not needed */
glutInitDisplayMode (GLUT_SINGLE | GLUT_RGB);
glutInitWindowSize(500,500); /* 500 x 500 pixel window */
/* place window top left on display */
glutInitWindowPosition(0,0);
glutCreateWindow("COMP-5/6400 Assignment 2"); /* window title */
/* display callback invoked when window opened */
glutDisplayFunc(display);
glutSpecialFunc (processSpecialKeys);
myinit(); /* set attributes */
glutMainLoop(); /* enter event loop */
}
void processSpecialKeys(int key, int x, int y)
{
switch(key){
case GLUT_KEY_UP:
moveUp();
break;
case GLUT_KEY_DOWN:
moveDown();
break;
case GLUT_KEY_LEFT:
moveLeft();
break;
case GLUT_KEY_RIGHT:
moveRight();
break;
}
}
void moveUp(){
personX= (5.0*cosf(personRota))+personX;
personY= (5.0*sinf(personRota))+personY;
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
display();
}