   one Color Per Face
  How Can I Change the following Code so that i can specify one color for each face, the problem with the following code is that each vertex has a color.static GLfloat corners[] = { -25.0f, 25.0f, 25.0f, // 0 // Front of cube 25.0f, 25.0f, 25.0f, // 1 25.0f, -25.0f, 25.0f,// 2 -25.0f, -25.0f, 25.0f,// 3-25.0f, 25.0f, -25.0f,// 4 // Back of cube 25.0f, 25.0f, -25.0f,// 5 25.0f, -25.0f, -25.0f,// 6  -25.0f, -25.0f, -25.0f };// 7static GLfloat colors[] = {  1.0f, 0.0f, 0.0f, // 0 // Front of cube1.0f, 1.0f, 0.0f, // 10.0f, 1.0f, 1.0f, // 20.0f, 1.0f, 0.0f,// 30.0f, 1.0f, 0.5f,// 4 // Back of cube0.0f, 0.5f, 1.0f,// 50.0f, 0.5f, 0.5f,// 6    0.0f, 0.0f, 1.0f };// 7// Array of indexes to create the cubestatic GLubyte indexes[] = { 0, 1, 2, 3, // Front Face4, 5, 1, 0, // Top Face3, 2, 6, 7, // Bottom Face   5, 4, 7, 6, // Back Face   1, 5, 6, 2, // Right Face4, 0, 3, 7 }; // Left Facevoid Init(){glEnableClientState(GL_VERTEX_ARRAY);glEnableClientState(GL_COLOR_ARRAY);glColorPointer(3,GL_FLOAT,0,colors);glVertexPointer(3, GL_FLOAT, 0, corners);}void paintGL(){glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );glLoadIdentity();// Camera Code Camera.Look();glDrawElements(GL_QUADS, 24, GL_UNSIGNED_BYTE, indexes);}Thanks for healp.   
  Doing it the way you are, you'll need 4 unique verts per quad.4 for the top, and 4 colors (all the same) for the top color4 for the bottom with 4 colors for the bottom, etc...So 24 verts and colors.Same amount of indices, but the numbers need to change for the new verts.   ;  This is too much repeating of data, is there better way of doing this ?i want for each face: 4 indices 1 coloris this available in OpenGL ?   ;  No, one index for all the attributes (Position, color, normals, etc).   ;  It is available.The way I know how to do it is old school though, not using glDrawElements.glBeing(GL_QUADS)for each faceglColor3f(facecolor)glVertex3f(vert1)..glVertex3f(vert4)glEnd()It might be possible to do it with draw elements and indices, I'm not overly familiar with gl anymore, sorry.This should at least get you going.   ;  You really shouldn't be concerned with the amount of repeated data, since hardware these days allows for gigabytes of memory and tens of thousands of triangles all rendered real-time with complex graphical operations performed on those triangles.   ;  I agree just duplicate the data, it isn't that much.   ; The gfx hardware can only render at those speeds if the CPU isn't constantly telling to what to draw via glVertex calls. VBOs are the only real way to go about taking advantage of all that speed in an applicable way. But in the case of a small project where squeezing the most frames per second out of the main loop isn't an issue, just use the old fixed function calls. :)   ;Quote:Original post by RabidDogIt is available.The way I know how to do it is old school though, not using glDrawElements.No, that's going to kill performance. Consider it not available :);Quote:Original post by HuntsManNo, that's going to kill performance. Consider it not available :)Yes, yes it will, I should have mentioned that, but if you really really need to do it ;)   