Issues with mac os x

I’m having 2 issues with SDL on mac os x. One has to do with
controllers, SDL reports a failure to intialize if IOHIDIterator cannot
be created. But this isn’t nescessarially true, cause this could also
mean that there are no controllers. So to ffix this I changed Lines 614
to 615 In SDL_sysjoystick for the darwin target from:
SDL_SetError(“Joystick: Couldn’t create a HID object iterator.”);
return -1;
To:
SDL_SetError(“Joystick: Couldn’t create a HID object iterator.”);
return 0;

Which lets SDL programs that would normally fail thinking SDL 

failed to continue.
I’m not sure this is the correct thing to do.

My other issue involves the interaction of GLUT and SDL.
glutInit creates an NSApplication and assigns it to the current run 

loop. This causes problems because in main, SDL does the same thing.
One way I’ve been able to partially circumvent this issue is to
make SDLApplication a subclass of GLUTApplication and then do a
[SDLApplication poseAsClass:[GLUTApplication class]];
I also have it not execute any of the menu manipulation or nib
loading functions.
This works… kinda. The app no longer dies on glutCreateWindow and
glutInit does not complain that it’s been called twice, but the app is
incapable of any opengl updates. This would also requires a special
version of SDLMain if one would be using GLUT and another if not.
The other way I’ve found is to move some of the handy SDL setup
jazz to my application and then jsut not allow SDL to include SDL_Main.h
or link with SDLMain. This works, but requires a good deal of dirty
hacking I dislike.

The best way I think would be not to initialize an instance of 

SDLApplication unless the developer request video to ge enabled, or
opengl. As I’m not sure of how to program for SDL or how it’s
structured. Is this really the best way to go about this?

Sorry for the quick explanation. If anyone wants more details I'll 

be happy to provide.
-Corey O’Connor
Lead Programmer
DogHeadBone Software
@Corey_O_Connor
303-929-3517
www.dogheadbone.com

I’m having 2 issues with SDL on mac os x. One has to do with
controllers, SDL reports a failure to intialize if IOHIDIterator cannot

Can you try SDL_InitSubSystem (SDL_INIT_JOYSTICK) [ I’m guessing on that
constant, check the docs ] and check the result code? I think perhaps
SDL_Init() is supposed to fail if there is no joystick and you wanted one
(or if there is any subsystem you wanted but it is not available).

My other issue involves the interaction of GLUT and SDL.

   ...

The other way I’ve found is to move some of the handy SDL setup
jazz to my application and then jsut not allow SDL to include SDL_Main.h
or link with SDLMain. This works, but requires a good deal of dirty
hacking I dislike.

What dirty hacking? All you have to do is

#undef main

before your main procedure.

I think GLUT already sets up the menu bar for you. I think it sets the
working directory to .app/Contents/Resources/. The only thing missing is
the arguments fiddling which probably won’t be missed. Correct me if I’m
wrong but you shouldn’t need SDLMain at all.

The best way I think would be not to initialize an instance of
SDLApplication unless the developer request video to ge enabled, or
opengl. As I’m not sure of how to program for SDL or how it’s
structured. Is this really the best way to go about this?

This might be tricky since the NSApplication instance is created before
your main() is called, and at this point we don’t know what subsystems you
want to use. Also it seems that applications that go creating windows
should ideally have a “face”, or a place in the dock and a menu bar. I’m
in favor of forcing this issue to make SDL apps more consistent with the
expected behavior of a good-natured Mac application.

If you don’t use the video/event portion of SDL, you don’t need SDL_Main,
since the Objective-C/Cocoa path in SDL is never used. If you want to go
create a SDL window and catch events, you should probably not be using
GLUT and SDL at the same time. It is pretty simple to wrap GLUT API calls
with SDL.

-DarrellOn Tue, 5 Mar 2002, Corey O’Connor wrote:

I’ve never used SDL on MacOS, I’m a Win/Linux guy.
But AFAIK you can’t mix GLUT with SDL !!

When using OpenGL in SDL, you MUST use the SDL support
for it. Think of SDL as an GLUT with multimedia support.

So you must make a choice. Use GLUT and look elsewhere for
the other things that you want SDL for. Or just use SDL.
Not Both.—
Paulo Pinto (aka Moondevil in demoscene)
pjmlp_pt at yahoo.comhttp://www.progtools.org
"If you think education is expensive, try ignorance" - Derek Bok

----- Original Message -----
From: oconnorc@dogheadbone.com (Corey O’Connor)
To:
Sent: Tuesday, March 05, 2002 8:33 PM
Subject: [SDL] Issues with mac os x.

I’m having 2 issues with SDL on mac os x. One has to do with
controllers, SDL reports a failure to intialize if IOHIDIterator cannot
be created. But this isn’t nescessarially true, cause this could also
mean that there are no controllers. So to ffix this I changed Lines 614
to 615 In SDL_sysjoystick for the darwin target from:
SDL_SetError(“Joystick: Couldn’t create a HID object iterator.”);
return -1;
To:
SDL_SetError(“Joystick: Couldn’t create a HID object iterator.”);
return 0;

