简体   繁体   English

LWJGL中的纹理球

[英]Textured Sphere in LWJGL

I want to draw a GLU Sphere,which works, but now I dont know how I can texture it. 我想绘制一个可以工作的GLU Sphere,但现在我不知道如何对其进行纹理处理。 There is no point where a glTexCoord2f could go. glTexCoord2f毫无用处。

If you're using LWJGL, I don't think there is a way to do this that easily. 如果您使用的是LWJGL,我认为没有办法轻松地做到这一点。 On the windows documentation of gluSphere() it says: 在Windows文档gluSphere()上说:

If texturing is turned on (with gluQuadricTexture): texture coordinates are generated so that t ranges from 0.0 at z = -radius to 1.0 at z = radius (t increases linearly along longitudinal lines); 如果启用纹理化(使用gluQuadricTexture):生成纹理坐标,以使t的范围从z =-半径处的0.0到z =半径处的1.0(t沿纵向线线性增加); and s ranges from 0.0 at the positive y-axis, to 0.25 at the positive x-axis, to 0.5 at the negative y-axis, to 0.75 at the negative x-axis, and back to 1.0 at the positive y-axis. s的范围是在y轴的正方向上的0.0,在x轴的正方向上的0.25,在y轴的负方向上的0.5,在x轴的负方向上的0.75和在y轴的正方向上的1.0。

But gluQuadricTexture is not included in LWJGL (or at least I haven't found it). 但是gluQuadricTexture中不包含gluQuadricTexture(或者至少我没有找到它)。 You could try importing an obj sphere with UV coords, or make a custom Sphere class to generate UVs. 您可以尝试导入带有UV坐标的obj球,或制作一个自定义Sphere类以生成UV。

For those not using LWJGL, here's a nice little tutorial I found on texturing gluSphere : http://acidleaf.com/texture-mapping-the-glusphere/ 对于那些不使用LWJGL的用户,这是我在gluSphere纹理上找到的一个不错的小教程: http : gluSphere

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

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