Search
lxdream.org :: lxdream/src/drivers/video_glx.c
lxdream 0.9.1
released Jun 29
Download Now
filename src/drivers/video_glx.c
changeset 1076:18c164e8aec4
prev1066:ddffe9d2b332
next1134:f502f3d32f90
author nkeynes
date Mon Aug 03 08:41:11 2009 +1000 (12 years ago)
permissions -rw-r--r--
last change Rearrange frame output slightly.
pvr2_display_frame renamed to pvr2_next_frame and changed to update the
frame data without displaying it.
pvr2_redraw_display renamed to pvr2_draw_frame, called internally after
pvr2_next_frame
Add swap_buffers() method to the display driver
Remove explicit glDrawBuffer() calls where they're referencing the window.
pvr2_draw_frame now gets to decide where to draw.
Add force_vsync flag to force double-buffering (not configurable yet)
file annotate diff log raw
nkeynes@545
     1
/**
nkeynes@586
     2
 * $Id$
nkeynes@545
     3
 *
nkeynes@545
     4
 * Shared functions for all X11-based display drivers.
nkeynes@545
     5
 *
nkeynes@545
     6
 * Copyright (c) 2005 Nathan Keynes.
nkeynes@545
     7
 *
nkeynes@545
     8
 * This program is free software; you can redistribute it and/or modify
nkeynes@545
     9
 * it under the terms of the GNU General Public License as published by
nkeynes@545
    10
 * the Free Software Foundation; either version 2 of the License, or
nkeynes@545
    11
 * (at your option) any later version.
nkeynes@545
    12
 *
nkeynes@545
    13
 * This program is distributed in the hope that it will be useful,
nkeynes@545
    14
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
nkeynes@545
    15
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
nkeynes@545
    16
 * GNU General Public License for more details.
nkeynes@545
    17
 */
nkeynes@545
    18
nkeynes@806
    19
#include <stdlib.h>
nkeynes@635
    20
#include <string.h>
nkeynes@586
    21
#include "display.h"
nkeynes@545
    22
#include <X11/Xlib.h>
nkeynes@545
    23
#include <GL/glx.h>
nkeynes@635
    24
#include "pvr2/pvr2.h"
nkeynes@635
    25
#include "pvr2/glutil.h"
nkeynes@545
    26
#include "drivers/video_glx.h"
nkeynes@635
    27
#include "drivers/video_gl.h"
nkeynes@545
    28
nkeynes@545
    29
/**
nkeynes@545
    30
 * General X11 parameters. The front-end driver is expected to set this up
nkeynes@545
    31
 * by calling video_glx_init after initializing itself.
nkeynes@545
    32
 */
nkeynes@545
    33
Display *video_x11_display = NULL;
nkeynes@545
    34
Window video_x11_window = 0;
nkeynes@545
    35
nkeynes@545
    36
static int glx_version = 100;
nkeynes@606
    37
static XVisualInfo *glx_visual = NULL;
nkeynes@545
    38
static GLXFBConfig glx_fbconfig;
nkeynes@545
    39
static GLXContext glx_context = NULL;
nkeynes@545
    40
static gboolean glx_is_initialized = FALSE;
nkeynes@545
    41
static gboolean glx_fbconfig_supported = FALSE;
nkeynes@545
    42
static gboolean glx_pbuffer_supported = FALSE;
nkeynes@669
    43
static GLuint glx_pbuffer_texture = 0; 
nkeynes@545
    44
nkeynes@1076
    45
static void video_glx_swap_buffers( void );
nkeynes@1076
    46
nkeynes@545
    47
/* Prototypes for pbuffer support methods */
nkeynes@545
    48
static void glx_pbuffer_init( display_driver_t driver );
nkeynes@805
    49
static render_buffer_t glx_pbuffer_create_render_buffer( uint32_t width, uint32_t height, GLuint tex_id );
nkeynes@545
    50
static void glx_pbuffer_destroy_render_buffer( render_buffer_t buffer );
nkeynes@545
    51
static gboolean glx_pbuffer_set_render_target( render_buffer_t buffer );
nkeynes@805
    52
static void glx_pbuffer_finish_render( render_buffer_t buffer );
nkeynes@669
    53
static void glx_pbuffer_display_render_buffer( render_buffer_t buffer );
nkeynes@545
    54
static void glx_pbuffer_load_frame_buffer( frame_buffer_t frame, render_buffer_t buffer );
nkeynes@669
    55
