Search
lxdream.org :: lxdream/src/pvr2/glrender.c
lxdream 0.9.1
released Jun 29
Download Now
filename src/pvr2/glrender.c
changeset 856:02ac5f37bfc9
prev847:2089244671d2
next863:a5e5310061e2
author nkeynes
date Thu Sep 11 22:51:24 2008 +0000 (11 years ago)
permissions -rw-r--r--
last change Completely untested render-to-texture work in progress
file annotate diff log raw
nkeynes@653
     1
/**
nkeynes@653
     2
 * $Id$
nkeynes@653
     3
 *
nkeynes@653
     4
 * Standard OpenGL rendering engine. 
nkeynes@653
     5
 *
nkeynes@653
     6
 * Copyright (c) 2005 Nathan Keynes.
nkeynes@653
     7
 *
nkeynes@653
     8
 * This program is free software; you can redistribute it and/or modify
nkeynes@653
     9
 * it under the terms of the GNU General Public License as published by
nkeynes@653
    10
 * the Free Software Foundation; either version 2 of the License, or
nkeynes@653
    11
 * (at your option) any later version.
nkeynes@653
    12
 *
nkeynes@653
    13
 * This program is distributed in the hope that it will be useful,
nkeynes@653
    14
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
nkeynes@653
    15
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
nkeynes@653
    16
 * GNU General Public License for more details.
nkeynes@653
    17
 */
nkeynes@653
    18
nkeynes@653
    19
#include <assert.h>
nkeynes@669
    20
#include <sys/time.h>
nkeynes@653
    21
#include "display.h"
nkeynes@653
    22
#include "pvr2/pvr2.h"
nkeynes@677
    23
#include "pvr2/pvr2mmio.h"
nkeynes@653
    24
#include "pvr2/scene.h"
nkeynes@665
    25
#include "pvr2/glutil.h"
nkeynes@653
    26
nkeynes@653
    27
int pvr2_poly_depthmode[8] = { GL_NEVER, GL_LESS, GL_EQUAL, GL_LEQUAL,
nkeynes@736
    28
        GL_GREATER, GL_NOTEQUAL, GL_GEQUAL, 
nkeynes@736
    29
        GL_ALWAYS };
nkeynes@653
    30
int pvr2_poly_srcblend[8] = { 
nkeynes@736
    31
        GL_ZERO, GL_ONE, GL_DST_COLOR, GL_ONE_MINUS_DST_COLOR,
nkeynes@736
    32
        GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_DST_ALPHA, 
nkeynes@736
    33
        GL_ONE_MINUS_DST_ALPHA };
nkeynes@653
    34
int pvr2_poly_dstblend[8] = {
nkeynes@736
    35
        GL_ZERO, GL_ONE, GL_SRC_COLOR, GL_ONE_MINUS_SRC_COLOR,
nkeynes@736
    36
        GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_DST_ALPHA,
nkeynes@736
    37
        GL_ONE_MINUS_DST_ALPHA };
nkeynes@653
    38
int pvr2_poly_texblend[4] = {
nkeynes@736
    39
        GL_REPLACE, 
nkeynes@736
    40
        GL_MODULATE,  
nkeynes@736
    41
        GL_DECAL, 
nkeynes@736
    42
        GL_MODULATE 
nkeynes@653
    43
};
nkeynes@653
    44
nkeynes@653
    45
/**
nkeynes@653
    46
 * Clip the tile bounds to the clipping plane. 
nkeynes@653
    47
 * @return TRUE if the tile was not clipped completely.
nkeynes@653
    48
 */
nkeynes@653
    49
static gboolean clip_tile_bounds( uint32_t *tile, float *clip )
nkeynes@653
    50
{
nkeynes@653
    51
    if( tile[0] < clip[0] ) tile[0] = clip[0];
nkeynes@653
    52
    if( tile[1] > clip[1] ) tile[1] = clip[1];
nkeynes@653
    53
    if( tile[2] < clip[2] ) tile[2] = clip[2];
nkeynes@653
    54
    if( tile[3] > clip[3] ) tile[3] = clip[3];
nkeynes@653
    55
    return tile[0] < tile[1] && tile[2] < tile[3];
nkeynes@653
    56
}
nkeynes@653
    57
