Search
lxdream.org :: lxdream/src/drivers/gl_fbo.c
lxdream 0.9.1
released Jun 29
Download Now
filename src/drivers/gl_fbo.c
changeset 1076:18c164e8aec4
prev877:8331f4aa3616
next1141:dc60a0987db9
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@352
     1
/**
nkeynes@561
     2
 * $Id$
nkeynes@352
     3
 *
nkeynes@352
     4
 * GL framebuffer-based driver shell. This requires the EXT_framebuffer_object
nkeynes@352
     5
 * extension, but is much nicer/faster/etc than pbuffers when it's available.
nkeynes@352
     6
 * This is (optionally) used indirectly by the top-level GLX driver.
nkeynes@352
     7
 *
nkeynes@352
     8
 * Strategy-wise, we maintain 2 framebuffers with up to 4 target colour
nkeynes@352
     9
 * buffers a piece. Effectively this reserves one fb for display output,
nkeynes@352
    10
 * and the other for texture output (each fb has a single size).
nkeynes@352
    11
 *
nkeynes@352
    12
 * Copyright (c) 2005 Nathan Keynes.
nkeynes@352
    13
 *
nkeynes@352
    14
 * This program is free software; you can redistribute it and/or modify
nkeynes@352
    15
 * it under the terms of the GNU General Public License as published by
nkeynes@352
    16
 * the Free Software Foundation; either version 2 of the License, or
nkeynes@352
    17
 * (at your option) any later version.
nkeynes@352
    18
 *
nkeynes@352
    19
 * This program is distributed in the hope that it will be useful,
nkeynes@352
    20
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
nkeynes@352
    21
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
nkeynes@352
    22
 * GNU General Public License for more details.
nkeynes@352
    23
 */
nkeynes@352
    24
nkeynes@424
    25
#define GL_GLEXT_PROTOTYPES 1
nkeynes@424
    26
nkeynes@477
    27
#include <stdlib.h>
nkeynes@477
    28
#include "lxdream.h"
nkeynes@352
    29
#include "display.h"
nkeynes@635
    30
#include "drivers/video_gl.h"
nkeynes@635
    31
#include "pvr2/glutil.h"
nkeynes@352
    32
nkeynes@656
    33
#ifdef HAVE_OPENGL_FBO
nkeynes@656
    34
nkeynes@352
    35
#define MAX_FRAMEBUFFERS 2
nkeynes@798
    36
#define MAX_TEXTURES_PER_FB 16
nkeynes@352
    37
nkeynes@805
    38
static render_buffer_t gl_fbo_create_render_buffer( uint32_t width, uint32_t height, GLuint tex_id );
nkeynes@352
    39
static void gl_fbo_destroy_render_buffer( render_buffer_t buffer );
nkeynes@352
    40
static gboolean gl_fbo_set_render_target( render_buffer_t buffer );
nkeynes@805
    41
static void gl_fbo_finish_render( render_buffer_t buffer );
nkeynes@669
    42
static void gl_fbo_display_render_buffer( render_buffer_t buffer );
nkeynes@477
    43
static void gl_fbo_load_frame_buffer( frame_buffer_t frame, render_buffer_t buffer );
nkeynes@669
    44
static void gl_fbo_display_blank( uint32_t colour );
nkeynes@477
    45
static gboolean gl_fbo_read_render_buffer( unsigned char *target, render_buffer_t buffer, int rowstride, int format );
nkeynes@352
    46
nkeynes@352
    47
extern uint32_t video_width, video_height;
nkeynes@352
    48
nkeynes@352
    49
/**
nkeynes@352
    50
 * Framebuffer info structure
nkeynes@352
    51
 */
nkeynes@352
    52
struct gl_fbo_info {
nkeynes@352
    53
    GLuint fb_id;
nkeynes@352
    54
    GLuint depth_id;
nkeynes@352
    55
    GLuint stencil_id;
nkeynes@352
    56
    GLuint tex_ids[MAX_TEXTURES_PER_FB];
nkeynes@352
    57
    int width, height;
nkeynes@352
    58
};
nkeynes@352
    59
