English 中文(简体)
在撰写《开放式GL》时处理全球变量
原标题:Handling global variables when writing OpenGL with glut(or freeglut)

正在学习<条码>OpenGL,<条码>。 问题是,当方案增长时,要处理的是<代码>全球变量。 许多人说,在该方案中使用太多的<代码>全球变量<>/代码”是一种非标准。 然而,我可以通过将用户定义参数纳入冰川确定的背靠功能来取代<代码>全球变量。 例如:

void display (void)
{
   // How to pass user defined parameters here?
   // some more code
}
int
main(void)
{
    glutDisplayFunc(display);
    // some more code
}

因此,我的问题是:

  1. How to handle the global variables when writing OpenGL with glut?
  2. Is there any other ways to substitute the global variables instead of passing the parameters to functions
  3. How does other libs(not glut) handling the input/output of OpenGL deal with global variables?
最佳回答

“无全球变量”的规则不完整。 实际措辞是“在职能之间传递参数的全球变量”。 然而,全球变量被罚款以维持全球方案的广泛状态。

• 如何在用冰川书写开放式GL时处理全球变量?

如果你重新管理的国家是方案状态,那么全球实际上就是罚款的。 可通过<条码>glutGet检索温得依国家。 Don tabe, that OpenGL本身是一家大型的全球国家机器。 一种全球开放式GL环境的渗透和变化实际上改变了全球变量。

承诺将政府对与生产相关的物品使用全球定位定位定位定位器,即不会在重塑中设定观察和预测。 是否具备显示功能。

是否有其他办法替代全球变量,而不是将参数用于功能

有一些办法,如利用<><>><>>>>><>>>>图书馆,将“平坦”功能变为封闭功能,由你转至LUT。

如何处理开放式GL的投入/产出的其他平衡(而不是冰川)如何处理全球变量?

要么允许将数据参数传送到反馈功能上(GLUT的大型设计故障,不允许这样做),要么使用电文/信号系统,而不是靠背。

问题回答

暂无回答




相关问题
OpenGL 3D Selection

I am trying to create a 3D robot that should perform certain actions when certain body parts are clicked. I have successfully (sort of) implemented picking in that if you click on any x-plane part, it ...

CVDisplayLink instead of NSTimer

I have started to implement cvDisplayLink to drive the render loop instead of nstimer, as detailed in this technical note https://developer.apple.com/library/archive/qa/qa1385/_index.html Is it ...

Can the iPhone simulator handle PVR textures?

I have a really weird problem with PVR textures on the iPhone simulator- the framerate falls through the floor on the iPhone simulator, but on the iPhone itself it works just fine. Has anyone had any ...

Calculate fps (frames per second) for iphone app

I am using an opengl es iphone application. What is the most accurate way to calculate the frames per second of my application for performance tuning?

Java - Zoom / 3D Data Visualization Libraries

What are the best libraries/frameworks for doing 3D and/or Zoom interfaces in Java? I d like to be able to do some prototyping of creating new types of interfaces for navigating within data and ...

FLTK in Cygwin using Eclipse (Linking errors)

I have this assignment due that requires the usage of FLTK. The code is given to us and it should compile straight off of the bat, but I am having linking errors and do not know which other libraries ...

热门标签