/**************************
* Includes
*
**************************/
#include
#include "gl/gl.h"
#include "gl/glut.h"
#include "gl/glu.h"
void init(void)
{
glClearColor(1.0,1.0,1.0,0.0); //背景顏色:白
glMatrixMode(GL_PROJECTION); //投影模式
gluOrtho2D(0.0,100.0,0.0,150.0); //宣告視窗大小
}
void lineSegement(void)
{
glClear(GL_COLOR_BUFFER_BIT);//清除顯示視窗
glColor3f(0.1,0.0,0.3);
glBegin(GL_LINES);
glVertex2i(180,15);
glVertex2i(10,145);
glEnd();
glFlush();
}
int main(int argc,char**argv)
{
glutInit(&argc,argv);//初始GLUT
glutInitDisplayMode(GLUT_SINGLE|GLUT_RGB);//設定顯示模式
glutInitWindowPosition(50,100);
glutInitWindowSize(400,300);
glutCreateWindow("CJ OpenGL program 01");
init();
glutDisplayFunc(lineSegement);
glutMainLoop();
}
沒有留言:
張貼留言