首页 > 代码库 > glTexGen
glTexGen
【glTexGen】
Rather than having to explicitly provide a texture coordinate for each vertex, we can use texture coordinate generation (texgen) functions to have OpenGL automatically compute texture coordinates.
This uses the function glTexGen, and the glEnable modes GL_TEXTURE_GEN_S & GL_TEXTURE_GEN_T.
planeCoefficients = [ 1, 0, 0, 0 ]glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR)glTexGenfv(GL_S, GL_OBJECT_PLANE, planeCoefficients)glEnable(GL_TEXTURE_GEN_S)glBegin(GL_QUADS)glVertex3f(-3.25, -1, 0)glVertex3f(-1.25, -1, 0)glVertex3f(-1.25, 1, 0)glVertex3f(-3.25, 1, 0)glEnd()
参考:http://resumbrae.com/ub/dms424_s05/10/print.html
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。