OpenGL画一个圆

作者:追风剑情 发布于:2019-6-2 9:56 分类:OpenGL

一、首先确保已经通过NuGet安装了nupengl

二、解决方案平台设置为x64

111.png

因为在x86下要报错,未找到原因

222.png

三、写示例代码


#include <GL/freeglut.h>
//运行发布出来的exe时,不再显示dos窗口,但在VS中运行还是会显示。
#pragma comment(linker, "/subsystem:\"windows\" /entry:\"mainCRTStartup\"")

void init()
{
	glClearColor(0.0, 0.0, 0.0, 0.0);
}

void display()
{
	glClear(GL_COLOR_BUFFER_BIT);
	glColor3f(1.0, 0.0, 0.0);
	glutSolidSphere(0.5, 50, 6);
	glFlush();
}


int main(int argc, char ** argv)
{
	glutInit(&argc, argv);
	glutInitDisplayMode(GLUT_SINGLE | GLUT_RGBA);
	glutInitWindowSize(200, 200);
	glutInitWindowPosition(0, 0);
	glutCreateWindow("第一个窗口");
	init();
	glutDisplayFunc(display);
	glutMainLoop();
	return 0;
}


四、运行

111.png

标签: OpenGL

Powered by emlog  蜀ICP备18021003号-1   sitemap

川公网安备 51019002001593号