FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

darwin - DerelictGLContext is not defined

 
Post new topic   Reply to topic     Forum Index -> Derelict
View previous topic :: View next topic  
Author Message
signal



Joined: 30 Jun 2007
Posts: 5

PostPosted: Sat Jul 07, 2007 3:52 pm    Post subject: darwin - DerelictGLContext is not defined Reply with quote

/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
View user's profile Send private message
aldacron



Joined: 05 May 2004
Posts: 1322
Location: Seoul, South Korea

PostPosted: Sat Jul 07, 2007 10:23 pm    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail
revcompgeek



Joined: 24 Nov 2007
Posts: 27

PostPosted: Thu Jan 17, 2008 6:43 pm    Post subject: Reply with quote

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
View user's profile Send private message
aldacron



Joined: 05 May 2004
Posts: 1322
Location: Seoul, South Korea

PostPosted: Thu Jan 17, 2008 9:13 pm    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail
Crispy



Joined: 26 Nov 2005
Posts: 67

PostPosted: Thu Mar 27, 2008 12:10 am    Post subject: Reply with quote

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. Razz 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
View user's profile Send private message
aldacron



Joined: 05 May 2004
Posts: 1322
Location: Seoul, South Korea

PostPosted: Thu Mar 27, 2008 3:47 am    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail
afb



Joined: 26 Jan 2005
Posts: 137
Location: Sweden

PostPosted: Sun Mar 30, 2008 3:16 am    Post subject: Reply with quote

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
View user's profile Send private message
Crispy



Joined: 26 Nov 2005
Posts: 67

PostPosted: Mon Mar 31, 2008 7:44 pm    Post subject: Reply with quote

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
View user's profile Send private message
hugues



Joined: 09 Aug 2007
Posts: 20
Location: Brussels, Belgium

PostPosted: Sat Apr 05, 2008 3:02 pm    Post subject: DerelictGLContext on Mac OS X fixed in revision 288 Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic     Forum Index -> Derelict All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group