LIBGDX 3D:在着色器上关闭纹理:OpenGL

对不起,如果问题是有点利基。 几年前我写了一些代码,它将许多网格渲染为一个大网格来表现。

我现在想做的只是渲染没有纹理的网格,所以只有一个颜色

boxModel = modelBuilder.createBox(10f, 10f, 10f, Material(ColorAttribute.createDiffuse(Color.WHITE), ColorAttribute.createSpecular(Color.RED), FloatAttribute.createShininess(15f)), (VertexAttributes.Usage.Position or VertexAttributes.Usage.Normal or VertexAttributes.Usage.TextureCoordinates).toLong()) // or VertexAttributes.Usage.TextureCoordinates for (x in 1..10) { for (y in 1..10) { modelInstance = ModelInstance(boxModel, x * 15f, 0.0f, y * 15f) chunks2[0].addMesh(modelInstance.model.meshes, modelInstance.transform, btBoxShape(Vector3(10f, 10f, 10f))) } } chunks2[0].mergeBaby() 

所以我建立了巨大的网格,然后渲染它

 shaderProgram.begin() texture.bind() shaderProgram.setUniformMatrix("u_projTrans", camera.combined) shaderProgram.setAttributef("a_color", 1f, 1f, 1f, 1f) shaderProgram.setUniformi("u_texture", 0) renderChunks() shaderProgram.end() 

这适用于纹理的东西很好,正确的纹理显示等,但基本的颜色(我猜这是“a_color”设置为白色),我真的希望它使用我在材料属性中提供的。