栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > C/C++/C#

OpenGL: Visual Studio

C/C++/C# 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

OpenGL: Visual Studio

PART ONE

step1: Install the IDE Microsoft Visual Studio by the "Visual Studio installer". Ensure that your IDE had already downloaded the "使用C++的桌面开发" components .

step2:  Run your IDE and click the “创建新项目(N)”.

step3:  Click the “控制台应用”, than "下一步(N)" .

 step4: Input a name in "ConsoleApplication", here is "OpenGL" . Than click the "创建(C)".

 step5: Right-Click the "OpenGL",  than Left_Click the "管理NuGet程序包(N)" . Make sure that "浏览" is choosed. Input "nupengl' in "搜索(Ctrl+L) ", than click the "安装" button with your Computer is working ONLINE.

step6: Cloose the "NuGet: OpenGL" and "输出".

 step7: Delete the codes in "OpenGL.cpp" and copy&paste codes showing in PART TWO,  Click the "本地Windows调试器" to run the pasted codes in "OpenGL.cpp".


PART TWO

 codes.cpp

#include 
#include 
using namespace std;

int main(int argc, char** argv)
{
	cout << argc << "n" << *argv << endl;
	glutInit(&argc, argv);
	glutCreateWindow(*argv);
	glutMainLoop();

	return 0;
}

PART THREE

代码分析

1、在Visual Studio中安装glut窗口库,因为OpenGL库的头文件gl.h、glu.h包含在glut库中,故在#include 基础上添加#include 完成glut库和OpenGL的调用。

2、在main()中,glutInit()完成对glut库的初始化。glutCreateWindow()根据主函数传入的*argv,在GPU端启用屏幕缓冲区,获得对显存的使用权。屏幕缓冲区具体使用方法,见Default Framebuffer。

注:NuGet程序包中,也可以单独安装glew、glfw等。

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/849326.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号