7 #include "obt/display.h"
11 #include <GL/glxext.h>
12 #include <GL/glxtokens.h>
14 static int context_visual_config[] = {
21 gboolean paint_setup(LocoScreen *sc)
27 w = WidthOfScreen(ScreenOfDisplay(obt_display, sc->number));
28 h = HeightOfScreen(ScreenOfDisplay(obt_display, sc->number));
30 vi = glXChooseVisual(obt_display, sc->number, context_visual_config);
31 context = glXCreateContext(obt_display, vi, NULL, GL_TRUE);
32 if (context == NULL) {
33 g_print("context creation failed\n");
36 glXMakeCurrent(obt_display, sc->overlay, context);
38 glViewport(0, 0, w, h);
39 glMatrixMode(GL_PROJECTION);
41 g_print("Setting up an orthographic projection of %dx%d\n", w, h);
42 glOrtho(0, w, h, 0.0, -1.0, 100.0);
43 glMatrixMode(GL_MODELVIEW);
45 glClear(GL_COLOR_BUFFER_BIT);
46 glEnable(GL_TEXTURE_2D);
48 glXSwapBuffers(obt_display, sc->overlay);
49 glClearColor(0.4, 0.4, 0.4, 1.0);
51 glBlendFunc(GL_ONE_MINUS_SRC_ALPHA, GL_SRC_ALPHA);
57 void paint_everything(LocoScreen *sc)
62 XGrabServer(obt_display);
63 XSync(obt_display, FALSE);
65 /* XXX if (full_redraw_required) */
66 glClear(GL_COLOR_BUFFER_BIT);
68 for (it = sc->stacking_bottom; it != NULL; it = it->prev) {
69 if (it->window->id == sc->overlay) continue;
70 if (it->window->input_only) continue;
71 if (!it->window->visible) continue;
72 /* XXX if (!full_redraw_required && !it->window->damaged) continue; */
74 /* XXX if (!full_redraw_required) {
75 /\* XXX if the window is transparent, then clear the background
79 /* get the window's updated contents
80 XXX if animating the window, then don't do this, depending
82 loco_window_update_pixmap(it->window);
84 glBindTexture(GL_TEXTURE_2D, it->window->texname);
87 glColor3f(1.0, 1.0, 1.0);
88 glVertex2i(it->window->x, it->window->y);
90 glVertex2i(it->window->x + it->window->w, it->window->y);
92 glVertex2i(it->window->x + it->window->w,
93 it->window->y + it->window->h);
95 glVertex2i(it->window->x, it->window->y + it->window->h);
100 it->window->damaged = FALSE;
102 glXSwapBuffers(obt_display, sc->overlay);
104 XUngrabServer(obt_display);
106 loco_screen_redraw_done(sc);