[英]Set a texture to a Solid Sphere with glut
我正在尝试将纹理加载到由glutSolidSphere使用soil.lib创建的球体中
这就是我正在尝试的:
GLuint texture[1];
/* load an image file directly as a new OpenGL texture */
texture[0] = SOIL_load_OGL_texture("Terra.bmp", SOIL_LOAD_AUTO, SOIL_CREATE_NEW_ID, SOIL_FLAG_INVERT_Y);
printf("%d ", texture[0]);
if (texture[0] == 0) {
printf("Error loading texture \n");
return 0;
}
// Typical Texture Generation Using Data From The Bitmap
glBindTexture(GL_TEXTURE_2D, texture[0]);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glBindTexture(GL_TEXTURE_2D, texture[0]);
glutSolidSphere(20, 20, 20);
我认为我正在失去某些东西,但是我什么也没有。
谢谢。
glutSolidSphere没有纹理坐标,将gluSphere()与gluQuadricTexture结合使用。 还有一个选项可以生成球体并通过三角形/四边形对其进行纹理处理。 例如,例如: http : //www.codeincodeblock.com/2011/06/texture-map-in-solid-sphere-using.html
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.