I had not implemented elevation yet but just flat texture at this time. I calculates 32-bit vertices from origin (0, 0, 0) in normalized or planet-sized coordinate system for spherical vertices with 16-bit indices and 32-bit texture coordinates. It uses GL_TRIANGLES with CCW winding orders. Both coordinates resulted same (locally shaky/distorted).
I am using glEnable(GL_DEPTH_TEST) and glDepthFunc(GL_LEQUAL).
I am using GL_LINEAR for texture mapping.
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
Here are my shader programs to rendering planet textures. Here is vertex program.
#version 420
// vertex buffer objects
layout (location=0) in vec3 vPosition;
layout (location=1) in vec3 vNormal;
//layout (location=2) in vec3 vColor;
layout (location=2) in vec2 vTexCoord;
uniform mat4 mvp;
out vec4 myColor;
out vec2 texCoord;
void main()
{
gl_Position = mvp * vec4(vPosition, 1.0);
myColor = vec4(0.7, 0.7, 0.7, 1.0); // vec4(vColor, 1.0);
texCoord = vTexCoord;
}
Here is fragment program.
#version 420
// #extension GL_ARB_shading_language_420pack: enable Use for GLSL versions before 420.
layout (binding=0) uniform sampler2D sTexture;
in vec2 texCoord;
in vec4 myColor;
out vec4 fragColor;
void main()
{
fragColor = texture(sTexture, texCoord);
// fragColor = myColor;
}