static void glx_pbuffer_display_blank( uint32_t colour );
nkeynes@545
    56
static gboolean glx_pbuffer_read_render_buffer( unsigned char *target, render_buffer_t buffer, int rowstride, int format );
nkeynes@545
    57
nkeynes@545
    58
/**
nkeynes@545
    59
 * Test if a specific extension is supported. From opengl.org
nkeynes@545
    60
 * @param extension extension name to check for
nkeynes@545
    61
 * @return TRUE if supported, otherwise FALSE.
nkeynes@545
    62
 */
nkeynes@545
    63
gboolean isServerGLXExtensionSupported( Display *display, int screen, 
nkeynes@736
    64
                                        const char *extension )
nkeynes@545
    65
{
nkeynes@545
    66
    const char *extensions = NULL;
nkeynes@545
    67
    const char *start;
nkeynes@545
    68
    char *where, *terminator;
nkeynes@545
    69
nkeynes@545
    70
    /* Extension names should not have spaces. */
nkeynes@545
    71
    where = strchr(extension, ' ');
nkeynes@545
    72
    if (where || *extension == '\0')
nkeynes@736
    73
        return 0;
nkeynes@545
    74
    extensions = glXQueryServerString(display, screen, GLX_EXTENSIONS);
nkeynes@545
    75
    start = extensions;
nkeynes@545
    76
    for (;;) {
nkeynes@736
    77
        where = strstr((const char *) start, extension);
nkeynes@736
    78
        if (!where)
nkeynes@736
    79
            break;
nkeynes@736
    80
        terminator = where + strlen(extension);
nkeynes@736
    81
        if (where == start || *(where - 1) == ' ')
nkeynes@736
    82
            if (*terminator == ' ' || *terminator == '\0')
nkeynes@736
    83
                return TRUE;
nkeynes@736
    84
        start = terminator;
nkeynes@545
    85
    }
nkeynes@545
    86
    return FALSE;
nkeynes@545
    87
}
nkeynes@545
    88
nkeynes@545
    89
