Fix point sso rendering on macOS

pull/792/head
Levin Li 2020-07-01 21:10:52 +08:00
parent 9e956abe3d
commit c8338ea91f
1 changed files with 7 additions and 1 deletions

View File

@ -1806,12 +1806,18 @@ void renderPoint(const Renderer &renderer,
glEnable(GL_POINT_SPRITE);
glEnable(GL_VERTEX_PROGRAM_POINT_SIZE);
#endif
glVertexAttrib3fv(CelestiaGLProgram::VertexCoordAttributeIndex, position.data());
// Workaround for macOS to pass a single vertex coord
glEnableVertexAttribArray(CelestiaGLProgram::VertexCoordAttributeIndex);
glVertexAttribPointer(CelestiaGLProgram::VertexCoordAttributeIndex,
3, GL_FLOAT, GL_FALSE, sizeof(position), position.data());
glVertexAttrib(CelestiaGLProgram::ColorAttributeIndex, color);
glVertexAttrib1f(CelestiaGLProgram::PointSizeAttributeIndex, useSprite ? size : 1.0f);
glDrawArrays(GL_POINTS, 0, 1);
glDisableVertexAttribArray(CelestiaGLProgram::VertexCoordAttributeIndex);
#ifndef GL_ES
if (useSprite)
glDisable(GL_VERTEX_PROGRAM_POINT_SIZE);