View previous topic :: View next topic |
Author |
Message |
signal
Joined: 30 Jun 2007 Posts: 5
|
Posted: Sat Jul 07, 2007 3:52 pm Post subject: darwin - DerelictGLContext is not defined |
|
|
/Users/sparks/development/D/src/ext/derelict/opengl/gl.d:182: Error: identifier 'DerelictGLContext' is not defined
/Users/sparks/development/D/src/ext/derelict/opengl/gl.d:182: Error: DerelictGLContext is used as a type
ext/derelict/opengl/gl.d:182: Error: identifier 'DerelictGLContext' is not defined
ext/derelict/opengl/gl.d:182: Error: DerelictGLContext is used as a type
when trying
bud example.d -Iext -L-ldl -exec -op ext/derelict/opengl/glx.d
(im trying the Dmedia tutorials, but have gotten this no matter how I try to set it up..) |
|
Back to top |
|
|
aldacron
Joined: 05 May 2004 Posts: 1322 Location: Seoul, South Korea
|
Posted: Sat Jul 07, 2007 10:23 pm Post subject: |
|
|
Derelict on Mac is still not officially supported. While some packages may work, DerelictGL is a bit problematic right now. What's there has been implemented in steps. I don't have a Mac to test on, though I hope to get one in the future. The errors you are getting are coming from the lack of a platform-specific API binding for Mac in Derelict. We have the WGL functions for Windows and the GLX functions on Linux. We still need the appropriate bindings for Mac (AGL or whatever). The reason is that gl.d does some internal context management and needs platform-specific functions to do so. _________________ The One With D | The One With Aldacron | D Bits |
|
Back to top |
|
|
revcompgeek
Joined: 24 Nov 2007 Posts: 27
|
Posted: Thu Jan 17, 2008 6:43 pm Post subject: |
|
|
I am a semi-amateur Mac developer, and I would like to see DerelictGL for Mac working. Is there something I can do? |
|
Back to top |
|
|
aldacron
Joined: 05 May 2004 Posts: 1322 Location: Seoul, South Korea
|
Posted: Thu Jan 17, 2008 9:13 pm Post subject: |
|
|
You might want to get in touch with Crispy. He has done some work to get some Derelict packages working on Mac and can commit to the trunk. _________________ The One With D | The One With Aldacron | D Bits |
|
Back to top |
|
|
Crispy
Joined: 26 Nov 2005 Posts: 67
|
Posted: Thu Mar 27, 2008 12:10 am Post subject: |
|
|
Was pointed here via PM. It's been a long time since I've actually looked at this, but I have been able to compile and run Mayhem Intergalactic (which is written in D using DerelictSDL and DerelictGL) on an Intel Macbook. So it's definitely possible. I just don't remember what I did about the lack of a platform-specific GL implementation. I think I might have just created stubs (code that satisfies the required interface but does nothing). Whatever I did, it seemed to work fine.
I don't have time to investigate right now, but I'll put it on my to-do list.
-----
The biggest hurdle that I do remember was sorting out the NSAutoreleasePool crap that SDLmain normally deals with. I hacked around this problem by creating a .m (Objective-C) file with the following code.
(Note: This is a bit hacky at this point, as I don't destroy the pool afterwards. Also, I'd prefer to do this from within pure D, to avoid having to link in extra files. It's on my to-do list to clean this up and commit it to the trunk, but I won't get around to it until after the Mac release of Mayhem Intergalactic, which itself has no fixed timeframe.
Additionally, this solution is not complete. e.g. I haven't figured out the easiest way to handle the [App Name]->Quit menu item. Currently it simply doesn't work. I need to catch an event somehow.)
Code: | #import <Cocoa/Cocoa.h>
#import <Foundation/NSAutoreleasePool.h>
void createAutoreleasePool() {
globalPool = [[NSAutoreleasePool alloc] init];
printf("Global alloc pool created\n");
} |
Add a call to createAutoreleasePool() during the init procedure of your app, before you call any SDL related functions.
Compile the above .m file to a .o file with the standard Apple-supplied gcc, then include it on your build tool's command line when building the rest of your app. |
|
Back to top |
|
|
aldacron
Joined: 05 May 2004 Posts: 1322 Location: Seoul, South Korea
|
Posted: Thu Mar 27, 2008 3:47 am Post subject: |
|
|
Crispy wrote: |
The biggest hurdle that I do remember was sorting out the NSAutoreleasePool crap that SDLmain normally deals with. I hacked around this problem by creating a .m (Objective-C) file with the following code. |
For those who aren't aware, SDL 2 (currently in development as 1.3) will do away with SDLmain completely. So none of this hackery will be needed on Mac. _________________ The One With D | The One With Aldacron | D Bits |
|
Back to top |
|
|
afb
Joined: 26 Jan 2005 Posts: 137 Location: Sweden
|
Posted: Sun Mar 30, 2008 3:16 am Post subject: |
|
|
aldacron wrote: | Crispy wrote: |
The biggest hurdle that I do remember was sorting out the NSAutoreleasePool crap that SDLmain normally deals with. I hacked around this problem by creating a .m (Objective-C) file with the following code. |
For those who aren't aware, SDL 2 (currently in development as 1.3) will do away with SDLmain completely. So none of this hackery will be needed on Mac. |
It isn't needed with SDL 1.2 either, the normal libSDLmain.a can be used.
(the previously used patch to SDLmain was removed a year ago...)
http://www.dsource.org/forums/viewtopic.php?t=2323&postorder=desc
http://cgi.algonet.se/htbin/cgiwrap/afb/cvsweb/d/sdl/main.d.diff?r1=1.5&r2=1.6 |
|
Back to top |
|
|
Crispy
Joined: 26 Nov 2005 Posts: 67
|
Posted: Mon Mar 31, 2008 7:44 pm Post subject: |
|
|
aldacron wrote: | For those who aren't aware, SDL 2 (currently in development as 1.3) will do away with SDLmain completely. So none of this hackery will be needed on Mac. |
Yeah, but who knows when stable SDL 1.3 will be out... (Seriously, does anyone know?)
afb: I'm not really clear on what you've done there, could you explain it? It seems like you're still doing funky things with main(). |
|
Back to top |
|
|
hugues
Joined: 09 Aug 2007 Posts: 20 Location: Brussels, Belgium
|
Posted: Sat Apr 05, 2008 3:02 pm Post subject: DerelictGLContext on Mac OS X fixed in revision 288 |
|
|
DerelictGL now compiles correctly on Mac OS X. I fixed the DerelictGLContext-related issues in revision 288.
Regarding the SDL_main problem, an easy and clean solution hasn't been found yet, though (see this other post). |
|
Back to top |
|
|
|