OpenGL: add support for programmable point size

And enable point sprites always. Fragment shaders can use gl_PointCoord now.
This commit is contained in:
2016-09-30 19:51:04 -04:00
parent 82648a8f91
commit d1b21d1278
2 changed files with 36 additions and 3 deletions

View File

@@ -59,6 +59,13 @@ struct DupliObject;
void GPU_state_init(void);
/* Programmable point size
* - shaders set their own point size when enabled
* - use glPointSize when disabled */
void GPU_enable_program_point_size(void);
void GPU_disable_program_point_size(void);
/* Material drawing
* - first the state is initialized by a particular object and
* it's materials

View File

@@ -2247,7 +2247,13 @@ void GPU_state_init(void)
glColorMaterial(GL_FRONT_AND_BACK, GL_DIFFUSE);
GPU_default_lights();
GPU_disable_program_point_size();
#ifdef __APPLE__
/* TODO: remove this when we switch to core profile */
glEnable(GL_POINT_SPRITE);
#endif
glDepthFunc(GL_LEQUAL);
/* scaling matrices */
glEnable(GL_NORMALIZE);
@@ -2269,7 +2275,7 @@ void GPU_state_init(void)
glDisableClientState(GL_NORMAL_ARRAY);
glDisableClientState(GL_COLOR_ARRAY);
glDisableClientState(GL_TEXTURE_COORD_ARRAY);
glPixelTransferi(GL_MAP_COLOR, GL_FALSE);
glPixelTransferi(GL_RED_SCALE, 1);
glPixelTransferi(GL_RED_BIAS, 0);
@@ -2279,7 +2285,7 @@ void GPU_state_init(void)
glPixelTransferi(GL_BLUE_BIAS, 0);
glPixelTransferi(GL_ALPHA_SCALE, 1);
glPixelTransferi(GL_ALPHA_BIAS, 0);
glPixelTransferi(GL_DEPTH_BIAS, 0);
glPixelTransferi(GL_DEPTH_SCALE, 1);
glDepthRange(0.0, 1.0);
@@ -2297,6 +2303,26 @@ void GPU_state_init(void)
GPU_basic_shader_bind(GPU_SHADER_USE_COLOR);
}
void GPU_enable_program_point_size()
{
#ifdef __APPLE__
/* TODO: remove this when we switch to core profile */
glEnable(GL_VERTEX_PROGRAM_POINT_SIZE);
#else
glEnable(GL_PROGRAM_POINT_SIZE);
#endif
}
void GPU_disable_program_point_size()
{
#ifdef __APPLE__
/* TODO: remove this when we switch to core profile */
glDisable(GL_VERTEX_PROGRAM_POINT_SIZE);
#else
glDisable(GL_PROGRAM_POINT_SIZE);
#endif
}
#ifdef WITH_OPENSUBDIV
/* Update face-varying variables offset which might be
* different from mesh to mesh sharing the same material.