Page MenuHome

GLRefactor: partially remove gl calls from source/blender/editors.
ClosedPublic

Authored by Ray molenkamp (LazyDodo) on Jun 24 2018, 6:37 PM.

Details

Summary

This translates the gl calls to the new GPU_ wrappers from D3501.

Given it's tedious and repetitive work, this patch does as much as it can with search + replace, the remainder of the gl calls will need to be manually dealt with on a case by case basis.

This fixes 13 of the 28 failing editors when building without opengl.

Substitutions:

"glEnable(GL_BLEND);"   --->   "GPU_blend(true);"
"glDisable(GL_BLEND);"   --->   "GPU_blend(false);"
"glEnable(GL_LINE_SMOOTH);"   --->   "GPU_line_smooth(true);"
"glDisable(GL_LINE_SMOOTH);"   --->   "GPU_line_smooth(false);"
"glEnable(GL_DEPTH_TEST);"   --->   "GPU_depth_test(true);"
"glDisable(GL_DEPTH_TEST);"   --->   "GPU_depth_test(false);"
"glEnable(GL_POLYGON_SMOOTH);"   --->   "GPU_polygon_smooth(true);"
"glDisable(GL_POLYGON_SMOOTH);"   --->   "GPU_polygon_smooth(false);"
"glEnable(GL_LINE_STIPPLE);"   --->   "GPU_line_stipple(true);"
"glDisable(GL_LINE_STIPPLE);"   --->   "GPU_line_stipple(false);"
"glIsEnabled(GL_DEPTH_TEST)"   --->   "GPU_depth_test_enabled()"
"glScissor("   --->   "GPU_scissor("
"GLint scissor[4]"   --->   "int scissor[4]"
"GLfloat scissor[4]"   --->   "float scissor[4]"
"glGetFloatv(GL_SCISSOR_BOX, scissor);"   --->   "GPU_scissor_getf(scissor);"
"glGetIntegerv(GL_SCISSOR_BOX, scissor);"   --->   "GPU_scissor_geti(scissor);"
"glGetFloatv(GL_VIEWPORT, viewport_size);"   --->   "GPU_viewport_size_getf(viewport_size);"
"glGetIntegerv(GL_VIEWPORT, view);"   --->   "GPU_viewport_size_geti(view);"
"glPointSize("   --->   "GPU_point_size("
"glLineWidth("   --->   "GPU_line_width("
"glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE_MINUS_SRC_ALPHA);"    --->    "GPU_blend_set_func_separate(GPU_SRC_ALPHA, GPU_ONE_MINUS_SRC_ALPHA, GPU_ONE, GPU_ONE_MINUS_SRC_ALPHA);"
"glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);"   --->   "GPU_blend_set_func(GPU_ONE, GPU_ONE_MINUS_SRC_ALPHA);"
"glBlendFunc(GL_DST_COLOR, GL_ZERO);"   --->   "GPU_blend_set_func(GPU_DST_COLOR, GPU_ZERO);"
"glBlendFunc(GL_ONE, GL_ZERO);"   --->   "GPU_blend_set_func(GPU_ONE, GPU_ZERO);"
"glBlendFunc(GL_DST_COLOR, GL_SRC_ALPHA);"   --->   "GPU_blend_set_func(GPU_DST_COLOR, GPU_SRC_ALPHA);";

"glClearColor("   --->   "GPU_clear_color("
"glClear(GL_COLOR_BUFFER_BIT);"   --->   "GPU_clear(GPU_COLOR_BIT);"
"glClear(GL_DEPTH_BUFFER_BIT);"   --->   "GPU_clear(GPU_DEPTH_BIT);"
"glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);"   --->   "GPU_clear(GPU_COLOR_BIT | GPU_DEPTH_BIT);"

Diff Detail

Repository
rB Blender