OpenGL学习笔记1

一、环境配置

win8+vs2012+freeflut+glew

按照下面这篇文章来配置

http://blog.csdn.net/panzhenjie/article/details/18879559


测试

新建控制台程序




#include<Windows.h>
#include<gl\glut.h>
#pragma comment(linker, "/subsystem:\"windows\" /entry:\"mainCRTStartup\"")
void display()
{
glColor3f(1.0,1.0,1.0);
glBegin(GL_POLYGON);
glVertex3f(0.25,0.25,0);
glVertex3f(0.75,0.25,0);
glVertex3f(0.75,0.75,0);
glVertex3f(0.25,0.75,0);
glEnd();
glFlush();
}
int main(int argc, char** argv)
{
 glutInit(&argc,argv);
 glutInitDisplayMode(GLUT_SINGLE|GLUT_RGB);//指定显示模式
 glutInitWindowSize(800,640);//指定窗口大小
 glutInitWindowPosition(200,0);//指定窗口左上角位置
 glutCreateWindow("OpenGL程序");//创建窗口标题为OpenGL的窗口
 glutDisplayFunc(display);//回调函数,场景重绘的函数在此注册
 glutMainLoop();
 return 0;
}



项目属性-》链接器》系统-》子系统设置为未设置 

#pragma comment(linker, "/subsystem:\"windows\" /entry:\"mainCRTStartup\"")

加上这句就可以隐藏cmd窗口了

你可能感兴趣的:(OpenGL学习笔记1)