1 #define GL_GLEXT_PROTOTYPES
3 #include "bcresources.h"
5 #include "bcsynchronous.h"
6 #include "bcwindowbase.h"
8 // OpenGL functions in BC_WindowBase
10 void BC_WindowBase::enable_opengl()
17 top_level->sync_display();
19 get_synchronous()->is_pbuffer = 0;
22 viproto.screen = top_level->screen;
23 visinfo = XGetVisualInfo(top_level->display,
28 gl_win_context = glXCreateContext(top_level->display,
37 // Make the front buffer's context current. Pixmaps don't work.
38 get_synchronous()->current_window = this;
39 glXMakeCurrent(top_level->display,
45 // get_synchronous()->current_window = this;
46 // pixmap->enable_opengl();
52 void BC_WindowBase::disable_opengl()
55 // unsigned long valuemask = CWEventMask;
56 // XSetWindowAttributes attributes;
57 // attributes.event_mask = DEFAULT_EVENT_MASKS;
58 // XChangeWindowAttributes(top_level->display, win, valuemask, &attributes);
62 void BC_WindowBase::flip_opengl()
65 glXSwapBuffers(top_level->display, win);
70 unsigned int BC_WindowBase::get_shader(char *source, int *got_it)
72 return get_resources()->get_synchronous()->get_shader(source, got_it);
75 void BC_WindowBase::put_shader(unsigned int handle, char *source)
77 get_resources()->get_synchronous()->put_shader(handle, source);