gboolean video_glx_init( Display *display, int screen )
nkeynes@545
    90
{
nkeynes@545
    91
    int major, minor;
nkeynes@982
    92
    int glx_major, glx_minor, glx_error;
nkeynes@545
    93
nkeynes@545
    94
    if( glx_is_initialized ) {
nkeynes@545
    95
        return TRUE;
nkeynes@545
    96
    }
nkeynes@545
    97
nkeynes@982
    98
    Bool result = XQueryExtension( display, "GLX", &glx_major, &glx_minor, &glx_error ) &&
nkeynes@982
    99
                  glXQueryVersion( display, &major, &minor );
nkeynes@982
   100
    if( result == False ) {
nkeynes@982
   101
        ERROR( "GLX not supported on display" );
nkeynes@982
   102
        return FALSE;
nkeynes@545
   103
    }
nkeynes@545
   104
    
nkeynes@982
   105
    glx_version = (major*100) + minor;
nkeynes@982
   106
nkeynes@863
   107
#ifdef APPLE_BUILD
nkeynes@863
   108
    /* fbconfig is broken on at least the 10.5 GLX implementation */
nkeynes@863
   109
    glx_fbconfig_supported = FALSE;
nkeynes@863
   110
#else
nkeynes@545
   111
    glx_fbconfig_supported = (glx_version >= 103 || 
nkeynes@736
   112
            isServerGLXExtensionSupported(display, screen,
nkeynes@736
   113
                    "GLX_SGIX_fbconfig") );
nkeynes@863
   114
#endif
nkeynes@545
   115
    glx_pbuffer_supported = (glx_version >= 103 ||
nkeynes@736
   116
            isServerGLXExtensionSupported(display, screen,
nkeynes@736
   117
                    "GLX_SGIX_pbuffer") );
nkeynes@863
   118
//    glx_fbconfig_supported = FALSE;
nkeynes@545
   119
    if( glx_fbconfig_supported ) {
nkeynes@736
   120
        int nelem;
nkeynes@545
   121
        int fb_attribs[] = { GLX_DRAWABLE_TYPE, 
nkeynes@736
   122
                GLX_PBUFFER_BIT|GLX_WINDOW_BIT, 
nkeynes@736
   123
                GLX_RENDER_TYPE, GLX_RGBA_BIT, 
nkeynes@863
   124
                GLX_DEPTH_SIZE, 24, 
nkeynes@863
   125
                GLX_STENCIL_SIZE, 8, 0 };
nkeynes@736
   126
        GLXFBConfig *configs = glXChooseFBConfig( display, screen, 
nkeynes@736
   127
                fb_attribs, &nelem );
nkeynes@606
   128
nkeynes@736
   129
        if( configs == NULL || nelem == 0 ) {
nkeynes@736
   130
            /* Try a 16-bit depth buffer and see if it helps */
nkeynes@736
   131
            fb_attribs[5] = 16;
nkeynes@736
   132
            configs = glXChooseFBConfig( display, screen, fb_attribs, &nelem );
nkeynes@736
   133
            if( nelem > 0 ) {
nkeynes@676
   134
                WARN( "Using a 16-bit depth buffer - expect video glitches" );
nkeynes@676
   135
            }
nkeynes@545
   136
nkeynes@676
   137
        }
nkeynes@676
   138
        if( configs == NULL || nelem == 0 ) {
nkeynes@736
   139
            /* Still didn't work. Fallback to 1.2 methods */
nkeynes@736
   140
            glx_fbconfig_supported = FALSE;
nkeynes@736
   141
            glx_pbuffer_supported = FALSE;
nkeynes@736
   142
        } else {
nkeynes@736
   143
            glx_fbconfig = configs[0];
nkeynes@736
   144
            glx_visual = glXGetVisualFromFBConfig(display, glx_fbconfig);
nkeynes@736
   145
            XFree(configs);
nkeynes@736
   146
        }
nkeynes@545
   147
    }
nkeynes@545
   148
nkeynes@545
   149
    if( !glx_fbconfig_supported ) {
nkeynes@863
   150
        int attribs[] = { GLX_RGBA, GLX_DEPTH_SIZE, 24, GLX_STENCIL_SIZE, 8, 0 };
nkeynes@736
   151
        glx_visual = glXChooseVisual( display, screen, attribs );
nkeynes@676
   152
        if( glx_visual == NULL ) {
nkeynes@676
   153
            /* Try the 16-bit fallback here too */
nkeynes@676
   154
            attribs[2] = 16;
nkeynes@676
   155
            glx_visual = glXChooseVisual( display, screen, attribs );
nkeynes@676
   156
            if( glx_visual != NULL ) {
nkeynes@676
   157
                WARN( "Using a 16-bit depth buffer - expect video glitches" );
nkeynes@676
   158
            }
nkeynes@676
   159
        }
nkeynes@545
   160
    }
nkeynes@606
   161
nkeynes@606
   162
    if( glx_visual == NULL ) {
nkeynes@606
   163
        return FALSE;
nkeynes@606
   164
    }
nkeynes@606
   165
nkeynes@545
   166
    glx_is_initialized = TRUE;
nkeynes@545
   167
    return TRUE;
nkeynes@545
   168
}
nkeynes@545
   169
nkeynes@545
   170
gboolean video_glx_init_context( Display *display, Window window )
nkeynes@545
   171
{
nkeynes@545
   172
    if( glx_fbconfig_supported ) {
nkeynes@545
   173
        glx_context = glXCreateNewContext( display, glx_fbconfig, 
nkeynes@736
   174
                GLX_RGBA_TYPE, NULL, True );
nkeynes@736
   175
        if( glx_context == NULL ) {
nkeynes@736
   176
            ERROR( "Unable to create a GLX Context.");
nkeynes@736
   177
            return FALSE;
nkeynes@736
   178
        }
nkeynes@545
   179
nkeynes@1001
   180
        if( glXMakeCurrent( display, window,
nkeynes@736
   181
                glx_context ) == False ) {
nkeynes@736
   182
            ERROR( "Unable to prepare GLX context for drawing" );
nkeynes@736
   183
            glXDestroyContext( display, glx_context );
nkeynes@736
   184
            return FALSE;
nkeynes@736
   185
        }
nkeynes@545
   186
    } else {
nkeynes@545
   187
        glx_context = glXCreateContext( display, glx_visual, None, True );
nkeynes@736
   188
        if( glx_context == NULL ) {
nkeynes@736
   189
            ERROR( "Unable to create a GLX Context.");
nkeynes@736
   190
            return FALSE;
nkeynes@736
   191
        }
nkeynes@736
   192
nkeynes@736
   193
        if( glXMakeCurrent( display, window, glx_context ) == False ) {
nkeynes@736
   194
            ERROR( "Unable to prepare GLX context for drawing" );
nkeynes@736
   195
            glXDestroyContext( display, glx_context );
nkeynes@736
   196
            return FALSE;
nkeynes@736
   197
        }
nkeynes@545
   198
    }
nkeynes@545
   199
nkeynes@545
   200
    if( !glXIsDirect(display, glx_context) ) {
nkeynes@736
   201
        WARN( "Not using direct rendering - this is likely to be slow" );
nkeynes@545
   202
    }
nkeynes@545
   203
nkeynes@545
   204
    video_x11_display = display;
nkeynes@545
   205
    video_x11_window = window;
nkeynes@545
   206
nkeynes@545
   207
    return TRUE;
nkeynes@545
   208
}
nkeynes@545
   209
