diff options
author | Luca Rood <dev@lucarood.com> | 2017-04-13 17:52:13 +0300 |
---|---|---|
committer | Luca Rood <dev@lucarood.com> | 2017-04-13 17:57:53 +0300 |
commit | 257e6c0c7df443b96a567270ce541a686104eead (patch) | |
tree | 4b1dd987d8664ee2477207913c7e3e171a1db2e2 /intern/opensubdiv | |
parent | 8458ffcf5b259595734d55f3cf560b9507a4d9ae (diff) |
Remove deprecated opengl stuff from opensubdiv
This removes glGetBooleanv queries for GL_LIGHTING. This has been #ifdef'd
out with legacy opengl disabled. Thus a false positive still shows up in
the gl queries. Also, note that this removes support for wireframes in
opensubdiv, when desabling legacy opengl, which should be fixed later.
Part of T49043
Diffstat (limited to 'intern/opensubdiv')
-rw-r--r-- | intern/opensubdiv/opensubdiv_gpu_capi.cc | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/intern/opensubdiv/opensubdiv_gpu_capi.cc b/intern/opensubdiv/opensubdiv_gpu_capi.cc index c36eaae1c6e..00592f2e87e 100644 --- a/intern/opensubdiv/opensubdiv_gpu_capi.cc +++ b/intern/opensubdiv/opensubdiv_gpu_capi.cc @@ -353,6 +353,7 @@ void bindProgram(OpenSubdiv_GLMesh *gl_mesh, int program) glBindBufferBase(GL_UNIFORM_BUFFER, 0, g_lighting_ub); /* Color */ +#ifdef WITH_LEGACY_OPENGL GLboolean use_lighting; glGetBooleanv(GL_LIGHTING, &use_lighting); @@ -372,6 +373,19 @@ void bindProgram(OpenSubdiv_GLMesh *gl_mesh, int program) glGetFloatv(GL_CURRENT_COLOR, color); glUniform4fv(glGetUniformLocation(program, "diffuse"), 1, color); } +#else + { + float color[4]; + glGetMaterialfv(GL_FRONT, GL_DIFFUSE, color); + glUniform4fv(glGetUniformLocation(program, "diffuse"), 1, color); + + glGetMaterialfv(GL_FRONT, GL_SPECULAR, color); + glUniform4fv(glGetUniformLocation(program, "specular"), 1, color); + + glGetMaterialfv(GL_FRONT, GL_SHININESS, color); + glUniform1f(glGetUniformLocation(program, "shininess"), color[0]); + } +#endif /* Face-vertex data */ if (gl_mesh->fvar_data != NULL) { @@ -635,6 +649,8 @@ static GLuint prepare_patchDraw(OpenSubdiv_GLMesh *gl_mesh, GLboolean use_texture_2d, use_lighting; glGetIntegerv(GL_SHADE_MODEL, &model); glGetBooleanv(GL_TEXTURE_2D, &use_texture_2d); + +#ifdef WITH_LEGACY_OPENGL glGetBooleanv(GL_LIGHTING, &use_lighting); if (model == GL_FLAT) { if (use_texture_2d) { @@ -660,6 +676,25 @@ static GLuint prepare_patchDraw(OpenSubdiv_GLMesh *gl_mesh, : g_smooth_fill_solid_shadeless_program; } } +#else + if (model == GL_FLAT) { + if (use_texture_2d) { + program = g_flat_fill_texture2d_program; + } + else { + program = g_flat_fill_solid_program; + } + } + else { + if (use_texture_2d) { + program = g_smooth_fill_texture2d_program; + } + else { + program = g_smooth_fill_solid_program; + } + } +#endif + } else { glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); |