简体   繁体   English

使用GL_QUADS在侧面立方体上进行OpenGL纹理映射

[英]OpenGL texture mapping on sides cube using GL_QUADS

I am trying to map a different texture on each side of a cube using a GL_QUADS. 我正在尝试使用GL_QUADS在立方体的每一侧上映射不同的纹理。 My first problem is that I cannot even get a texture to display on the side of a GL_QUADS. 我的第一个问题是,我什至无法在GL_QUADS的侧面上显示纹理。 I can however get a texture to display using GL_TRIANGLES but I do no understand how to draw things very well using triangles and I want to use QUADS. 但是我可以使用GL_TRIANGLES来显示纹理,但是我不知道如何使用三角形很好地绘制东西,我想使用QUADS。 I also can only use GLUT for this. 我也只能为此使用GLUT。 I need an example that works because I do not know enough about OpenGL for someone to simply explain this to me. 我需要一个有效的示例,因为我对OpenGL的了解不足,无法有人简单地向我解释这一点。 Someone please help. 有人请帮忙。 Thanks! 谢谢!

Oops didn't realize I forgot to use glTexCoord2f. 糟糕,我没意识到我忘记使用glTexCoord2f。 It works now. 现在可以使用了。

If you post the code that you are having trouble with, perhaps I can help you. 如果您发布遇到问题的代码,也许我可以为您提供帮助。 Most likely, you need to set the appropriate texture coordinates per-vertex. 最有可能的是,您需要为每个顶点设置适当的纹理坐标。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM