From 0c560890a4a393cd86bad585e28efaac7b770126 Mon Sep 17 00:00:00 2001 From: Roz K Date: Sat, 24 Dec 2022 07:03:59 +0100 Subject: [PATCH] Cleanup: move all GLX stuff into render_context_glx. --- cpp/opengl/render_context.hpp | 8 +++++--- cpp/opengl/render_context_glx.cpp | 9 +++++---- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/cpp/opengl/render_context.hpp b/cpp/opengl/render_context.hpp index 8e8ff74..43409c4 100644 --- a/cpp/opengl/render_context.hpp +++ b/cpp/opengl/render_context.hpp @@ -17,10 +17,12 @@ #define _RK_ENGINE_RENDER_CONTEXT_H #include "../render.hpp" -#include -extern PFNGLDRAWELEMENTSINSTANCEDBASEINSTANCEPROC rk_DrawElementsInstancedBaseInstance; -extern PFNGLMULTIDRAWELEMENTSINDIRECTPROC rk_MultiDrawElementsIndirect; +typedef void (*rk_DrawElementsInstancedBaseInstanceFunc)(rk_uint, rk_uint, rk_uint, const void *, rk_uint, rk_uint); +typedef void (*rk_MultiDrawElementsIndirectFunc)(rk_uint, rk_uint, const void *, rk_uint, rk_uint); + +extern rk_DrawElementsInstancedBaseInstanceFunc rk_DrawElementsInstancedBaseInstance; +extern rk_MultiDrawElementsIndirectFunc rk_MultiDrawElementsIndirect; extern rk_window_t rk_create_context( char const * name, diff --git a/cpp/opengl/render_context_glx.cpp b/cpp/opengl/render_context_glx.cpp index 92f8920..99d54bd 100644 --- a/cpp/opengl/render_context_glx.cpp +++ b/cpp/opengl/render_context_glx.cpp @@ -21,6 +21,7 @@ #include #include #include +#include extern unsigned rk_events_mask; @@ -35,8 +36,8 @@ static bool rk_error_occured = false; #define GLX_CONTEXT_MINOR_VERSION_ARB 0x2092 typedef GLXContext (*glXCreateContextAttribsARBProc)(Display *, GLXFBConfig, GLXContext, Bool, int const *); -PFNGLDRAWELEMENTSINSTANCEDBASEINSTANCEPROC rk_DrawElementsInstancedBaseInstance = nullptr; -PFNGLMULTIDRAWELEMENTSINDIRECTPROC rk_MultiDrawElementsIndirect = nullptr; +rk_DrawElementsInstancedBaseInstanceFunc rk_DrawElementsInstancedBaseInstance = nullptr; +rk_MultiDrawElementsIndirectFunc rk_MultiDrawElementsIndirect = nullptr; static int const rk_visual_attribs[] = { GLX_X_RENDERABLE, True, @@ -202,13 +203,13 @@ rk_window_t rk_create_context( char const * const gl_exts = reinterpret_cast(glGetString(GL_EXTENSIONS)); if (rk_extension_supported(gl_exts, "GL_EXT_base_instance")) { rk_DrawElementsInstancedBaseInstance = - reinterpret_cast( + reinterpret_cast( glXGetProcAddressARB(reinterpret_cast("DrawElementsInstancedBaseInstance"))); if (rk_DrawElementsInstancedBaseInstance) { rk_printf("Using extension GL_EXT_base_instance::DrawElementsInstancedBaseInstance."); if (rk_extension_supported(gl_exts, "GL_EXT_multi_draw_indirect")) { rk_MultiDrawElementsIndirect = - reinterpret_cast( + reinterpret_cast( glXGetProcAddressARB(reinterpret_cast("MultiDrawElementsIndirectEXT"))); if (rk_MultiDrawElementsIndirect) { rk_printf("Using extension GL_EXT_multi_draw_indirect::MultiDrawElementsIndirectEXT.");