nkeynes@545
   210
gboolean video_glx_init_driver( display_driver_t driver )
nkeynes@545
   211
{
nkeynes@1076
   212
    driver->swap_buffers = video_glx_swap_buffers;
nkeynes@545
   213
    if( gl_fbo_is_supported() ) { // First preference
nkeynes@736
   214
        gl_fbo_init(driver);
nkeynes@545
   215
    } else if( glx_pbuffer_supported ) {
nkeynes@736
   216
        glx_pbuffer_init(driver);
nkeynes@545
   217
    } else {
nkeynes@545
   218
        ERROR( "Unable to create render buffers (requires either EXT_framebuffer_object or GLX 1.3+)" );
nkeynes@545
   219
        video_glx_shutdown();
nkeynes@736
   220
        return FALSE;
nkeynes@545
   221
    }
nkeynes@545
   222
    return TRUE;
nkeynes@545
   223
}
nkeynes@545
   224
nkeynes@545
   225
nkeynes@545
   226
void video_glx_shutdown()
nkeynes@545
   227
{
nkeynes@736
   228
    //    texcache_gl_shutdown();
nkeynes@545
   229
    glx_is_initialized = FALSE;
nkeynes@545
   230
    if( glx_context != NULL ) {
nkeynes@545
   231
        glXDestroyContext( video_x11_display, glx_context );
nkeynes@736
   232
        glx_context = NULL;
nkeynes@545
   233
    }
nkeynes@545
   234
    if( glx_visual != NULL ) {
nkeynes@545
   235
        XFree(glx_visual);
nkeynes@736
   236
        glx_visual = NULL;
nkeynes@545
   237
    }
nkeynes@545
   238
}
nkeynes@545
   239
nkeynes@545
   240
nkeynes@545
   241
XVisualInfo *video_glx_get_visual()
nkeynes@545
   242
{
nkeynes@545
   243
    return glx_visual;
nkeynes@545
   244
}
nkeynes@545
   245
nkeynes@545
   246
nkeynes@545
   247
int video_glx_load_font( const gchar *font_name )
nkeynes@545
   248
{
nkeynes@545
   249
    int lists;
nkeynes@545
   250
    XFontStruct *font = XLoadQueryFont(video_x11_display, font_name );
nkeynes@545
   251
    if (font == NULL)
nkeynes@736
   252
        return -1;
nkeynes@736
   253
nkeynes@545
   254
    lists = glGenLists(96);
nkeynes@545
   255
    glXUseXFont(font->fid, 32, 96, lists);
nkeynes@545
   256
    XFreeFont(video_x11_display, font);
nkeynes@545
   257
    return lists;
nkeynes@545
   258
}
nkeynes@545
   259
nkeynes@545
   260
nkeynes@1076
   261
static void video_glx_swap_buffers( void )
nkeynes@545
   262
{
nkeynes@545
   263
    glXSwapBuffers( video_x11_display, video_x11_window );
nkeynes@545
   264
}
nkeynes@545
   265
nkeynes@545
   266
void video_glx_make_window_current( void )
nkeynes@545
   267
{
nkeynes@545
   268
    glXMakeCurrent( video_x11_display, video_x11_window, glx_context );
nkeynes@545
   269
}
nkeynes@545
   270
nkeynes@545
   271
nkeynes@545
   272
// Pbuffer support
nkeynes@545
   273
nkeynes@545
   274
/**
nkeynes@545
   275
 * Construct the initial frame buffers and allocate ids for everything.
nkeynes@545
   276
 * The render handling driver methods are set to the fbo versions.
nkeynes@545
   277
 */
nkeynes@545
   278
