mirror of
https://github.com/love2d/love.git
synced 2026-08-16 08:11:02 +02:00
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:
@@ -304,6 +304,9 @@ bool Graphics::setMode(int width, int height, int pixelwidth, int pixelheight, b
|
||||
glEnable(GL_TEXTURE_2D);
|
||||
}
|
||||
|
||||
if (!GLAD_ES_VERSION_2_0)
|
||||
glEnable(GL_VERTEX_PROGRAM_POINT_SIZE);
|
||||
|
||||
gl.setTextureUnit(0);
|
||||
|
||||
// Set pixel row alignment - code that calls glTexSubImage and glReadPixels
|
||||
@@ -1444,10 +1447,9 @@ void Graphics::setBlendState(const BlendState &blend)
|
||||
|
||||
void Graphics::setPointSize(float size)
|
||||
{
|
||||
if (batchedDrawState.primitiveMode == PRIMITIVE_POINTS)
|
||||
if (size != states.back().pointSize)
|
||||
flushBatchedDraws();
|
||||
|
||||
gl.setPointSize(size * getCurrentDPIScale());
|
||||
states.back().pointSize = size;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user