nkeynes@653
    58
void pvr2_scene_load_textures()
nkeynes@653
    59
{
nkeynes@653
    60
    int i;
nkeynes@653
    61
    for( i=0; i < pvr2_scene.poly_count; i++ ) {
nkeynes@736
    62
        struct polygon_struct *poly = &pvr2_scene.poly_array[i];
nkeynes@736
    63
        if( POLY1_TEXTURED(poly->context[0]) ) {
nkeynes@736
    64
            poly->tex_id = texcache_get_texture( poly->context[2],
nkeynes@736
    65
                    POLY2_TEX_WIDTH(poly->context[1]),
nkeynes@736
    66
                    POLY2_TEX_HEIGHT(poly->context[1]) );
nkeynes@736
    67
            if( poly->mod_vertex_index != -1 ) {
nkeynes@736
    68
                poly->mod_tex_id = texcache_get_texture( poly->context[4],
nkeynes@736
    69
                        POLY2_TEX_WIDTH(poly->context[3]),
nkeynes@736
    70
                        POLY2_TEX_HEIGHT(poly->context[3]) );
nkeynes@736
    71
            }
nkeynes@736
    72
        } else {
nkeynes@736
    73
            poly->tex_id = -1;
nkeynes@736
    74
            poly->mod_tex_id = -1;
nkeynes@736
    75
        }
nkeynes@653
    76
    }
nkeynes@653
    77
}
nkeynes@653
    78
nkeynes@653
    79
nkeynes@653
    80
nkeynes@653
    81
/**
nkeynes@653
    82
 * Once-off call to setup the OpenGL context.
nkeynes@653
    83
 */
nkeynes@653
    84
void pvr2_setup_gl_context()
nkeynes@653
    85
{
nkeynes@665
    86
nkeynes@665
    87
    if( glsl_is_supported() ) {
nkeynes@736
    88
        if( !glsl_load_shaders( glsl_vertex_shader_src, NULL ) ) {
nkeynes@665
    89
            WARN( "Unable to load GL shaders" );
nkeynes@665
    90
        }
nkeynes@665
    91
    }
nkeynes@736
    92
nkeynes@653
    93
    texcache_gl_init(); // Allocate texture IDs
nkeynes@653
    94
    glCullFace( GL_BACK );
nkeynes@653
    95
    glEnable( GL_BLEND );
nkeynes@653
    96
    glEnable( GL_DEPTH_TEST );
nkeynes@653
    97
    glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);
nkeynes@653
    98
    glMatrixMode(GL_MODELVIEW);
nkeynes@653
    99
    glLoadIdentity();
nkeynes@736
   100
nkeynes@687
   101
#ifdef HAVE_OPENGL_CLAMP_COLOR
nkeynes@687
   102
    if( isGLExtensionSupported("GL_ARB_color_buffer_float") ) {
nkeynes@687
   103
        glClampColorARB(GL_CLAMP_VERTEX_COLOR_ARB, GL_FALSE );
nkeynes@687
   104
        glClampColorARB(GL_CLAMP_FRAGMENT_COLOR_ARB, GL_FALSE );
nkeynes@687
   105
    }
nkeynes@687
   106
#endif
nkeynes@653
   107
nkeynes@653
   108
    glEnableClientState( GL_COLOR_ARRAY );
nkeynes@653
   109
    glEnableClientState( GL_VERTEX_ARRAY );
nkeynes@653
   110
    glEnableClientState( GL_TEXTURE_COORD_ARRAY );
nkeynes@653
   111
    glEnableClientState( GL_SECONDARY_COLOR_ARRAY );
nkeynes@847
   112
    glEnableClientState( GL_FOG_COORDINATE_ARRAY_EXT );
nkeynes@653
   113
nkeynes@653
   114
    glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
nkeynes@653
   115
    glClearDepth(0);
nkeynes@653
   116
    glClearStencil(0);
nkeynes@653
   117
}
nkeynes@653
   118
nkeynes@653
   119
