我如何才能使用 GLU_RGBA 或其他 GLU_ 参数?
嘿,我还有一个问题。涉及的信息不多,但我注意到,即使我链接了 libglu32.a,并且包含了 glu.h,我仍然无法使用 GLU_
参数,
我想知道为什么不是这样。有人有什么想法吗?
如果需要任何代码请评论,我会尽快回复。
另外,我的IDE是CodeBlocks,在Windows 32位上使用MinGW作为编译器。
hey i have yet another question. There isnt much information involved but i noticed that even though i have libglu32.a linked, and the glu.h included, im still not ablt to use GLU_
parameters
Im wondering how that is not so. would anyone have any ideas?
if any code is needed please comment and i will respond quickly.
Also, My IDE is CodeBlocks with MinGW as the compiler on windows 32 bit.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
glu 不是 OpenGL 的一部分。它是 OpenGL 的辅助库,但如果传递给纯 OpenGL 函数,来自 GLU 的标记就没有意义。或者用外行的话来说:如果您想使用以
GLU_...
开头的标记,则必须将其传递给前缀为glu...
的函数。glu is not part of OpenGL. It's an auxiliary library to OpenGL, but the tokens from GLU make no sense if passed to pure OpenGL functions. Or in layman's terms: If you want to use a token beginning with
GLU_...
you've to pass it to functions prefixedglu...
.看来您将 GLU 与 GLUT 混淆了。 没有 GLU_RGBA,但是有一个在创建显示窗口时传递的 GLUT_RGBA。
It appears that you're getting GLU confused with GLUT. There is no GLU_RGBA, but there is a GLUT_RGBA that's passed when creating the display window.
这与其说是答案,不如说是对代码的评论。我明白了,您正在使用 SFML 作为框架。 SFML 内部使用 OpenGL,并且 sf::Image 由 OpenGL 纹理支持。或者换句话说:您无需自己从
sf::Image
创建 OpenGL 纹理。实际上,SFML 会注意一切是否正确设置,以将图像用作 OpenGL 纹理。在您的代码中,您有这样的内容:
您根本不需要这个函数。您所要做的就是
image->Bind()
而不是LoadTexture(image)
,因为已经有纹理了。看一下sf::Image
的代码 http://www.sfml-dev.org/documentation/1.6/Image_8cpp-source.htmThis not so much an answer but a comment on your code. I see, that you're using SFML as framework. SFML internally uses OpenGL, and
sf::Image
is backed by an OpenGL texture. Or in other words: There's no need to create an OpenGL texture from asf::Image
on your own. Actually SFML takes care everything is properly set up for using an image as OpenGL texture.In your code you have this:
You don't need this function at all. All you've to do is
image->Bind()
instead ofLoadTexture(image)
, becase there is a texture already. Just take a look at the code ofsf::Image
http://www.sfml-dev.org/documentation/1.6/Image_8cpp-source.htm