Which lets SDL programs that would normally fail thinking SDL
failed to continue.
I’m not sure this is the correct thing to do.

My other issue involves the interaction of GLUT and SDL.
glutInit creates an NSApplication and assigns it to the current run
loop. This causes problems because in main, SDL does the same thing.
One way I’ve been able to partially circumvent this issue is to
make SDLApplication a subclass of GLUTApplication and then do a
[SDLApplication poseAsClass:[GLUTApplication class]];
I also have it not execute any of the menu manipulation or nib
loading functions.
This works… kinda. The app no longer dies on glutCreateWindow and
glutInit does not complain that it’s been called twice, but the app is
incapable of any opengl updates. This would also requires a special
version of SDLMain if one would be using GLUT and another if not.
The other way I’ve found is to move some of the handy SDL setup
jazz to my application and then jsut not allow SDL to include SDL_Main.h
or link with SDLMain. This works, but requires a good deal of dirty
hacking I dislike.

The best way I think would be not to initialize an instance of
SDLApplication unless the developer request video to ge enabled, or
opengl. As I’m not sure of how to program for SDL or how it’s
structured. Is this really the best way to go about this?

Sorry for the quick explanation. If anyone wants more details I’ll
be happy to provide.
-Corey O’Connor
Lead Programmer
DogHeadBone Software
oconnorc at dogheadbone.com
303-929-3517
www.dogheadbone.com


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl


Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com

Clearly you have outlined an important missing module if SDL is ever to be
considered a viable alternative to GLUT for serious development. I have
before raised the issue because I realize that it will have a profound
impact on developer’s ability to use SDL as their OpenGL framework of
choice.

It is positively essential that a companion module for SDL be created to
resolve this issue and close the wide feature gap between SDL and GLUT.
SDL_teapot must be written! The very future of SDL is at stake!

;)On Wed, Mar 06, 2002 at 10:49:23AM -0000, Paulo Pinto wrote:

I’ve never used SDL on MacOS, I’m a Win/Linux guy.
But AFAIK you can’t mix GLUT with SDL !!

When using OpenGL in SDL, you MUST use the SDL support
for it. Think of SDL as an GLUT with multimedia support.

So you must make a choice. Use GLUT and look elsewhere for
the other things that you want SDL for. Or just use SDL.
Not Both.


Joseph Carter You’re entitled to my opinion

  • Knghtktty whispers sweet nothings to Thyla (stuff about compilers and
    graphics and ram upgrades and big hard drives…)
    oooooooooOOOOOOOOOO
    Knghtktty: that’s positively pornographic…
  • Thyla goes off into fits of ecstasy…

-------------- next part --------------
A non-text attachment was scrubbed…
Name: not available
Type: application/pgp-signature
Size: 273 bytes
Desc: not available
URL: http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20020306/9862f6d1/attachment.pgp

It is positively essential that a companion module for SDL be created to
resolve this issue and close the wide feature gap between SDL and GLUT.
SDL_teapot must be written! The very future of SDL is at stake!

Heheh.
I’m pretty sure somebody wrote an SDLglut at one point…

See ya,
-Sam Lantinga, Software Engineer, Blizzard Entertainment

I can’t find anything like that, but if I do (or if I actually manage to
get a large amount of free time and write it myself) I’ll post a link
here.On Wed, Mar 06, 2002 at 03:16:14AM -0800, Sam Lantinga wrote:

It is positively essential that a companion module for SDL be created to
resolve this issue and close the wide feature gap between SDL and GLUT.
SDL_teapot must be written! The very future of SDL is at stake!

Heheh.
I’m pretty sure somebody wrote an SDLglut at one point…


Joseph Carter Certified free software nut

I am dyslexic of Borg. Prepare to have your ass laminated.

-------------- next part --------------
A non-text attachment was scrubbed…
Name: not available
Type: application/pgp-signature
Size: 273 bytes
Desc: not available
URL: http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20020306/435c9c3b/attachment.pgp

Why should SDL provide GLUT funcionality ?

When I use SDL I don’t won’t to use menus,
multiple windows and other GUI funcionality provided
by GLUT.

I want to code a demo, or a game. Not some user
application. If I wanted to do that I wouldn’t use
SDL.—
Paulo Pinto (aka Moondevil in demoscene)
pjmlp_pt at yahoo.comhttp://www.progtools.org
"If you think education is expensive, try ignorance" - Derek Bok

----- Original Message -----
From: knghtbrd@bluecherry.net (Joseph Carter)
To:
Sent: Wednesday, March 06, 2002 10:59 AM
Subject: Re: [SDL] Issues with mac os x.


Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com

Why should SDL provide GLUT funcionality ?

Because the OpenGL red book uses GLUT. The primary purpose of it is to
aid with education. There are a lot of one-to-one mappings of GLUT and
SDL functionality and many more near mappings.

When I use SDL I don’t won’t to use menus,
multiple windows and other GUI funcionality provided
by GLUT.