/**
nkeynes@653
   120
 * Setup the GL context for the supplied polygon context.
nkeynes@653
   121
 * @param context pointer to 3 or 5 words of polygon context
nkeynes@653
   122
 * @param modified boolean flag indicating that the modified
nkeynes@653
   123
 *  version should be used, rather than the normal version.
nkeynes@653
   124
 */
nkeynes@653
   125
void render_set_context( uint32_t *context, int render_mode )
nkeynes@653
   126
{
nkeynes@653
   127
    uint32_t poly1 = context[0], poly2, texture;
nkeynes@653
   128
    if( render_mode == RENDER_FULLMOD ) {
nkeynes@736
   129
        poly2 = context[3];
nkeynes@736
   130
        texture = context[4];
nkeynes@653
   131
    } else {
nkeynes@736
   132
        poly2 = context[1];
nkeynes@736
   133
        texture = context[2];
nkeynes@653
   134
    }
nkeynes@736
   135
nkeynes@653
   136
    glDepthFunc( POLY1_DEPTH_MODE(poly1) );
nkeynes@653
   137
    glDepthMask( POLY1_DEPTH_WRITE(poly1) ? GL_TRUE : GL_FALSE );
nkeynes@736
   138
nkeynes@653
   139
    switch( POLY1_CULL_MODE(poly1) ) {
nkeynes@653
   140
    case CULL_NONE:
nkeynes@653
   141
    case CULL_SMALL:
nkeynes@736
   142
        glDisable( GL_CULL_FACE );
nkeynes@736
   143
        break;
nkeynes@653
   144
    case CULL_CCW:
nkeynes@736
   145
        glEnable( GL_CULL_FACE );
nkeynes@736
   146
        glFrontFace( GL_CW );
nkeynes@736
   147
        break;
nkeynes@653
   148
    case CULL_CW:
nkeynes@736
   149
        glEnable( GL_CULL_FACE );
nkeynes@736
   150
        glFrontFace( GL_CCW );
nkeynes@736
   151
        break;
nkeynes@653
   152
    }
nkeynes@653
   153
nkeynes@653
   154
    if( POLY1_SPECULAR(poly1) ) {
nkeynes@736
   155
        glEnable(GL_COLOR_SUM);
nkeynes@653
   156
    } else {
nkeynes@736
   157
        glDisable(GL_COLOR_SUM);
nkeynes@653
   158
    }
nkeynes@653
   159
nkeynes@653
   160
nkeynes@653
   161
    if( POLY1_TEXTURED(poly1) ) {
nkeynes@736
   162
        glEnable(GL_TEXTURE_2D);
nkeynes@736
   163
        glTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, pvr2_poly_texblend[POLY2_TEX_BLEND(poly2)] );
nkeynes@736
   164
        if( POLY2_TEX_CLAMP_U(poly2) ) {
nkeynes@736
   165
            glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP );
nkeynes@736
   166
        } else if( POLY2_TEX_MIRROR_U(poly2) ) {
nkeynes@736
   167
            glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_MIRRORED_REPEAT_ARB );
nkeynes@736
   168
        } else {
nkeynes@736
   169
            glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT );
nkeynes@736
   170
        }	    
nkeynes@736
   171
        if( POLY2_TEX_CLAMP_V(poly2) ) {
nkeynes@736
   172
            glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP );
nkeynes@736
   173
        } else if( POLY2_TEX_MIRROR_V(poly2) ) {
nkeynes@736
   174
            glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_MIRRORED_REPEAT_ARB );
nkeynes@736
   175
        } else {
nkeynes@736
   176
            glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT );
nkeynes@736
   177
        }
nkeynes@653
   178
    } else {
nkeynes@736
   179
        glDisable( GL_TEXTURE_2D );
nkeynes@653
   180
    }
nkeynes@847
   181
    
