| | 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 | */ |
|---|
| | 214 | void 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 | */ |
|---|
| | 234 | static this() |
|---|
| | 235 | { |
|---|
| | 236 | // I so want to uncomment this! |
|---|
| | 237 | // dglLoad(); |
|---|
| | 238 | } |
|---|
| | 239 | |
|---|
| | 240 | /*! |
|---|
| | 241 | * Unloads the shared lib. |
|---|
| | 242 | */ |
|---|
| | 243 | static ~this() |
|---|
| | 244 | { |
|---|
| | 245 | unloadGL(); |
|---|
| | 246 | } |
|---|
| | 247 | |
|---|
| | 248 | //============================================================================== |
|---|
| | 249 | // DLL FUNCTIONS |
|---|
| | 250 | //============================================================================== |
|---|
| | 251 | version(Windows) |
|---|
| | 252 | extern(Windows): |
|---|
| | 253 | else |
|---|
| | 254 | extern(C): |
|---|
| | 255 | |
|---|
| 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 | | } |
|---|