http://www.glprogramming.com/red/chapter10.html
http://duriansoftware.com/joe/An-intro-to-modern-OpenGL.-Chapter-2.1:-Buffers-and-Textures.html#include <stdio.h>
#include <GLUT/GLUT.h>
void display(void){
//set an rgba color.
glClearColor(1.0f, 1.0f, 1.0f, 1.0f);
//use the rgba color to fill the framebuffer's color buffer.
glClear(GL_COLOR_BUFFER_BIT |GL_STENCIL_BITS|GL_ACCUM_BUFFER_BIT);
//supply OpenGL with our data
glBegin(GL_TRIANGLE_STRIP);
glColor3b(100, 0, 0);
glVertex3d(0.0, 0.0, -1.0);
glColor3b(1, 100, 0);
glVertex3d(1.0, 1.0, -1.0);
glColor3b(1, 0, 100);
glVertex3d(-1.0, 1.0, -1.0);
glEnd();
glutSwapBuffers();
}
int main(int argc, char * argv[])
{
glutInit(&argc, argv);
//(Double buffering provides two color buffers to the framebuffer, alternating which buffer is displayed onscreen and which buffer is drawn into every frame so that animation appears smooth.)
glutInitDisplayMode(GLUT_RGBA | GLUT_DOUBLE);
glutInitWindowSize(400, 400);
glutCreateWindow("vertexArrayExample");
glutDisplayFunc(&display);
int bits = 0;
glGetIntegerv(GL_RED_BITS, &bits);
printf("GL_RED_BITS is %d.\n",bits);
glGetIntegerv(GL_GREEN_BITS, &bits);
printf("GL_GREEN_BITS is %d.\n",bits);
glGetIntegerv(GL_BLUE_BITS, &bits);
printf("GL_BLUE_BITS is %d.\n",bits);
glGetIntegerv(GL_ALPHA_BITS, &bits);
printf("GL_ALPHA_BITS is %d.\n",bits);
glGetIntegerv(GL_INDEX_BITS, &bits);
printf("GL_INDEX_BITS is %d.\n",bits);
glGetIntegerv(GL_DEPTH_BITS, &bits);
printf("GL_DEPTH_BITS is %d.\n",bits);
glGetIntegerv(GL_STENCIL_BITS, &bits);
printf("GL_STENCIL_BITS is %d.\n",bits);
glGetIntegerv(GL_ACCUM_RED_BITS, &bits);
printf("GL_ACCUM_RED_BITS is %d.\n",bits);
glGetIntegerv(GL_ACCUM_GREEN_BITS, &bits);
printf("GL_ACCUM_GREEN_BITS is %d.\n",bits);
glGetIntegerv(GL_ACCUM_BLUE_BITS, &bits);
printf("GL_ACCUM_BLUE_BITS is %d.\n",bits);
glGetIntegerv(GL_ACCUM_ALPHA_BITS, &bits);
printf("GL_ACCUM_ALPHA_BITS is %d.\n",bits);
glutMainLoop();
return 0;
}