Port starfield to static shaders

pull/3/head
Hleb Valoshka 2019-06-20 21:14:48 +03:00
parent 9745b125f3
commit e9ef0f7e57
3 changed files with 20 additions and 6 deletions

View File

@ -0,0 +1,8 @@
#version 120
uniform sampler2D starTex;
varying vec4 color;
void main(void)
{
gl_FragColor = texture2D(starTex, gl_PointCoord) * color;
}

View File

@ -0,0 +1,10 @@
#version 120
attribute float pointSize;
varying vec4 color;
void main(void)
{
gl_PointSize = pointSize;
color = gl_Color;
gl_Position = ftransform();
}

View File

@ -320,16 +320,12 @@ PointStarVertexBuffer::~PointStarVertexBuffer()
void PointStarVertexBuffer::startSprites()
{
ShaderProperties shadprop;
shadprop.staticShader = true;
shadprop.texUsage = ShaderProperties::PointSprite |
ShaderProperties::NormalTexture;
CelestiaGLProgram* prog = renderer.getShaderManager().getShader(shadprop);
CelestiaGLProgram* prog = renderer.getShaderManager().getShader("star");
if (prog == nullptr)
return;
prog->use();
prog->pointScale = 1.0f;
prog->samplerParam("starTex") = 0;
unsigned int stride = sizeof(StarVertex);
glEnableClientState(GL_VERTEX_ARRAY);