nkeynes@798
    60
static GLint gl_fbo_max_attachments = 0;
nkeynes@863
    61
static gboolean gl_fbo_have_packed_stencil = FALSE;
nkeynes@352
    62
static struct gl_fbo_info fbo[MAX_FRAMEBUFFERS];
nkeynes@798
    63
nkeynes@798
    64
#define ATTACHMENT_POINT(n) (GL_COLOR_ATTACHMENT0_EXT+(n))
nkeynes@352
    65
static int last_used_fbo;
nkeynes@352
    66
nkeynes@352
    67
gboolean gl_fbo_is_supported()
nkeynes@352
    68
{
nkeynes@352
    69
    return isGLExtensionSupported("GL_EXT_framebuffer_object");
nkeynes@352
    70
}
nkeynes@352
    71
nkeynes@352
    72
/**
nkeynes@352
    73
 * Construct the initial frame buffers and allocate ids for everything.
nkeynes@352
    74
 * The render handling driver methods are set to the fbo versions.
nkeynes@352
    75
 */
nkeynes@352
    76
void gl_fbo_init( display_driver_t driver ) 
nkeynes@352
    77
{
nkeynes@352
    78
    int i,j;
nkeynes@424
    79
    GLuint fbids[MAX_FRAMEBUFFERS];
nkeynes@424
    80
    GLuint rbids[MAX_FRAMEBUFFERS*2]; /* depth buffer, stencil buffer per fb */
nkeynes@736
    81
nkeynes@798
    82
    glGetIntegerv(GL_MAX_COLOR_ATTACHMENTS_EXT, &gl_fbo_max_attachments);
nkeynes@424
    83
    glGenFramebuffersEXT( MAX_FRAMEBUFFERS, &fbids[0] );
nkeynes@424
    84
    glGenRenderbuffersEXT( MAX_FRAMEBUFFERS*2, &rbids[0] );
nkeynes@352
    85
    for( i=0; i<MAX_FRAMEBUFFERS; i++ ) {
nkeynes@736
    86
        fbo[i].fb_id = fbids[i];
nkeynes@736
    87
        fbo[i].depth_id = rbids[i*2];
nkeynes@736
    88
        fbo[i].stencil_id = rbids[i*2+1];
nkeynes@736
    89
        fbo[i].width = -1;
nkeynes@736
    90
        fbo[i].height = -1;
nkeynes@736
    91
        for( j=0; j<MAX_TEXTURES_PER_FB; j++ ) {
nkeynes@736
    92
            fbo[i].tex_ids[j] = -1;
nkeynes@736
    93
        }
nkeynes@352
    94
    }
nkeynes@352
    95
    last_used_fbo = 0;
nkeynes@352
    96
nkeynes@863
    97
    if( isGLExtensionSupported("GL_EXT_packed_depth_stencil" ) ) {
nkeynes@863
    98
        driver->capabilities.stencil_bits = 8;
nkeynes@863
    99
        gl_fbo_have_packed_stencil = TRUE;
nkeynes@863
   100
    } else {
nkeynes@863
   101
        driver->capabilities.stencil_bits = 0;
nkeynes@863
   102
        gl_fbo_have_packed_stencil = FALSE;
nkeynes@863
   103
        WARN( "Packed depth stencil not available - disabling shadow volumes" );
nkeynes@863
   104
    }
nkeynes@863
   105
nkeynes@352
   106
    driver->create_render_buffer = gl_fbo_create_render_buffer;
nkeynes@352
   107
    driver->destroy_render_buffer = gl_fbo_destroy_render_buffer;
nkeynes@352
   108
    driver->set_render_target = gl_fbo_set_render_target;
nkeynes@805
   109
    driver->finish_render = gl_fbo_finish_render;
nkeynes@352
   110
    driver->display_render_buffer = gl_fbo_display_render_buffer;
nkeynes@477
   111
    driver->load_frame_buffer = gl_fbo_load_frame_buffer;
nkeynes@352
   112
    driver->display_blank = gl_fbo_display_blank;
nkeynes@352
   113
    driver->read_render_buffer = gl_fbo_read_render_buffer;
nkeynes@445
   114
nkeynes@445
   115
    glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
nkeynes@352
   116
}
nkeynes@352
   117
