Commit: 257e6c0c7df443b96a567270ce541a686104eead
Author: Luca Rood
Date:   Thu Apr 13 16:52:13 2017 +0200
Branches: blender2.8
https://developer.blender.org/rB257e6c0c7df443b96a567270ce541a686104eead

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

===================================================================

M       intern/opensubdiv/opensubdiv_gpu_capi.cc

===================================================================

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);

_______________________________________________
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to