Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
-// OpenGL widget based on GtkGLExt
+// OpenGL widget based on GtkGLExt / GtkGLArea
#include "glwidget.h"
#include "igl.h"
-void (*GLWidget_sharedContextCreated)() = 0;
-
-void (*GLWidget_sharedContextDestroyed)() = 0;
+// Function callbacks
+static void (*sharedContextCreated)() = nullptr;
+static void (*sharedContextDestroyed)() = nullptr;
unsigned int g_context_count = 0;
glwidget_make_current(g_shared);
GlobalOpenGL().contextValid = true;
- GLWidget_sharedContextCreated();
+ sharedContextCreated();
}
}
if (--g_context_count == 0) {
GlobalOpenGL().contextValid = false;
- GLWidget_sharedContextDestroyed();
+ sharedContextDestroyed();
g_shared.unref();
g_shared = ui::GLArea(ui::null);
}
}
-void glwidget_destroy_context(ui::GLArea self)
-{
-}
-
-void glwidget_create_context(ui::GLArea self)
+void glwidget_set_shared_context_constructors(
+ void created(), void destroyed() )
{
+ sharedContextCreated = created;
+ sharedContextDestroyed = destroyed;
}
#if GTK_TARGET == 3
#if !defined( INCLUDED_GTKUTIL_GLWIDGET_H )
#define INCLUDED_GTKUTIL_GLWIDGET_H
-extern void (*GLWidget_sharedContextCreated)();
-extern void (*GLWidget_sharedContextDestroyed)();
-
ui::GLArea glwidget_new(bool zbuffer);
-void glwidget_create_context(ui::GLArea self);
-void glwidget_destroy_context(ui::GLArea self);
+void glwidget_set_shared_context_constructors(
+ void sharedContextCreated(), void sharedContextDestroyed() );
bool glwidget_make_current(ui::GLArea self);
void glwidget_swap_buffers(ui::GLArea self);
g_entityCount.setCountChangedCallback( makeCallbackF(QE_entityCountChanged) );
GlobalEntityCreator().setCounter( &g_entityCount );
- GLWidget_sharedContextCreated = GlobalGL_sharedContextCreated;
- GLWidget_sharedContextDestroyed = GlobalGL_sharedContextDestroyed;
+ glwidget_set_shared_context_constructors( GlobalGL_sharedContextCreated, GlobalGL_sharedContextDestroyed);
GlobalEntityClassManager().attach( g_WorldspawnColourEntityClassObserver );
}