nkeynes@352
   118
void gl_fbo_shutdown()
nkeynes@352
   119
{
nkeynes@352
   120
    int i;
nkeynes@352
   121
    glBindFramebufferEXT( GL_FRAMEBUFFER_EXT, 0 );
nkeynes@352
   122
    for( i=0; i<MAX_FRAMEBUFFERS; i++ ) {
nkeynes@736
   123
        glDeleteFramebuffersEXT( 1, &fbo[i].fb_id );
nkeynes@736
   124
        glDeleteRenderbuffersEXT( 2, &fbo[i].depth_id );
nkeynes@352
   125
    }
nkeynes@352
   126
}
nkeynes@352
   127
nkeynes@863
   128
static void gl_fbo_setup_framebuffer( int bufno, int width, int height )
nkeynes@352
   129
{
nkeynes@877
   130
    int i;
nkeynes@352
   131
    glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, fbo[bufno].fb_id);
nkeynes@877
   132
nkeynes@877
   133
    /* Clear out any existing texture attachments */
nkeynes@877
   134
    for( i=0; i<gl_fbo_max_attachments; i++ ) {
nkeynes@877
   135
        if( fbo[bufno].tex_ids[i] != -1 ) {
nkeynes@877
   136
            glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, ATTACHMENT_POINT(i),
nkeynes@877
   137
                    GL_TEXTURE_RECTANGLE_ARB, 0, 0);
nkeynes@877
   138
            fbo[bufno].tex_ids[i] = -1;
nkeynes@877
   139
        }
nkeynes@877
   140
    }
nkeynes@877
   141
nkeynes@877
   142
    /* Setup the renderbuffers */
nkeynes@863
   143
    if( gl_fbo_have_packed_stencil ) {
nkeynes@863
   144
        glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, fbo[bufno].depth_id);
nkeynes@863
   145
        glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT, GL_DEPTH24_STENCIL8_EXT, width, height);
nkeynes@863
   146
        glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT,
nkeynes@863
   147
                                     GL_RENDERBUFFER_EXT, fbo[bufno].depth_id);
nkeynes@863
   148
        glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, GL_STENCIL_ATTACHMENT_EXT,
nkeynes@863
   149
                                     GL_RENDERBUFFER_EXT, fbo[bufno].depth_id);
nkeynes@863
   150
    } else {
nkeynes@863
   151
        glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, fbo[bufno].depth_id);
nkeynes@863
   152
        glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT, GL_DEPTH_COMPONENT24, width, height);
nkeynes@863
   153
        glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT,
nkeynes@863
   154
                                     GL_RENDERBUFFER_EXT, fbo[bufno].depth_id);
nkeynes@863
   155
        /* In theory you could attach a separate stencil buffer. In practice this 
nkeynes@863
   156
         * isn't actually supported by any hardware I've had access to, so we're
nkeynes@863
   157
         * stencil-less.
nkeynes@863
   158
         */
nkeynes@863
   159
    }
nkeynes@352
   160
    fbo[bufno].width = width;
nkeynes@352
   161
    fbo[bufno].height = height;
nkeynes@352
   162
}
nkeynes@352
   163
nkeynes@863
   164