nkeynes@847
   182
    switch( POLY2_FOG_MODE(poly2) ) {
nkeynes@847
   183
    case PVR2_POLY_FOG_LOOKUP:
nkeynes@847
   184
        glFogfv( GL_FOG_COLOR, pvr2_scene.fog_lut_colour );
nkeynes@847
   185
        glEnable( GL_FOG );
nkeynes@847
   186
        break;
nkeynes@847
   187
    case PVR2_POLY_FOG_VERTEX:
nkeynes@847
   188
        if( POLY1_SPECULAR(poly1) ) {
nkeynes@847
   189
            glFogfv( GL_FOG_COLOR, pvr2_scene.fog_vert_colour );
nkeynes@847
   190
            glEnable( GL_FOG );
nkeynes@847
   191
            break;
nkeynes@847
   192
        } /* else fallthrough */
nkeynes@847
   193
    default:
nkeynes@847
   194
        glDisable( GL_FOG );
nkeynes@847
   195
    }
nkeynes@847
   196
        
nkeynes@653
   197
nkeynes@653
   198
    glShadeModel( POLY1_SHADE_MODEL(poly1) );
nkeynes@653
   199
nkeynes@653
   200
    int srcblend = POLY2_SRC_BLEND(poly2);
nkeynes@653
   201
    int destblend = POLY2_DEST_BLEND(poly2);
nkeynes@653
   202
    glBlendFunc( srcblend, destblend );
nkeynes@653
   203
nkeynes@653
   204
    if( POLY2_SRC_BLEND_TARGET(poly2) || POLY2_DEST_BLEND_TARGET(poly2) ) {
nkeynes@736
   205
        ERROR( "Accumulation buffer not supported" );
nkeynes@653
   206
    }
nkeynes@653
   207
nkeynes@653
   208
}
nkeynes@653
   209
nkeynes@653
   210
nkeynes@653
   211
static void gl_render_poly( struct polygon_struct *poly )
nkeynes@653
   212
{
nkeynes@653
   213
    if( poly->tex_id != -1 ) {
nkeynes@736
   214
        glBindTexture(GL_TEXTURE_2D, poly->tex_id);
nkeynes@653
   215
    }
nkeynes@653
   216
    render_set_context( poly->context, RENDER_NORMAL );
nkeynes@653
   217
    glDrawArrays(GL_TRIANGLE_STRIP, poly->vertex_index, poly->vertex_count );
nkeynes@653
   218
}
nkeynes@653
   219
nkeynes@687
   220
nkeynes@687
   221
static void gl_render_bkgnd( struct polygon_struct *poly )
nkeynes@687
   222
{
nkeynes@687
   223
    if( poly->tex_id != -1 ) {
nkeynes@687
   224
        glBindTexture(GL_TEXTURE_2D, poly->tex_id);
nkeynes@687
   225
    }
nkeynes@687
   226
    render_set_context( poly->context, RENDER_NORMAL );
nkeynes@687
   227
    glDisable( GL_DEPTH_TEST );
nkeynes@687
   228
    glDisable( GL_CULL_FACE );
nkeynes@687
   229
    glBlendFunc( GL_ONE, GL_ZERO );
nkeynes@687
   230
    glDrawArrays(GL_TRIANGLE_STRIP, poly->vertex_index, poly->vertex_count );
nkeynes@687
   231
    glEnable( GL_CULL_FACE );
nkeynes@687
   232
    glEnable( GL_DEPTH_TEST );
nkeynes@687
   233
}
nkeynes@687
   234
nkeynes@687
   235
nkeynes@687
   236
nkeynes@653
   237
void gl_render_tilelist( pvraddr_t tile_entry )
nkeynes@653
   238
{
nkeynes@653
   239
    uint32_t *tile_list = (uint32_t *)(video_base+tile_entry);
nkeynes@653
   240
    int strip_count;
nkeynes@653
   241
    struct polygon_struct *poly;
nkeynes@653
   242
nkeynes@653
   243
    while(1) {
nkeynes@736
   244
        uint32_t entry = *tile_list++;
nkeynes@736
   245
        switch( entry >> 28 ) {
nkeynes@736
   246
        case 0x0F:
nkeynes@736
   247
            return; // End-of-list
nkeynes@736
   248
        case 0x0E:
nkeynes@736
   249
            tile_list = (uint32_t *)(video_base + (entry&0x007FFFFF));
nkeynes@736
   250
            break;
nkeynes@736
   251
        case 0x08: case 0x09: case 0x0A: case 0x0B:
nkeynes@736
   252
            strip_count = ((entry >> 25) & 0x0F)+1;
nkeynes@736
   253
            poly = pvr2_scene.buf_to_poly_map[entry&0x000FFFFF];
nkeynes@736
   254
            while( strip_count > 0 ) {
nkeynes@736
   255
                assert( poly != NULL );
nkeynes@736
   256
                gl_render_poly( poly );
nkeynes@736
   257
                poly = poly->next;
nkeynes@736
   258
                strip_count--;
nkeynes@736
   259
            }
nkeynes@736
   260
            break;
nkeynes@736
   261
        default:
nkeynes@736
   262
            if( entry & 0x7E000000 ) {
nkeynes@736
   263
                poly = pvr2_scene.buf_to_poly_map[entry&0x000FFFFF];
nkeynes@736
   264
                gl_render_poly( poly );
nkeynes@736
   265
            }
nkeynes@736
   266
        }
nkeynes@653
   267
    }	    
nkeynes@653
   268
}
nkeynes@653
   269
