00001 #define GL_GLEXT_PROTOTYPES
00002 #include "bcpixmap.h"
00003 #include "bcresources.h"
00004 #include "bcsignals.h"
00005 #include "bcsynchronous.h"
00006 #include "bcwindowbase.h"
00007
00008
00009
00010 void BC_WindowBase::enable_opengl()
00011 {
00012 #ifdef HAVE_GL
00013 XVisualInfo viproto;
00014 XVisualInfo *visinfo;
00015 int nvi;
00016
00017 top_level->sync_display();
00018
00019 get_synchronous()->is_pbuffer = 0;
00020 if(!gl_win_context)
00021 {
00022 viproto.screen = top_level->screen;
00023 visinfo = XGetVisualInfo(top_level->display,
00024 VisualScreenMask,
00025 &viproto,
00026 &nvi);
00027
00028 gl_win_context = glXCreateContext(top_level->display,
00029 visinfo,
00030 0,
00031 1);
00032 }
00033
00034
00035
00036
00037
00038 get_synchronous()->current_window = this;
00039 glXMakeCurrent(top_level->display,
00040 win,
00041 gl_win_context);
00042
00043
00044
00045
00046
00047
00048
00049 #endif
00050 }
00051
00052 void BC_WindowBase::disable_opengl()
00053 {
00054 #ifdef HAVE_GL
00055
00056
00057
00058
00059 #endif
00060 }
00061
00062 void BC_WindowBase::flip_opengl()
00063 {
00064 #ifdef HAVE_GL
00065 glXSwapBuffers(top_level->display, win);
00066 glFlush();
00067 #endif
00068 }
00069
00070 unsigned int BC_WindowBase::get_shader(char *source, int *got_it)
00071 {
00072 return get_resources()->get_synchronous()->get_shader(source, got_it);
00073 }
00074
00075 void BC_WindowBase::put_shader(unsigned int handle, char *source)
00076 {
00077 get_resources()->get_synchronous()->put_shader(handle, source);
00078 }
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088