static int gl_fbo_get_framebuffer( int width, int height ) 
nkeynes@352
   165
{
nkeynes@352
   166
    int bufno = -1, i;
nkeynes@352
   167
    /* find a compatible framebuffer context */
nkeynes@352
   168
    for( i=0; i<MAX_FRAMEBUFFERS; i++ ) {
nkeynes@736
   169
        if( fbo[i].width == -1 && bufno == -1 ) {
nkeynes@736
   170
            bufno = i;
nkeynes@736
   171
        } else if( fbo[i].width == width && fbo[i].height == height ) {
nkeynes@736
   172
            bufno = i;
nkeynes@736
   173
            break;
nkeynes@736
   174
        }
nkeynes@352
   175
    }
nkeynes@352
   176
    if( bufno == -1 ) {
nkeynes@736
   177
        bufno = last_used_fbo + 1;
nkeynes@877
   178
        if( bufno >= MAX_FRAMEBUFFERS ) {
nkeynes@736
   179
            bufno = 0;
nkeynes@736
   180
        }
nkeynes@736
   181
        last_used_fbo = bufno;
nkeynes@352
   182
    }
nkeynes@352
   183
    if( fbo[bufno].width == width && fbo[bufno].height == height ) {
nkeynes@736
   184
        glBindFramebufferEXT( GL_FRAMEBUFFER_EXT, fbo[bufno].fb_id );
nkeynes@352
   185
    } else {
nkeynes@736
   186
        gl_fbo_setup_framebuffer( bufno, width, height );
nkeynes@352
   187
    } 
nkeynes@352
   188
    return bufno;
nkeynes@352
   189
}
nkeynes@352
   190
nkeynes@352
   191
/**
nkeynes@352
   192
 * Attach a texture to the framebuffer. The texture must already be initialized
nkeynes@352
   193
 * to the correct dimensions etc.
nkeynes@352
   194
 */
nkeynes@352
   195
static GLint gl_fbo_attach_texture( int fbo_no, GLint tex_id ) {
nkeynes@352
   196
    int attach = -1, i;
nkeynes@798
   197
    for( i=0; i<gl_fbo_max_attachments; i++ ) {
nkeynes@736
   198
        if( fbo[fbo_no].tex_ids[i] == tex_id ) {
nkeynes@798
   199
            glDrawBuffer(ATTACHMENT_POINT(i));
nkeynes@798
   200
            glReadBuffer(ATTACHMENT_POINT(i)); 
nkeynes@798
   201
            return ATTACHMENT_POINT(i); // already attached
nkeynes@736
   202
        } else if( fbo[fbo_no].tex_ids[i] == -1 && attach == -1 ) {
nkeynes@736
   203
            attach = i;
nkeynes@736
   204
        }
nkeynes@352
   205
    }
nkeynes@352
   206
    if( attach == -1 ) {
nkeynes@736
   207
        attach = 0;
nkeynes@352
   208
    }
nkeynes@352
   209
    fbo[fbo_no].tex_ids[attach] = tex_id;
nkeynes@352
   210
    glBindTexture( GL_TEXTURE_RECTANGLE_ARB, 0 ); // Ensure the output texture is unbound
nkeynes@798
   211
    glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, ATTACHMENT_POINT(attach), 
nkeynes@736
   212
                              GL_TEXTURE_RECTANGLE_ARB, tex_id, 0 );
nkeynes@352
   213
    /* Set draw/read buffers by default */
nkeynes@798
   214
    glDrawBuffer(ATTACHMENT_POINT(attach));
nkeynes@798
   215
    glReadBuffer(ATTACHMENT_POINT(attach)); 
nkeynes@352
   216
nkeynes@352
   217
nkeynes@352
   218
    GLint status = glGetError();
nkeynes@352
   219
    if( status != GL_NO_ERROR ) {
nkeynes@736
   220
        ERROR( "GL error setting render target (%x)!", status );
nkeynes@352
   221
    }
nkeynes@352
   222
    status = glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT);
nkeynes@352
   223
    if( status != GL_FRAMEBUFFER_COMPLETE_EXT ) {
nkeynes@736
   224
        ERROR( "Framebuffer failure: %x", status );
nkeynes@736
   225
        exit(1);
nkeynes@352
   226
    }
nkeynes@352
   227
nkeynes@798
   228
    return ATTACHMENT_POINT(attach);
nkeynes@352
   229
}
nkeynes@352
   230
nkeynes@805
   231
