如何在OpenGL中构造glutSolidTorus的纹理? [英] How to texture of a glutSolidTorus in OpenGL?
问题描述
我正在尝试纹理glutSolidTorus()
.
这是我的代码:
glColor3f(1.0f, 1.0f, 1.0f);
glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D, tiring);
glutSolidTorus(.55, 1.8, 25, 25);
glDisable(GL_TEXTURE_2D);
但是它不起作用.如何纹理glutSolidTorus()
?
But it does not work. How can I texture glutSolidTorus()
?
推荐答案
除了 11个几何对象渲染
GLUT包含许多用于生成易于识别的3D几何对象的例程.这些例程反映了《 OpenGL程序员指南》中所述的aux工具包中可用的功能,并且包含在GLUT中,以允许构造呈现可识别对象的简单GLUT程序.这些例程可以实现为纯OpenGL渲染例程.例程不会为其创建的对象生成显示列表. GLUT includes a number of routines for generating easily recognizable 3D geometric objects. These routines reflect functionality available in the aux toolkit described in the OpenGL Programmer's Guide and are included in GLUT to allow the construction of simple GLUT programs that render recognizable objects. These routines can be implemented as pure OpenGL rendering routines. The routines do not generate display lists for the objects they create. 例程会生成适合照明的法线,但不会生成纹理坐标(茶壶除外). The routines generate normals appropriate for lighting but do not generate texture coordinates (except for the teapot). 您有几种选择: 这篇关于如何在OpenGL中构造glutSolidTorus的纹理?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!glut*Teapot()
glutSolidTorus()
添加纹理坐标
glutSolidTorus()
to add texture coordinates