void initGL(int argc, char **argv) { int i; glutInit(&argc,argv); glutInitDisplayMode(GLUT_RGBA|GLUT_DEPTH|GLUT_DOUBLE); glutInitWindowSize(768,768); glutInitWindowPosition(100,50); glutCreateWindow("my_cool_cube"); setup_the_viewvol(); do_lights(); glClearColor(0.45,0.45,0.45,1.0); glewInit(); glBindBuffer(GL_ARRAY_BUFFER,OGL_VBO); glBufferData(GL_ARRAY_BUFFER,VCOUNT*3*2*sizeof(float),vertices,GL_DYNAMIC_DRAW); glVertexPointer(3,GL_FLOAT,3*sizeof(GLfloat),(GLfloat *)0); glColorPointer(3,GL_FLOAT,3*sizeof(GLfloat),(GLfloat *)(VCOUNT*3*sizeof(GLfloat))); for(i=0;i<LENGTH-1;i++){ first[i] = 2*WIDTH*i; count[i] = 2*WIDTH; } glNewList(BLOCKLIST,GL_COMPILE); do_material_block(); block_geometry(); glEndList(); }
void InitGL(int argc, char** argv) { glutInit(&argc,argv); glutInitDisplayMode(GLUT_RGBA|GLUT_DEPTH|GLUT_DOUBLE); glutInitWindowSize(WINDOW_HEIGHT, WINDOW_WIDTH); glutInitWindowPosition(100,50); glutCreateWindow("my particle system"); setup_the_viewvol(); glPointSize(1.0); glLineWidth(3.0); glClearColor(0.0,0.0,0.0,1.0); glewInit(); return; }
void initOGL(int argc, char **argv) { glutInit(&argc,argv); glutInitDisplayMode(GLUT_RGBA|GLUT_DEPTH|GLUT_DOUBLE); glutInitWindowSize(512,512); glutInitWindowPosition(100,50); glutCreateWindow("my_cool_cube"); setup_the_viewvol(); do_lights(); do_material(); glBindBuffer(GL_ARRAY_BUFFER,mybuf); glBufferData(GL_ARRAY_BUFFER,sizeof(vertices),vertices,GL_STATIC_DRAW); // When using VBOs, the final arg is a byte offset in buffer, not the address, // but gl<whatever>Pointer still expects an address type, hence the NULL. glVertexPointer(3,GL_FLOAT,3*sizeof(GLfloat),NULL+0); glNormalPointer(GL_FLOAT,3*sizeof(GLfloat),NULL+3*24*sizeof(GLfloat)); glEnableClientState(GL_VERTEX_ARRAY); glEnableClientState(GL_NORMAL_ARRAY); /* gray background */ glClearColor(0.35,0.35,0.35,0.0); }