static render_buffer_t gl_fbo_create_render_buffer( uint32_t width, uint32_t height, GLuint tex_id )
nkeynes@352
   232
{
nkeynes@352
   233
    render_buffer_t buffer = calloc( sizeof(struct render_buffer), 1 );
nkeynes@352
   234
    buffer->width = width;
nkeynes@352
   235
    buffer->height = height;
nkeynes@805
   236
    buffer->tex_id = tex_id;
nkeynes@805
   237
    if( tex_id == 0 ) {
nkeynes@805
   238
        GLuint tex;
nkeynes@805
   239
        glGenTextures( 1, &tex );
nkeynes@805
   240
        buffer->buf_id = tex;
nkeynes@805
   241
    } else {
nkeynes@805
   242
        buffer->buf_id = tex_id;
nkeynes@805
   243
        glBindTexture( GL_TEXTURE_RECTANGLE_ARB, tex_id );
nkeynes@805
   244
    }
nkeynes@868
   245
    glBindTexture( GL_TEXTURE_RECTANGLE_ARB, buffer->buf_id );
nkeynes@868
   246
    glTexImage2D( GL_TEXTURE_RECTANGLE_ARB, 0, GL_RGBA, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL );
nkeynes@352
   247
    glTexParameteri( GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_WRAP_S, GL_CLAMP );
nkeynes@352
   248
    glTexParameteri( GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_WRAP_T, GL_CLAMP );
nkeynes@352
   249
    glTexParameteri( GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_MIN_FILTER, GL_NEAREST );
nkeynes@352
   250
    glTexParameteri( GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_MAG_FILTER, GL_NEAREST );
nkeynes@352
   251
    return buffer;
nkeynes@352
   252
}
nkeynes@352
   253
nkeynes@805
   254
/**
nkeynes@805
   255
 * Ensure the texture in the given render buffer is not attached to a 
nkeynes@805
   256
 * framebuffer (ie, so we can safely use it as a texture during the rendering
nkeynes@805
   257
 * cycle, or before deletion).
nkeynes@805
   258
 */
nkeynes@805
   259
static void gl_fbo_detach_render_buffer( render_buffer_t buffer )
nkeynes@805
   260
{
nkeynes@805
   261
    int i,j;
nkeynes@805
   262
    for( i=0; i<MAX_FRAMEBUFFERS; i++ ) {
nkeynes@805
   263
        if( fbo[i].width == buffer->width && fbo[i].height == buffer->height ) {
nkeynes@805
   264
            for( j=0; j<gl_fbo_max_attachments; j++ ) {
nkeynes@805
   265
                if( fbo[i].tex_ids[j] == buffer->buf_id ) {
nkeynes@805
   266
                    glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, fbo[i].fb_id);
nkeynes@805
   267
                    glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, ATTACHMENT_POINT(j), 
nkeynes@805
   268
                                              GL_TEXTURE_RECTANGLE_ARB, GL_NONE, 0 );
nkeynes@805
   269
                    fbo[i].tex_ids[j] = -1;
nkeynes@805
   270
                    return;
nkeynes@805
   271
                }                    
nkeynes@805
   272
            }
nkeynes@805
   273
            break;
nkeynes@805
   274
        }
nkeynes@805
   275
    }
nkeynes@805
   276
}
nkeynes@805
   277
nkeynes@352
   278
static void gl_fbo_destroy_render_buffer( render_buffer_t buffer )
nkeynes@352
   279
{
nkeynes@352
   280
    int i,j;
nkeynes@805
   281
nkeynes@805
   282
    gl_fbo_detach_render_buffer( buffer );
nkeynes@805
   283
nkeynes@805
   284
    if( buffer->buf_id != buffer->tex_id ) {
nkeynes@805
   285
        // If tex_id was set at buffer creation, we don't own the texture.
nkeynes@805
   286
        // Otherwise, delete it now.
nkeynes@805
   287
        GLuint tex = buffer->buf_id; 
nkeynes@805
   288
        glDeleteTextures( 1, &tex );
nkeynes@352
   289
    }
nkeynes@352
   290
    buffer->buf_id = 0;
nkeynes@805
   291
    buffer->tex_id = 0;
nkeynes@352
   292
    free( buffer );
nkeynes@352
   293
}
nkeynes@352
   294
