Show
Ignore:
Timestamp:
05/17/07 18:27:45 (18 months ago)
Author:
krobillard
Message:

Thune - OpenGL version works in thread_safe branch.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • branches/thune/thread_safe/gl/draw_list.c

    r383 r390  
    283283   The pen is moved to the end of text. 
    284284*/ 
    285 void gr_drawText( const char* it, const char* end ) 
     285void gr_drawText( UThread* ut, const char* it, const char* end ) 
    286286{ 
    287287    GLfloat x, y; 
     
    328328 
    329329 
    330 void gr_drawTextCell( UThread* ur_thread, UCell* cell ) 
     330void gr_drawTextCell( UThread* ut, UCell* cell ) 
    331331{ 
    332332    char* cpA; 
    333333    char* cpB; 
    334334 
    335     if( ur_stringSlice( cell, &cpA, &cpB ) ) 
    336     { 
    337         gr_drawText( cpA, cpB ); 
     335    if( ur_stringSlice( ut, cell, &cpA, &cpB ) ) 
     336    { 
     337        gr_drawText( ut, cpA, cpB ); 
    338338    } 
    339339    else 
    340340    { 
    341         UString* str; 
    342         str = ur_binPtr( ur_thread->callTempBinN ); 
     341        UString* str = ur_threadTmp( ut ); 
    343342        str->used = 0; 
    344343        ur_toStr( cell, str, 0 ); 
    345         gr_drawText( str->ptr.c, str->ptr.c + str->used ); 
     344        gr_drawText( ut, str->ptr.c, str->ptr.c + str->used ); 
    346345    } 
    347346} 
     
    375374 
    376375 
    377 static void dop_camera( UCell* ctx ) 
     376static void dop_camera( UThread* ut, UCell* ctx ) 
    378377{ 
    379378    double w, h; 
     
    466465 
    467466 
    468 static void dop_light( UThread* ur_thread, UCell* val, int light ) 
     467static void dop_light( UThread* ut, UCell* val, int light ) 
    469468{ 
    470469    if( ur_is(val, UT_LOGIC) ) 
     
    497496 
    498497                    default: 
    499                         val = ur_wordCell( ur_thread, it ); 
     498                        val = ur_wordCell( ut, it ); 
    500499                        if( val ) 
    501500                        { 
     
    532531   Camera must be set up for light before calling shadow-begin. 
    533532*/ 
    534 static void dop_shadow_begin( /*UThread* ur_thread,*/ UCell* fbCell ) 
     533static void dop_shadow_begin( /*UThread* ut,*/ UCell* fbCell ) 
    535534{ 
    536535    // Save matrices for shadow-end. 
     
    604603  Returns pc at last argument or zero if arguments are bad. 
    605604*/ 
    606 static UCell* dop_attrib( UThread* ur_thread, UCell* pc ) 
     605static UCell* dop_attrib( UThread* ut, UCell* pc ) 
    607606{ 
    608607    GrVertexAttribute* attr; 
     
    614613    if( ur_is(pc, UT_SELECT) ) 
    615614    { 
    616         UCell* val = ur_wordCell( ur_thread, pc ); 
     615        UCell* val = ur_wordCell( ut, pc ); 
    617616        if( ! val ) 
    618617            return 0; 
     
    673672   icell is an int array! 
    674673*/ 
    675 static void _drawPrims( UCell* icell, const char* key ) 
     674static void _drawPrims( UThread* ut, UCell* icell, const char* key ) 
    676675{ 
    677676    //GLdouble vec[3]; 
     
    771770#define VAL_WORD_OR_PC \ 
    772771    if( ur_is(pc, UT_WORD) ) { \ 
    773         val = ur_wordCell( ur_thread, pc ); \ 
     772        val = ur_wordCell( ut, pc ); \ 
    774773        if( ! val ) return 0; \ 
    775774    } \ 
     
    779778   Returns zero if an error occurred. 
    780779*/ 
    781 static int _runDrawList( UThread* ur_thread, UCell* val ) 
     780static int _runDrawList( UThread* ut, UCell* val ) 
    782781{ 
    783782    UBlock* blk = ur_blockPtr( val->series.n ); 
     
    811810                        glCallList( ur_dlGL(val) ); 
    812811                    } 
    813                     else if( ! _runDrawList( ur_thread, val ) ) 
     812                    else if( ! _runDrawList( ut, val ) ) 
    814813                        return 0; 
    815814                } 
     
    867866                VAL_WORD_OR_PC 
    868867                if( ur_is(val, UT_CONTEXT) ) 
    869                     dop_camera( val ); 
     868                    dop_camera( ut, val ); 
    870869            } 
    871870                break; 
     
    877876                ++pc; 
    878877                VAL_WORD_OR_PC 
    879                 dop_light( ur_thread, val, GL_LIGHT0 + light ); 
     878                dop_light( ut, val, GL_LIGHT0 + light ); 
    880879            } 
    881880                break; 
     
    946945 
    947946            case DOP_ATTRIB: 
    948                 pc = dop_attrib( ur_thread, pc ); 
     947                pc = dop_attrib( ut, pc ); 
    949948                if( ! pc ) 
    950949                    return 0; 
     
    965964                { 
    966965                    glBegin( _primBegin[ ur_opcode(pc-2) - DOP_POINTS ] ); 
    967                     _drawPrims( pc, ur_atomCStr( ur_atom(pc-1), 0 ) ); 
     966                    _drawPrims( ut, pc, ur_atomCStr( ur_atom(pc-1), 0 ) ); 
    968967                    glEnd(); 
    969968                } 
     
    10471046                    VAL_WORD_OR_PC 
    10481047                } 
    1049                 gr_drawTextCell( ur_thread, val ); 
     1048                gr_drawTextCell( ut, val ); 
    10501049                break; 
    10511050 
     
    10531052                ++pc; 
    10541053                VAL_WORD_OR_PC 
    1055                 loadShader( val ); 
     1054                loadShader( ut, val ); 
    10561055                break; 
    10571056 
     
    10691068                VAL_WORD_OR_PC 
    10701069                if( ur_is(val, UT_FBO) ) 
    1071                     dop_shadow_begin( /*ur_thread,*/ val ); 
     1070                    dop_shadow_begin( /*ut,*/ val ); 
    10721071                break; 
    10731072 
     
    10971096    UCell* res = ur_s_prev(tos); 
    10981097 
    1099     ops = ur_resolveArgPath( UT_WORD, UR_ATOM_DRAW_LIST_OPCODES, UT_NONE );  
     1098    ops = ur_resolvePath( ut, UR_ATOM_DRAW_LIST_OPCODES, UT_NONE );  
    11001099    if( ! ops ) 
    11011100    { 
     
    11061105    if( ur_is(tos, UT_BLOCK) ) 
    11071106    { 
    1108         ur_infuse( ur_thread, ur_block(tos), ops ); 
     1107        ur_infuse( ut, ur_block(tos), ops ); 
    11091108 
    11101109        ur_initType(res, UT_DRAWLIST); 
     
    11171116        int pool; 
    11181117 
    1119         ur_infuse( ur_thread, ur_block(tos), ops ); 
     1118        ur_infuse( ut, ur_block(tos), ops ); 
    11201119 
    11211120        ur_initType(res, UT_DRAWLIST); 
     
    11301129        glNewList( ur_dlGL(res), GL_COMPILE ); 
    11311130 
    1132         if( ! _runDrawList( ur_thread, tos ) ) 
     1131        if( ! _runDrawList( ut, tos ) ) 
    11331132        { 
    11341133            ur_throwErr( UR_ERR_SCRIPT, "runDrawList failed" ); 
     
    11601159            glCallList( ur_dlGL(tos) ); 
    11611160        else 
    1162             _runDrawList( ur_thread, tos ); 
     1161            _runDrawList( ut, tos ); 
    11631162    } 
    11641163    UR_S_DROP;