static void glx_pbuffer_init( display_driver_t driver ) 
nkeynes@545
   279
{
nkeynes@863
   280
    GLint stencil_bits = 0;
nkeynes@863
   281
    
nkeynes@863
   282
    /* Retrieve the number of stencil bits */
nkeynes@863
   283
    glGetIntegerv( GL_STENCIL_BITS, &stencil_bits );
nkeynes@863
   284
    driver->capabilities.stencil_bits = stencil_bits;
nkeynes@863
   285
    
nkeynes@545
   286
    glGenTextures( 1, &glx_pbuffer_texture );
nkeynes@545
   287
    driver->create_render_buffer = glx_pbuffer_create_render_buffer;
nkeynes@545
   288
    driver->destroy_render_buffer = glx_pbuffer_destroy_render_buffer;
nkeynes@545
   289
    driver->set_render_target = glx_pbuffer_set_render_target;
nkeynes@805
   290
    driver->finish_render = glx_pbuffer_finish_render;
nkeynes@545
   291
    driver->display_render_buffer = glx_pbuffer_display_render_buffer;
nkeynes@545
   292
    driver->load_frame_buffer = glx_pbuffer_load_frame_buffer;
nkeynes@545
   293
    driver->display_blank = glx_pbuffer_display_blank;
nkeynes@545
   294
    driver->read_render_buffer = glx_pbuffer_read_render_buffer;
nkeynes@545
   295
}
nkeynes@545
   296
nkeynes@545
   297
void glx_pbuffer_shutdown()
nkeynes@545
   298
{
nkeynes@545
   299
    glDeleteTextures( 1, &glx_pbuffer_texture );
nkeynes@545
   300
}
nkeynes@545
   301
nkeynes@805
   302
static render_buffer_t glx_pbuffer_create_render_buffer( uint32_t width, uint32_t height, GLuint tex_id )
nkeynes@545
   303
{
nkeynes@545
   304
    int attribs[] = { GLX_PBUFFER_WIDTH, width, GLX_PBUFFER_HEIGHT, height,
nkeynes@736
   305
            GLX_PRESERVED_CONTENTS, True, 0 };
nkeynes@545
   306
    GLXPbuffer pb = glXCreatePbuffer( video_x11_display, glx_fbconfig, attribs );
nkeynes@545
   307
    if( pb == (GLXPbuffer)NULL ) {
nkeynes@736
   308
        ERROR( "Unable to create pbuffer" );
nkeynes@736
   309
        return NULL;
nkeynes@545
   310
    }
nkeynes@545
   311
    render_buffer_t buffer = calloc( sizeof(struct render_buffer), 1 );
nkeynes@545
   312
    buffer->width = width;
nkeynes@545
   313
    buffer->height = height;
nkeynes@545
   314
    buffer->buf_id = pb;
nkeynes@805
   315
    buffer->tex_id = tex_id;
nkeynes@545
   316
    return buffer;
nkeynes@545
   317
}
nkeynes@545
   318
nkeynes@545
   319
static void glx_pbuffer_destroy_render_buffer( render_buffer_t buffer )
nkeynes@545
   320
{
nkeynes@545
   321
    glXDestroyPbuffer( video_x11_display, (GLXPbuffer)buffer->buf_id );
nkeynes@545
   322
    buffer->buf_id = 0;
nkeynes@545
   323
    free( buffer );
nkeynes@545
   324
}
nkeynes@545
   325
nkeynes@545
   326
static gboolean glx_pbuffer_set_render_target( render_buffer_t buffer )
nkeynes@545
   327
{
nkeynes@545
   328
    glFinish();
nkeynes@545
   329
    if( glXMakeContextCurrent( video_x11_display, (GLXPbuffer)buffer->buf_id, (GLXPbuffer)buffer->buf_id, glx_context ) == False ) {
nkeynes@736
   330
        ERROR( "Make context current (pbuffer) failed!" );
nkeynes@545
   331
    }
nkeynes@545
   332
    /* setup the gl context */
nkeynes@545
   333
    glViewport( 0, 0, buffer->width, buffer->height );
nkeynes@545
   334
    glDrawBuffer(GL_FRONT);
nkeynes@736
   335
nkeynes@545
   336
    return TRUE;
nkeynes@545
   337
}
nkeynes@545
   338
nkeynes@805
   339