nkeynes@352
   295
static gboolean gl_fbo_set_render_target( render_buffer_t buffer )
nkeynes@352
   296
{
nkeynes@477
   297
    glFinish();
nkeynes@352
   298
    glGetError();
nkeynes@352
   299
    int fb = gl_fbo_get_framebuffer( buffer->width, buffer->height );
nkeynes@424
   300
    gl_fbo_attach_texture( fb, buffer->buf_id );
nkeynes@352
   301
    /* setup the gl context */
nkeynes@352
   302
    glViewport( 0, 0, buffer->width, buffer->height );
nkeynes@736
   303
nkeynes@352
   304
    return TRUE;
nkeynes@352
   305
}
nkeynes@352
   306
nkeynes@805
   307
static void gl_fbo_finish_render( render_buffer_t buffer )
nkeynes@805
   308
{
nkeynes@805
   309
    glFinish();
nkeynes@805
   310
    glGetError();
nkeynes@805
   311
    gl_fbo_detach_render_buffer(buffer);
nkeynes@805
   312
}
nkeynes@805
   313
nkeynes@352
   314
/**
nkeynes@352
   315
 * Render the texture holding the given buffer to the front window
nkeynes@352
   316
 * buffer.
nkeynes@352
   317
 */
nkeynes@669
   318
static void gl_fbo_display_render_buffer( render_buffer_t buffer )
nkeynes@352
   319
{
nkeynes@352
   320
    glFinish();
nkeynes@477
   321
    gl_fbo_detach();
nkeynes@477
   322
    gl_display_render_buffer( buffer );
nkeynes@352
   323
}
nkeynes@352
   324
nkeynes@477
   325
static void gl_fbo_load_frame_buffer( frame_buffer_t frame, render_buffer_t buffer )
nkeynes@477
   326
{
nkeynes@477
   327
    glFinish();
nkeynes@477
   328
    gl_fbo_detach();
nkeynes@545
   329
    gl_load_frame_buffer( frame, buffer->buf_id );
nkeynes@477
   330
}
nkeynes@477
   331
nkeynes@669
   332
static void gl_fbo_display_blank( uint32_t colour )
nkeynes@477
   333
{
nkeynes@477
   334
    glFinish();
nkeynes@477
   335
    gl_fbo_detach();
nkeynes@669
   336
    gl_display_blank( colour );
nkeynes@477
   337
}
nkeynes@477
   338
nkeynes@477
   339
void gl_fbo_detach()
nkeynes@352
   340
{
nkeynes@352
   341
    glBindFramebufferEXT( GL_FRAMEBUFFER_EXT, 0 );
nkeynes@1076
   342
    /* Make sure texture attachment is not a current draw/read buffer */
nkeynes@352
   343
    glDrawBuffer( GL_FRONT );
nkeynes@352
   344
    glReadBuffer( GL_FRONT );
nkeynes@477
   345
}    
nkeynes@352
   346
nkeynes@477
   347
static gboolean gl_fbo_read_render_buffer( unsigned char *target, render_buffer_t buffer, 
nkeynes@736
   348
                                           int rowstride, int format )
nkeynes@352
   349
{
nkeynes@857
   350
    glGetError();
nkeynes@352
   351
    int fb = gl_fbo_get_framebuffer( buffer->width, buffer->height );
nkeynes@424
   352
    gl_fbo_attach_texture( fb, buffer->buf_id );
nkeynes@477
   353
    return gl_read_render_buffer( target, buffer, rowstride, format );
nkeynes@352
   354
}
nkeynes@352
   355
nkeynes@656
   356
#else
nkeynes@656
   357
gboolean gl_fbo_is_supported()
nkeynes@656
   358
{
nkeynes@656
   359
    return FALSE;
nkeynes@656
   360
}
nkeynes@656
   361
nkeynes@656
   362
void gl_fbo_init( display_driver_t driver ) 
nkeynes@656
   363
{
nkeynes@656
   364
}
nkeynes@656
   365
nkeynes@656
   366
#endif
.