码迷,mamicode.com
首页 > 其他好文 > 详细

绘制矩形

时间:2015-03-28 18:35:38      阅读:145      评论:0      收藏:0      [点我收藏+]

标签:

简单的opengl程序入门:

技术分享
#include"gl/glut.h"
void initial(void)
{
    glClearColor(1.0f,1.0f,1.0f,1.0f);
    glMatrixMode(GL_PROJECTION);
    gluOrtho2D(0.0,200.0,0.0,150.0);
}

void Display(void)
{
    glClear(GL_COLOR_BUFFER_BIT);
    glColor3f(1.0f,0.0f,0.0f);
    glRectf(50.0f,100.0f,150.0f,50.0f);
    glFlush();
}
int main(int argc,char *argv[])
{
    glutInit(&argc,argv);
    glutInitDisplayMode(GLUT_SINGLE|GLUT_RGB);
    glutInitWindowSize(400,300);
    glutInitWindowPosition(100,120);
    glutCreateWindow("╬ьпн");
    glutDisplayFunc(Display);
    initial();
    glutMainLoop();
    return 0;
}
View Code

 

绘制矩形

标签:

原文地址:http://www.cnblogs.com/acm-jing/p/4374521.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!