static void glx_pbuffer_finish_render( render_buffer_t buffer )
nkeynes@805
   340
{
nkeynes@805
   341
    glFinish();
nkeynes@805
   342
    if( buffer->tex_id != 0 ) {
nkeynes@805
   343
        // The pbuffer should already be the current context, but just in case...
nkeynes@805
   344
        glXMakeContextCurrent( video_x11_display, (GLXPbuffer)buffer->buf_id, (GLXPbuffer)buffer->buf_id, glx_context );
nkeynes@805
   345
        glBindTexture( GL_TEXTURE_RECTANGLE_ARB, buffer->tex_id );
nkeynes@805
   346
        glCopyTexImage2D(GL_TEXTURE_RECTANGLE_ARB, 0, GL_RGBA, 0, 0, buffer->width, buffer->height, 0 );
nkeynes@805
   347
    }
nkeynes@805
   348
}
nkeynes@805
   349
    
nkeynes@805
   350
nkeynes@545
   351
/**
nkeynes@545
   352
 * Render the texture holding the given buffer to the front window
nkeynes@545
   353
 * buffer.
nkeynes@545
   354
 */
nkeynes@669
   355
static void glx_pbuffer_display_render_buffer( render_buffer_t buffer )
nkeynes@545
   356
{
nkeynes@545
   357
    glFinish();
nkeynes@545
   358
    glReadBuffer( GL_FRONT );
nkeynes@545
   359
    glXMakeContextCurrent( video_x11_display, (GLXPbuffer)buffer->buf_id, (GLXPbuffer)buffer->buf_id, glx_context );
nkeynes@545
   360
    glBindTexture( GL_TEXTURE_RECTANGLE_ARB, glx_pbuffer_texture );
nkeynes@545
   361
    glCopyTexImage2D(GL_TEXTURE_RECTANGLE_ARB, 0, GL_RGBA, 0, 0, buffer->width, buffer->height, 0 );
nkeynes@545
   362
    video_glx_make_window_current();
nkeynes@545
   363
    gl_texture_window( buffer->width, buffer->height, glx_pbuffer_texture, buffer->inverted );
nkeynes@545
   364
}
nkeynes@545
   365
nkeynes@545
   366
static void glx_pbuffer_load_frame_buffer( frame_buffer_t frame, render_buffer_t buffer )
nkeynes@545
   367
{
nkeynes@545
   368
    glFinish();
nkeynes@545
   369
    glXMakeContextCurrent( video_x11_display, (GLXPbuffer)buffer->buf_id, (GLXPbuffer)buffer->buf_id, glx_context );
nkeynes@545
   370
    GLenum type = colour_formats[frame->colour_format].type;
nkeynes@545
   371
    GLenum format = colour_formats[frame->colour_format].format;
nkeynes@545
   372
    int bpp = colour_formats[frame->colour_format].bpp;
nkeynes@545
   373
    int rowstride = (frame->rowstride / bpp) - frame->width;
nkeynes@736
   374
nkeynes@545
   375
    gl_reset_state();
nkeynes@545
   376
    glPixelStorei( GL_UNPACK_ROW_LENGTH, rowstride );
nkeynes@545
   377
    glRasterPos2f(0.375, frame->height-0.375);
nkeynes@545
   378
    glPixelZoom( 1.0, 1.0 );
nkeynes@545
   379
    glDrawPixels( frame->width, frame->height, format, type, frame->data );
nkeynes@545
   380
    glFlush();
nkeynes@545
   381
}
nkeynes@545
   382
nkeynes@669
   383
static void glx_pbuffer_display_blank( uint32_t colour )
nkeynes@545
   384
{
nkeynes@545
   385
    glFinish();
nkeynes@545
   386
    video_glx_make_window_current();
nkeynes@669
   387
    gl_display_blank( colour );
nkeynes@545
   388
}
nkeynes@545
   389
nkeynes@545
   390
static gboolean glx_pbuffer_read_render_buffer( unsigned char *target, render_buffer_t buffer, 
nkeynes@736
   391
                                                int rowstride, int format )
nkeynes@545
   392
{
nkeynes@545
   393
    glXMakeCurrent( video_x11_display, (GLXDrawable)buffer->buf_id, glx_context );
nkeynes@545
   394
    glReadBuffer( GL_FRONT );
nkeynes@545
   395
    return gl_read_render_buffer( target, buffer, rowstride, format );
nkeynes@545
   396
}
nkeynes@545
   397
nkeynes@545
   398
.