I can't seem to get the glDrawElement to work correctly. Could someone tell me what I am doing wrong? Thanks
Code:#include <GL/gl.h> #include <GL/glu.h> #include <GL/glut.h> #include <stdlib.h> void init(void){ glClearColor(0.0,0.0,0.0,0.0); glShadeModel(GL_SMOOTH); } void reshape(GLint w,GLint h){ glViewport(0,0,(GLsizei)w,(GLsizei)h); glMatrixMode(GL_PROJECTION); glLoadIdentity(); gluOrtho2D(0.0,(GLdouble)w,0.0,(GLdouble)h); } void display(void){ GLdouble mix[]={25.0,25.0,0.0, 35.0,25.0,0.0, 35.0,35.0,0.0, 25.0,35.0,0.0}; glClear(GL_COLOR_BUFFER_BIT); glEnableClientState(GL_VERTEX_ARRAY); glVertexPointer(3,GL_DOUBLE,6*sizeof(GLdouble),mix); glDrawElements(GL_LINE_STRIP,3,GL_DOUBLE,mix); glDisableClientState(GL_VERTEX_ARRAY); glutSwapBuffers(); } int main(int argc,char **argv){ glutInit(&argc,argv); glutInitDisplayMode(GLUT_RGB|GLUT_DOUBLE); glutInitWindowSize(350,350); glutCreateWindow(argv[0]); init(); glutDisplayFunc(display); glutReshapeFunc(reshape); glutMainLoop(); return EXIT_SUCCESS; }



LinkBack URL
About LinkBacks


