http://www.glprogramming.com/red/chapter10.html

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;
}


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值