Checking for the existance of OGL?
How do make sure that the user who is running your program has OpenGL correctly installed?
I don't know the code but I can tell you where to look...
One way would be to dig through the opengl samples from apple...they have error checking for any libraries they use. I'm messing with Carbon SetUpGL, and there are examples for Cocoa also.
http://developer.apple.com/samplecode/Sa...ics_3D.htm
One way would be to dig through the opengl samples from apple...they have error checking for any libraries they use. I'm messing with Carbon SetUpGL, and there are examples for Cocoa also.
http://developer.apple.com/samplecode/Sa...ics_3D.htm
Correct me if I'm wrong, but in OS 9, the Finder will produce an error if a library that you link against is missing. In OS X, GL should always be there, so there's nothing to worry about. So as long as you properly report errors AGL, CGL or NSGL gives you, you should be fine.
Quote:Originally posted by Jeff Binder
Correct me if I'm wrong, but in OS 9, the Finder will produce an error if a library that you link against is missing. In OS X, GL should always be there, so there's nothing to worry about. So as long as you properly report errors AGL, CGL or NSGL gives you, you should be fine.
The Finder will produce an error for the user, unless you weak link OpenGL, so they don't have to have OpenGL for your program to run. I think, anyway. You might want to do that if you have an alternative renderer. But for most cases, it makes sense just to link normally. And if you're using OpenGL, what are the chances you'll want it to run on a computer that has a system old enough not to have OpenGL?
The danger if with relying on linkage to produce error messages when libraries aren't found is that the system will pop up a nonsense message that the user won't understand. Then they'll throw your game in the trash because they thought it crashed!
It's better to weak link and then check for OpenGL yourself, just in case the user has foolishly pruned their system folder. This way you can put up your own explanatory dialog containing a more readable error message.
My game runs under CFM, so I do:
In conjunction with weak linking, this checks to see if the aglGetVersion() function is available at runtime. If it is, I can safely call it to see what version of AGL I have before going any further. You should only have to do this for one function in any given library, because if one function is there, they should all be.
Of course, the function above only applies to AGL under CFM. Unfortunately, I don't know what you'd do with CGL under Mach-O.
It's better to weak link and then check for OpenGL yourself, just in case the user has foolishly pruned their system folder. This way you can put up your own explanatory dialog containing a more readable error message.
My game runs under CFM, so I do:
Code:
bool IsOpenGLAvailable()
{
return ((Ptr)aglGetVersion != (Ptr)kUnresolvedCFragSymbolAddress);
}Of course, the function above only applies to AGL under CFM. Unfortunately, I don't know what you'd do with CGL under Mach-O.
If you're on MacOSX, OpenGL is always installed, so there's no need to check for its presence. This is only an issue on MacOS9 or less.
Possibly Related Threads...
| Thread: | Author | Replies: | Views: | Last Post | |
| Checking renderer capabilities | akb825 | 5 | 2,635 |
Apr 11, 2006 09:04 AM Last Post: akb825 |
|
| Collision Checking | Nick | 8 | 5,000 |
Aug 24, 2004 11:12 AM Last Post: Nick |
|
| checking CPU and video card load | NYGhost | 2 | 4,110 |
Jul 1, 2004 10:01 PM Last Post: SOUR-Monkey |
|

