Changeset 15

Show
Ignore:
Timestamp:
05/25/04 22:35:57 (4 years ago)
Author:
aldacron
Message:

* Initial checkin of DerelictGLU
* Cosmetic changes to DerelictGL

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/DerelictGL/Makefile

    r14 r15  
    2727clean: 
    2828    del $(OGL.OBJ.DIR)\*.obj 
    29     del $(OGL.SRC.DIR)\*.map 
    3029 
    3130cleanall: 
  • trunk/DerelictGL/derelict/opengl/gl.d

    r12 r15  
    99// WINDOWS 
    1010//============================================================================== 
    11 version(Win32
     11version(Windows
    1212{ 
    1313 
     
    115115{ 
    116116    FARPROC fp = GetProcAddress(hlib, name); 
    117     if(null == fp) 
     117    if(!fp) 
    118118    { 
    119119        char[] funcname = toString(name); 
     
    130130private void loadPlatformGL() 
    131131{ 
     132    if(hlib) 
     133        return; 
     134         
    132135    hlib = LoadLibraryA("opengl32.dll"); 
    133     if(null == hlib) 
     136    if(!hlib) 
    134137        throw new Exception("Failed to load opengl32.dll"); 
    135138 
     
    161164} 
    162165 
     166extern(Windows) 
     167{ 
    163168// WGL functions 
    164169typedef BOOL function(HGLRC,HGLRC) pfwglCopyContext; 
     
    194199pfwglUseFontBitmapsA        wglUseFontBitmaps; 
    195200pfwglUseFontOutlinesA       wglUseFontOutlines; 
    196  
    197 } // version(Win32) 
     201} // extern(Windows) 
     202 
     203} // version(Windows) 
    198204//------------------------------------------------------------------------------ 
    199205 
     
    201207// PLATFORM NEUTRAL 
    202208//============================================================================== 
     209 
     210/*! 
     211* Loads the shared lib and core GL 1.1 functions. If the shared lib or any of 
     212* the functions cannot be loaded, an Exception is thrown. 
     213*/ 
     214void dglLoad() 
     215{ 
     216    loadPlatformGL(); 
     217    loadGL();     
     218} 
     219 
     220/*! 
     221* Because there is, at present, no way for an application to catch an 
     222* exception thrown by a module ctor when using main() (apps using WinMain() do 
     223* not have this limitation), the module ctor does nothing. The user must manually 
     224* call dglLoad in order for the full library to be loaded. 
     225* 
     226* Ideally, I would like to load the library and all GL 1.1 functions with 
     227* the ctor. Because GL is a special case, the user would still need to load 
     228* the extensions manually after activating a context. But other packages could 
     229* be fully loaded by the ctor without the user doing anything. Until there is 
     230* a way to catch module ctor exceptions when using main, things will be done 
     231* as they are. Otherwise, it defeats the purpose of all the dynamic loading 
     232* going on. 
     233*/ 
     234static this() 
     235{ 
     236    // I so want to uncomment this! 
     237    // dglLoad(); 
     238} 
     239 
     240/*! 
     241* Unloads the shared lib. 
     242*/ 
     243static ~this() 
     244{ 
     245    unloadGL(); 
     246} 
     247 
     248//============================================================================== 
     249// DLL FUNCTIONS 
     250//============================================================================== 
     251version(Windows) 
     252    extern(Windows): 
     253else 
     254    extern(C): 
     255 
    203256// Miscellaneous 
    204257typedef void function(GLfloat c) pfglClearIndex; 
     
    12441297} 
    12451298 
    1246 /*! 
    1247 * Loads the shared lib and core GL 1.1 functions. If the shared lib or any of 
    1248 * the functions cannot be loaded, an Exception is thrown. 
    1249 */ 
    1250 void dglLoad() 
    1251 { 
    1252     if(!hlib) 
    1253     { 
    1254         loadPlatformGL(); 
    1255         loadGL();         
    1256     } 
    1257 } 
    1258  
    1259 /*! 
    1260 * Because there is, at present, no way for an application to catch an 
    1261 * exception thrown by a module ctor when using main() (apps using WinMain() do 
    1262 * not have this limitation), the module ctor does nothing. The user must manually 
    1263 * call dglLoad in order for the full library to be loaded. 
    1264 * 
    1265 * Ideally, I would like to load the library and all GL 1.1 functions with 
    1266 * the ctor. Because GL is a special case, the user would still need to load 
    1267 * the extensions manually after activating a context. But other packages could 
    1268 * be fully loaded by the ctor without the user doing anything. Until there is 
    1269 * a way to catch module ctor exceptions when using main, things will be done 
    1270 * as they are. Otherwise, it defeats the purpose of all the dynamic loading 
    1271 * going on. 
    1272 */ 
    1273 static this() 
    1274 { 
    1275     // I so want to uncomment this! 
    1276     // dglLoad(); 
    1277 } 
    1278  
    1279 /*! 
    1280 * Unloads the shared lib. 
    1281 */ 
    1282 static ~this() 
    1283 { 
    1284     unloadGL(); 
    1285 } 
  • trunk/DerelictGL/glee.d

    r14 r15  
    11module glee; 
    22 
    3 struct __nt_context { int esp; int info; int prev; int handler; int stable; int sindex; int ebp; }; 
    43/////////////////////////////////// 
    54// 
     
    64736472alias pglIglooInterfaceSGIX glIglooInterfaceSGIX; 
    64746473 
    6475 version(Win32
     6474version(Windows
    64766475{ 
    64776476 
     
    69956994alias pwglEndFrameTrackingI3D wglEndFrameTrackingI3D; 
    69966995alias pwglQueryFrameTrackingI3D wglQueryFrameTrackingI3D; 
    6997 } // version(Win32
     6996} // version(Windows
    69986997 
    69996998//GLEE FUNCTIONS 
     
    70037002 extern   char * GLeeGetExtStrGL(); 
    70047003 
    7005 version(Win32
     7004version(Windows
    70067005{ 
    70077006 extern   char * GLeeGetExtStrWGL(); 
    7008 } // version(Win32
     7007} // version(Windows
    70097008 
    70107009