Vertex shaders can write to gl_PointSize (fixes #1603).

If a shader uses gl_PointSize then it can only be used when drawing points. If a shader doesn't use gl_PointSize then it can't be used when drawing points.

Added 'ConstantPointSize' and 'CurrentDPIScale' built-in shader uniforms.

ConstantPointSize is in DPI-scaled points, whereas gl_PointSize is in pixels, so to get the correct default behaviour a shader needs to do gl_PointSize = ConstantPointSize * CurrentDPIScale
This commit is contained in:
Alex Szpakowski
2021-01-23 13:47:12 -04:00
parent deff795908
commit 694d448e83
13 changed files with 83 additions and 87 deletions
+2 -2
View File
@@ -1037,8 +1037,8 @@ void ParticleSystem::draw(Graphics *gfx, const Matrix4 &m)
if (Shader::isDefaultActive())
Shader::attachDefault(Shader::STANDARD_DEFAULT);
if (Shader::current && texture.get())
Shader::current->checkMainTexture(texture);
if (Shader::current)
Shader::current->validateDrawState(PRIMITIVE_TRIANGLES, texture);
const Vector2 *positions = texture->getQuad()->getVertexPositions();
const Vector2 *texcoords = texture->getQuad()->getVertexTexCoords();