macOS 9.2, SDL_SetVideoMode fails

I’m currently toying with the idea of porting my game to the Macintosh. My
school labs have OS9.2, so I’m here now trying to get a very simple SDL
test app to compile and run using Codewarrior 4.1.

I got it to compile and link fine. I dragged the SDL include folder into my
project, as well as SDLmain.PPC.LIB and SDL.STUB.

But when I run it I get an error on SDL_SetVideoMode, for any windowed
setting it’s “modeNewGWorld() failed” and for fullscreen it’s “Couldn’t
create shadow surface”.

I am trying all types of color depths, fullscreen/windowed, double
buffering, as well as trying SDL_ANYFORMAT.

I’ve also tried the test programs that come with SDL. Any ones dealing
with video have the same problem, with the same error.

My best guess is the SDL extension is not loaded. I dropped it into the
extensions folder and rebooted, according to the Apple System Profiler it
is loaded and enabled. The extension manager is not available. But being
a lab computer, I have a hard time accepting I can just install an extension
like that.

If the SDL extension was not available, would it be able to get past
SDL_Init?

Below is the program, very short and simple. Thanks for any ideas.

Matt--------------------
#include “SDL.h”
#include
#include

using namespace std;

SDL_Surface *screen;

void init_SDL()
{
if ( SDL_Init(SDL_INIT_VIDEO) < 0 )
{
cerr << "Couldn’t initialize SDL: " << SDL_GetError() << endl;
exit(1);
}
atexit(SDL_Quit);

screen = SDL_SetVideoMode(640, 480, 8, 0);
if ( screen == NULL )
{
	cerr << "video mode" << SDL_GetError() <<  endl;
	exit(1);
}

}

int main(int argc, char *argv[])
{
init_SDL();

SDL_Rect r;
r.x = 30;
r.y = 30;
r.w = 200;
r.h = 200;

Uint32 red = SDL_MapRGB(screen->format, 200, 21, 35);

SDL_FillRect(screen, &r, red);

SDL_UpdateRect(screen, 0, 0, 0, 0);

// tried just about every combo
// I can think of of video mode and
// SDL_Flip/SDL_UpdateRect

SDL_Delay(5000);

return 0;

}

I’m currently toying with the idea of porting my game to the Macintosh. My
school labs have OS9.2, so I’m here now trying to get a very simple SDL
test app to compile and run using Codewarrior 4.1.

But when I run it I get an error on SDL_SetVideoMode, for any windowed
setting it’s “modeNewGWorld() failed” and for fullscreen it’s “Couldn’t
create shadow surface”.

So no one’s developing SDL apps in Mac classic anymore? I still haven’t gotten
anywhere with this. Fortunately I have my game up and running in OSX, so Mac
classic’s not as important anymore. Still hoping to get some clues on this
though.

MattOn Friday 23 August 2002 01:13 pm, megree wrote:

But when I run it I get an error on SDL_SetVideoMode, for any windowed
setting it’s “modeNewGWorld() failed” and for fullscreen it’s “Couldn’t
create shadow surface”.

I’ve never seen this problem… Are you linking with SDLmain.o ?

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

But when I run it I get an error on SDL_SetVideoMode, for any windowed
setting it’s “modeNewGWorld() failed” and for fullscreen it’s
"Couldn’t
create shadow surface".

I’ve never seen this problem… Are you linking with SDLmain.o ?

That sounds like it could be the culprit. If the Mac OS Toolbox isn’t
initialized you’ll see strange errors like this, or more commonly hang
or crash.

-DOn Sunday, August 25, 2002, at 12:18 PM, Sam Lantinga wrote:

Re: macOS 9.2, SDL_SetVideoMode fails

But when I run it I get an error on SDL_SetVideoMode, for any windowed
setting it’s “modeNewGWorld() failed” and for fullscreen it’s
"Couldn’t create shadow surface".

I port all of my SDL app from Windows to MacOS (8.6 & 9.1).
I already have a problem with this MacOS toolbox function NewGWorld()
Do you link your source and libraries files with the SDL resource files
(SDL.r and SIZE.r) in your CodeWarrior project ?
If you don’t, try it. It can (maybe) solve your problem.

Jo?l Rodi?re (sorry for my poor English, I’m French)
Trafik Team - http://www.lavitrinedetrafik.com

Do you link your source and libraries files with the SDL resource files
(SDL.r and SIZE.r) in your CodeWarrior project ?
If you don’t, try it. It can (maybe) solve your problem.

That’s exactly what it was. Failing to link in the resources. Thanks for all
the help, SDL on the Mac appears to be going ok now.

MattOn Monday 26 August 2002 03:00 am, Jo?l Rodi?re wrote:

Sorry for again sending this from this email address, I don’t know when I’ll
get access to my regular one.

Just wanted to follow up and say i got the test apps to compile and run in
Codewarrior 4.1 for Mac OS 9.2. Turns out my problem was not including
the SDL resources in my project. I confess complete ignorance on Mac
programming :slight_smile:

I do get quite a few warnings, mostly pertaining to duplicate resources. I’m
sure as I get more comfortable with Mac programming I’ll be able to figure
it out. Things seem ok despite the warnings, so I’m just gonna go with it
for now.

Thanks,
Matt