1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43
|
#include <glut.h>
#include "my_modeldata.h"
void Draw()
{
glClear(GL_COLOR_BUFFER_BIT);
glEnableClientState(GL_VERTEX_ARRAY);
glVertexPointer(3,GL_FLOAT,0,vertArray);
glDrawArrays(GL_TRIANGLE_STRIP,0,4);
//"vertArray" is my exported object
//from 3Dmax
glutPostRedisplay();
glutSwapBuffers();//double buffering
}
void Init()
{ glClearColor(1.0,0.0,0.0,1.0);//background
glEnable(GL_DEPTH_TEST);
glDepthFunc(GL_LEQUAL);
glShadeModel(GL_FLAT);
glMatrixMode(GL_PROJECTION);//??do research on it
glLoadIdentity();
glOrtho(0.0, 1.0,0.0,1.0,-1.0,1.0);
glEnableClientState(GL_NORMAL_ARRAY);
}
int main()
{
glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH);
glutInitWindowSize(600,600);
glutInitWindowPosition(250, 250);
glutCreateWindow("ANIMATION AND LIGHTING");
Init();
glutDisplayFunc(Draw);
glutMainLoop();
return 0;
}
|