我是靠谱客的博主 狂野唇彩,这篇文章主要介绍一. glutInit(argc, argv); glut初始化APIopengl论坛给出的解释: ,现在分享给大家,希望可以做个参考。

opengl_driver.h文件中:

kernel.cu文件中:

 glutInit(int *argc, char **argv);

这个函数用来初始化 GLUT 库.这个函数从 main 函数获取其两个参数.对应main 函数的形式应是:int main(int argc,char* argv[]);

在这个部分我们将在我们的程序里建立一个main函数,这个main函数将完成必须的初始化和开启事件处理循环。所有的GLUT函数都有glut前缀并且那些完成一些初始化的函数有glutInit前缀。你首先要做的是调用函数glutInit()。

Void glutInit(int*argc,char**argv);

参数:

Argc:一个指针,指向从main()函数传递过来的没更改的argc变量。

Argv:一个指针,指向从main()函数传递过来的没更改的argv变量。

opengl论坛给出的解释:

 

Re: What are argcp and argv in Glutinit function?

argv is a pointer to an array of nullterminated strings, and argc says how large this array is.

Ther are automatucally passed to you when you start you program and enter main(). argv[0] is a pointer to a string which holds the name of the executable file, including full path. argv[1] is the first argument you pass to you program when starting it, and so on.

Like this:

c:test.exe hello world

Then argc=3
argv[0]="c:test.exe"
argv[1]="hello"
argv[2]="world"

最后

以上就是狂野唇彩最近收集整理的关于一. glutInit(argc, argv); glut初始化APIopengl论坛给出的解释: 的全部内容,更多相关一.内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(91)

评论列表共有 0 条评论

立即
投稿
返回
顶部