GLUT is actually quite bloated - it includes much more than just menus and
GUI elements. It’s mostly there to make the red book easier to write. It
does a fine job at this and because of its familiarity to OpenGL users,
most of us can write code for GLUT at least as easily as we can for SDL.
In fact, most OpenGL demo code is written for GLUT (unless you’re NeHe,
but then if you were NeHe, your demos would all suck anyway…)

It would be a lot easier to port these GLUT demos to SDL if there were an
existing wrapper. This isn’t needed for the little things, but some of
the GLUT-based code I have seen has been pretty complex.

I want to code a demo, or a game. Not some user
application. If I wanted to do that I wouldn’t use
SDL.

That’s fine. I use SDL myself, not GLUT. In large, other than my
obsession with the teapot for some perverse reason, I find GLUT useless.
Most of the demos and other things I mention above I either do not need or
could (and probably should) write myself if I ever took the time to think
about how they would be done if only because I have an aversion to using
any library beyond SDL and OpenGL if I can help it. I realize this does
involve reinventing wheels, but I’ve found in my experience that one wheel
does not fit all cars.On Wed, Mar 06, 2002 at 01:26:31PM -0000, Paulo Pinto wrote:


Joseph Carter My opinions are always right

“I wonder if this is the first constitution in the history of mankind
where you have to calculate a square root to determine if a motion
passes. :-)”
– Seen on Slashdot

-------------- next part --------------
A non-text attachment was scrubbed…
Name: not available
Type: application/pgp-signature
Size: 273 bytes
Desc: not available
URL: http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20020306/d1c6f4ea/attachment.pgp

For my purposes, moving some code from SDLMain.m to my main
function and placing a #undef main has solved my problem.
But on other platforms using SDL and GLUT together don’t seem to cause
any problems. Or at least any noticeable ones. I also know that there
someday might be some required SDL initialization code in OS X SDL that
would be impractical to move out of SDLMain.m manually in order to get
them to agree.
As for only being able to use OpenGL with SDL’s own variation. That
seems a bit backwards. If SDL has the ability to let you just initialize
a subsystem (Joysticks in my case) then it wouldn’t make sense to be
required to conform to any standard outside of that subsystem. IE.
Change the video or sound system in a game if using SDL even if you only
use the joystick subsystem.
Although, this appears to be th case (Yea!!! :-D) on every
platform but OS X.On Wednesday, March 6, 2002, at 03:42 AM, Joseph Carter wrote:

On Wed, Mar 06, 2002 at 03:16:14AM -0800, Sam Lantinga wrote:

It is positively essential that a companion module for SDL be created
to
resolve this issue and close the wide feature gap between SDL and
GLUT.
SDL_teapot must be written! The very future of SDL is at stake!

Heheh.
I’m pretty sure somebody wrote an SDLglut at one point…

I can’t find anything like that, but if I do (or if I actually manage to
get a large amount of free time and write it myself) I’ll post a link
here.


Joseph Carter Certified free software
nut

I am dyslexic of Borg. Prepare to have your ass laminated.

-Corey O’Connor
Lead Programmer
DogHeadBone Software
@Corey_O_Connor
303-929-3517
www.dogheadbone.com

[…]

I want to code a demo, or a game. Not some user
application. If I wanted to do that I wouldn’t use
SDL.

That’s fine. I use SDL myself, not GLUT. In large, other than my
obsession with the teapot for some perverse reason, I find GLUT

An abstinence symptom, perhaps? Drink tea more regularly! :wink:

useless. Most of the demos and other things I mention above I either do
not need or could (and probably should) write myself if I ever took the
time to think about how they would be done if only because I have an
aversion to using any library beyond SDL and OpenGL if I can help it.
I realize this does involve reinventing wheels, but I’ve found in my
experience that one wheel does not fit all cars.

Also, some wheels are too big and heavy for some cars, or just not good
enough for serious driving…

Anyway, I would assume that an “SDL_glut” library would have to be mostly
API compatible with GLUT to be helpful…?

//David Olofson — Programmer, Reologica Instruments AB

.- M A I A -------------------------------------------------.
| Multimedia Application Integration Architecture |
| A Free/Open Source Plugin API for Professional Multimedia |
----------------------------> http://www.linuxdj.com/maia -' .- David Olofson -------------------------------------------. | Audio Hacker - Open Source Advocate - Singer - Songwriter |-------------------------------------> http://olofson.net -'On Wednesday 06 March 2002 17:06, Joseph Carter wrote:

Probably pretty close. But the idea is to make something not unlike GLU
which is highly convenient specifically because anything in GLU can
usually be copied into your code and then modified to be faster (by
breaking it from the pure API a bit…)

I think it’d be a good thing.On Wed, Mar 06, 2002 at 06:37:26PM +0100, David Olofson wrote:

Anyway, I would assume that an “SDL_glut” library would have to be mostly
API compatible with GLUT to be helpful…?


Joseph Carter If this sig were funny…

these stupid head hunters want resumes in ms word format
can you write shit in tex and convert it to word?

-------------- next part --------------
A non-text attachment was scrubbed…
Name: not available
Type: application/pgp-signature
Size: 273 bytes
Desc: not available
URL: http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20020306/ed09db68/attachment.pgp