如何更改OpenGL源代码文件? [英] How can I change an OpenGL source code file?

查看:118
本文介绍了如何更改OpenGL源代码文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个名为wglew.h的OpenGL文件,该文件是从 http://glew.sourceforge.net/<下载的/a>.下载时使用wglew.h,在编译自己拥有的程序时(我正在使用MacOSX)时收到以下错误:

I have an OpenGL file called wglew.h which I downloaded from http://glew.sourceforge.net/. Using the wglew.h as I downloaded it, I receive the following error when compiling a program that I have (I am using MacOSX):

/Users/Downloads/glew-1.11.0/include/GL/wglew.h:70:10: fatal error:'windows.h' file not found

我正在尝试返回该文件的源代码,并将其依赖项从windows.h更改为Mac可以识别的东西. wglew.h文件中的源代码片段为:

I am trying to go back into the source code of that file and change its dependency from windows.h to something that my Mac could recognize. The source code snippet in the wglew.h file is:

#if !defined(WINAPI)
#  ifndef WIN32_LEAN_AND_MEAN
#    define WIN32_LEAN_AND_MEAN 1
#  endif
#include <windows.h>
#  undef WIN32_LEAN_AND_MEAN
#endif

是否可以解决这个windows.h依赖性,以便我的程序在此步骤中不会出错?我在以下地方问了关于并行概念的类似但不相同的问题:在哪里我可以在Mac上获得Windows.h吗?也许不用寻找等效的Windows.h文件(如果Mac上存在该文件),我可以尝试设计一种更细微的方法来更改wglew中的源代码.h文件以使我的程序正常工作并适应我遇到的Windows依赖关系?

Is it possible to work around this windows.h dependency so that my program does not error out at this step? I asked a similar, but not identical question about a parallel concept at: Where can I get windows.h for Mac? Perhaps instead of looking for an equivalent windows.h file (if such exists for the Mac), I can try to devise a more subtle approach of changing the source code within the wglew.h file to get my program to work and accommodate the windows dependency that I am experiencing?

推荐答案

在这里我们再次进行: GLEW不是OpenGL的一部分.这是第三方图书馆.

Here we go again: GLEW is not part of OpenGL. It's a third party library.

在MacOS X上不需要GLEW!

您正在吠错一棵树!

无需尝试修复GLEW(无需修复).只需修复您的程序,使其在为MacOS X编译时就不使用GLEW.

Instead of trying to fix GLEW (which you don't have to). Just fix your program to not use GLEW when being compiled for MacOS X.

程序中随处可见的

#include <glew.h>

#include <GL/glew.h>

将其更改为

#ifndef __APPLE__
#include <GL/glew.h>
#else
#include <OpenGL/gl.h>
#endif/*__APPLE__*/

将任何在其中调用GLEW函数的事件放在

Put any occurance where a GLEW function is called between a

#ifndef __APPLE__
…
#endif/*__APPLE__*/

也要阻止.

在MacOS X上不需要GLEW!请勿在其中使用它.

这篇关于如何更改OpenGL源代码文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