nkeynes@653
   270
nkeynes@653
   271
/**
nkeynes@653
   272
 * Render the currently defined scene in pvr2_scene
nkeynes@653
   273
 */
nkeynes@653
   274
void pvr2_scene_render( render_buffer_t buffer )
nkeynes@653
   275
{
nkeynes@653
   276
    /* Scene setup */
nkeynes@653
   277
    struct timeval start_tv, tex_tv, end_tv;
nkeynes@653
   278
nkeynes@653
   279
    gettimeofday(&start_tv, NULL);
nkeynes@653
   280
    display_driver->set_render_target(buffer);
nkeynes@653
   281
    pvr2_check_palette_changed();
nkeynes@653
   282
    pvr2_scene_load_textures();
nkeynes@736
   283
nkeynes@653
   284
    gettimeofday( &tex_tv, NULL );
nkeynes@653
   285
    uint32_t ms = (tex_tv.tv_sec - start_tv.tv_sec) * 1000 +
nkeynes@736
   286
    (tex_tv.tv_usec - start_tv.tv_usec)/1000;
nkeynes@653
   287
    DEBUG( "Scene setup in %dms", ms );
nkeynes@653
   288
nkeynes@653
   289
    /* Setup view projection matrix */
nkeynes@653
   290
    glMatrixMode(GL_PROJECTION);
nkeynes@653
   291
    glLoadIdentity();
nkeynes@653
   292
    float nearz = pvr2_scene.bounds[4];
nkeynes@653
   293
    float farz = pvr2_scene.bounds[5];
nkeynes@653
   294
    if( nearz == farz ) {
nkeynes@687
   295
        farz*= 4.0;
nkeynes@653
   296
    }
nkeynes@653
   297
    glOrtho( 0, pvr2_scene.buffer_width, pvr2_scene.buffer_height, 0, 
nkeynes@736
   298
             -farz, -nearz );
nkeynes@653
   299
    float alphaRef = ((float)(MMIO_READ(PVR2, RENDER_ALPHA_REF)&0xFF)+1)/256.0;
nkeynes@653
   300
    glAlphaFunc( GL_GEQUAL, alphaRef );
nkeynes@653
   301
nkeynes@653
   302
    /* Clear the buffer (FIXME: May not want always want to do this) */
nkeynes@653
   303
    glDisable( GL_SCISSOR_TEST );
nkeynes@653
   304
    glDepthMask( GL_TRUE );
nkeynes@653
   305
    glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT );
nkeynes@653
   306
nkeynes@653
   307
    /* Setup vertex array pointers */
nkeynes@687
   308
    glVertexPointer(3, GL_FLOAT, sizeof(struct vertex_struct), &pvr2_scene.vertex_array[0].x);
nkeynes@687
   309
    glColorPointer(4, GL_FLOAT, sizeof(struct vertex_struct), &pvr2_scene.vertex_array[0].rgba[0]);
nkeynes@687
   310
    glTexCoordPointer(2, GL_FLOAT, sizeof(struct vertex_struct), &pvr2_scene.vertex_array[0].u);
nkeynes@687
   311
    glSecondaryColorPointerEXT(3, GL_FLOAT, sizeof(struct vertex_struct), pvr2_scene.vertex_array[0].offset_rgba );
