欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

vs配置opengl

程序员文章站 2022-06-16 19:58:12
新建项目nuget下载安装nupengl.core测试代码#includevoid init(void){glClearColor(1.0, 1.0, 1.0, 0.0);glMatrixMode(GL_PROJECTION);gluOrtho2D(0.0, 200.0, 0.0, 150.0);}void lineSegement(void){glClear(GL_COLOR_BUFFER_BIT);glColor3f(0.0,....
  1. 新建项目
  2. nuget下载安装nupengl.core
  3. 测试代码
#include<GL/glut.h>

void init(void)
{
	glClearColor(1.0, 1.0, 1.0, 0.0);
	glMatrixMode(GL_PROJECTION);
	gluOrtho2D(0.0, 200.0, 0.0, 150.0);
}

void lineSegement(void)
{
	glClear(GL_COLOR_BUFFER_BIT);
	glColor3f(0.0, 0.4, 0.2);
	glBegin(GL_LINES);
	glVertex2i(180, 15);
	glVertex2i(10, 145);
	glEnd();
	glFlush();
}

void main(int argc, char**argv)
{
	glutInit(&argc, argv);
	glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB);
	glutInitWindowPosition(50, 100);
	glutInitWindowSize(400, 300);
	glutCreateWindow("An Example OpenGl Program");

	init();
	glutDisplayFunc(lineSegement);
	glutMainLoop();
}

本文地址:https://blog.csdn.net/qq_28510897/article/details/107290001