r1053: Add Russian translation.
[cinelerra_cv.git] / guicast / bcwindow3d.C
blob9c1592434e830f0dfb43ae07e7271f4df0d67193
1 #define GL_GLEXT_PROTOTYPES
2 #include "bcpixmap.h"
3 #include "bcresources.h"
4 #include "bcsignals.h"
5 #include "bcsynchronous.h"
6 #include "bcwindowbase.h"
8 // OpenGL functions in BC_WindowBase
10 void BC_WindowBase::enable_opengl()
12 #ifdef HAVE_GL
13         XVisualInfo viproto;
14         XVisualInfo *visinfo;
15         int nvi;
17         top_level->sync_display();
19         get_synchronous()->is_pbuffer = 0;
20         if(!gl_win_context)
21         {
22                 viproto.screen = top_level->screen;
23                 visinfo = XGetVisualInfo(top_level->display,
24                 VisualScreenMask,
25                 &viproto,
26                 &nvi);
28                 gl_win_context = glXCreateContext(top_level->display,
29                         visinfo,
30                         0,
31                         1);
32         }
35 //      if(video_is_on())
36 //      {
37 // Make the front buffer's context current.  Pixmaps don't work.
38                 get_synchronous()->current_window = this;
39                 glXMakeCurrent(top_level->display,
40                         win,
41                         gl_win_context);
42 //      }
43 //      else
44 //      {
45 //              get_synchronous()->current_window = this;
46 //              pixmap->enable_opengl();
47 //      }
49 #endif
52 void BC_WindowBase::disable_opengl()
54 #ifdef HAVE_GL
55 //      unsigned long valuemask = CWEventMask;
56 //      XSetWindowAttributes attributes;
57 //      attributes.event_mask = DEFAULT_EVENT_MASKS;
58 //      XChangeWindowAttributes(top_level->display, win, valuemask, &attributes);
59 #endif
62 void BC_WindowBase::flip_opengl()
64 #ifdef HAVE_GL
65         glXSwapBuffers(top_level->display, win);
66         glFlush();
67 #endif
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);