nkeynes@847
   312
    glFogCoordPointerEXT(GL_FLOAT, sizeof(struct vertex_struct), &pvr2_scene.vertex_array[0].offset_rgba[3] );
nkeynes@847
   313
    glFogi(GL_FOG_COORDINATE_SOURCE_EXT, GL_FOG_COORDINATE_EXT);
nkeynes@847
   314
    glFogi(GL_FOG_MODE, GL_LINEAR);
nkeynes@847
   315
    glFogf(GL_FOG_START, 0.0);
nkeynes@847
   316
    glFogf(GL_FOG_END, 1.0);
nkeynes@669
   317
    /* Turn on the shaders (if available) */
nkeynes@669
   318
    glsl_enable_shaders(TRUE);
nkeynes@669
   319
nkeynes@687
   320
    /* Render the background */
nkeynes@687
   321
    gl_render_bkgnd( pvr2_scene.bkgnd_poly );
nkeynes@736
   322
nkeynes@653
   323
    glEnable( GL_SCISSOR_TEST );
nkeynes@653
   324
nkeynes@653
   325
    /* Process the segment list */
nkeynes@653
   326
    struct tile_segment *segment = pvr2_scene.segment_list;
nkeynes@653
   327
    do {
nkeynes@736
   328
        int tilex = SEGMENT_X(segment->control);
nkeynes@736
   329
        int tiley = SEGMENT_Y(segment->control);
nkeynes@653
   330
nkeynes@736
   331
        uint32_t tile_bounds[4] = { tilex << 5, (tilex+1)<<5, tiley<<5, (tiley+1)<<5 };
nkeynes@736
   332
        if( !clip_tile_bounds(tile_bounds, pvr2_scene.bounds) ) {
nkeynes@736
   333
            continue; // fully clipped, skip tile
nkeynes@736
   334
        }
nkeynes@736
   335
nkeynes@736
   336
        /* Clip to the visible part of the tile */
nkeynes@736
   337
        glScissor( tile_bounds[0], pvr2_scene.buffer_height-tile_bounds[3], 
nkeynes@736
   338
                   tile_bounds[1]-tile_bounds[0], tile_bounds[3] - tile_bounds[2] );
nkeynes@736
   339
        if( IS_TILE_PTR(segment->opaque_ptr) ) {
nkeynes@736
   340
            gl_render_tilelist(segment->opaque_ptr);
nkeynes@736
   341
        }
nkeynes@736
   342
        if( IS_TILE_PTR(segment->trans_ptr) ) {
nkeynes@736
   343
            if( pvr2_scene.sort_mode == SORT_NEVER || 
nkeynes@736
   344
                    (pvr2_scene.sort_mode == SORT_TILEFLAG && (segment->control&SEGMENT_SORT_TRANS))) {
nkeynes@736
   345
                gl_render_tilelist(segment->trans_ptr);
nkeynes@736
   346
            } else {
nkeynes@736
   347
                render_autosort_tile(segment->trans_ptr, RENDER_NORMAL );
nkeynes@736
   348
            }
nkeynes@736
   349
        }
nkeynes@736
   350
        if( IS_TILE_PTR(segment->punchout_ptr) ) {
nkeynes@736
   351
            glEnable(GL_ALPHA_TEST );
nkeynes@736
   352
            render_autosort_tile(segment->punchout_ptr, RENDER_NORMAL );
nkeynes@736
   353
            glDisable(GL_ALPHA_TEST );
nkeynes@736
   354
        }
nkeynes@653
   355
    } while( !IS_LAST_SEGMENT(segment++) );
nkeynes@653
   356
    glDisable( GL_SCISSOR_TEST );
nkeynes@653
   357
nkeynes@669
   358
    glsl_enable_shaders(FALSE);
nkeynes@669
   359
nkeynes@653
   360
    gettimeofday( &end_tv, NULL );
nkeynes@653
   361
    ms = (end_tv.tv_sec - tex_tv.tv_sec) * 1000 +
nkeynes@736
   362
    (end_tv.tv_usec - tex_tv.tv_usec)/1000;
nkeynes@653
   363
    DEBUG( "Scene render in %dms", ms );
nkeynes@653
   364
}
.