我无法对 glu Quadric (gluSphere) 进行纹理处理:我得到的不是纹理,而是纹理的平均颜色。
gl.glEnable(GL.GL_DEPTH_TEST);
gl.glEnable(GL.GL_BLEND);
gl.glEnable(GL.GL_TEXTURE_GEN_S);
gl.glEnable(GL.GL_TEXTURE_GEN_T);
sunTexture = TextureIO.newTexture(new File("sun.jpg"),false);
float[] rgba = {1f, 1f, 1f};
gl.glMaterialfv(GL.GL_FRONT, GL.GL_AMBIENT, rgba, 0);
gl.glMaterialfv(GL.GL_FRONT, GL.GL_SPECULAR, rgba, 0);
gl.glMaterialf(GL.GL_FRONT, GL.GL_SHININESS, 0.5f);
sunTexture.enable();
sunTexture.bind();
GLUquadric sun = glu.gluNewQuadric();
glu.gluQuadricTexture(sun, true);
glu.gluSphere(sun, 5, DETAIL, DETAIL);
sunTexture.disable();