# macOS 9.2, SDL\_SetVideoMode fails

**URL:** <https://discourse.libsdl.org/t/macos-9-2-sdl-setvideomode-fails/7310>\
**Category:** SDL Development\
**Created:** [August 23, 2002, 9:11pm UTC](https://discourse.libsdl.org/t/macos-9-2-sdl-setvideomode-fails/7310 "2002-08-23T21:11:29Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Matt\_Greer](https://discourse.libsdl.org/letter_avatar_proxy/v4/letter/m/47e85d/32.png) [@Matt\_Greer](https://discourse.libsdl.org/u/Matt_Greer)\
**Post date:** [August 23, 2002, 9:11pm UTC](https://discourse.libsdl.org/t/macos-9-2-sdl-setvideomode-fails/7310/1 "2002-08-23T21:11:29Z")

</div>

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;

```

}

---

<div class="post-metadata">

**Author:** ![Matt\_Greer](https://discourse.libsdl.org/letter_avatar_proxy/v4/letter/m/47e85d/32.png) [@Matt\_Greer](https://discourse.libsdl.org/u/Matt_Greer)\
**Post date:** [August 25, 2002, 7:46am UTC](https://discourse.libsdl.org/t/macos-9-2-sdl-setvideomode-fails/7310/2 "2002-08-25T07:46:01Z")

</div>

> 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:

---

<div class="post-metadata">

**Author:** ![slouken](https://discourse.libsdl.org/letter_avatar_proxy/v4/letter/s/ec9cab/32.png) [@slouken](https://discourse.libsdl.org/u/slouken)\
**Post date:** [August 25, 2002, 9:19am UTC](https://discourse.libsdl.org/t/macos-9-2-sdl-setvideomode-fails/7310/3 "2002-08-25T09:19:01Z")

</div>

> > 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

---

<div class="post-metadata">

**Author:** ![Darrell\_Walisser](https://discourse.libsdl.org/user_avatar/discourse.libsdl.org/darrell_walisser/32/588_2.png) [@Darrell\_Walisser](https://discourse.libsdl.org/u/Darrell_Walisser)\
**Post date:** [August 25, 2002, 9:34am UTC](https://discourse.libsdl.org/t/macos-9-2-sdl-setvideomode-fails/7310/4 "2002-08-25T09:34:01Z")

</div>

> > > 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:

---

<div class="post-metadata">

**Author:** ![Joel\_Rodiere](https://discourse.libsdl.org/letter_avatar_proxy/v4/letter/j/8edcca/32.png) [@Joel\_Rodiere](https://discourse.libsdl.org/u/Joel_Rodiere)\
**Post date:** [August 26, 2002, 1:02am UTC](https://discourse.libsdl.org/t/macos-9-2-sdl-setvideomode-fails/7310/5 "2002-08-26T01:02:00Z")

</div>

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](http://www.lavitrinedetrafik.com)

---

<div class="post-metadata">

**Author:** ![Matt\_Greer](https://discourse.libsdl.org/letter_avatar_proxy/v4/letter/m/47e85d/32.png) [@Matt\_Greer](https://discourse.libsdl.org/u/Matt_Greer)\
**Post date:** [August 27, 2002, 8:39pm UTC](https://discourse.libsdl.org/t/macos-9-2-sdl-setvideomode-fails/7310/6 "2002-08-27T20:39:01Z")

</div>

> 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:

---

<div class="post-metadata">

**Author:** ![Matt\_Greer](https://discourse.libsdl.org/letter_avatar_proxy/v4/letter/m/47e85d/32.png) [@Matt\_Greer](https://discourse.libsdl.org/u/Matt_Greer)\
**Post date:** [August 28, 2002, 4:05pm UTC](https://discourse.libsdl.org/t/macos-9-2-sdl-setvideomode-fails/7310/7 "2002-08-28T16:05:02Z")

</div>

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 🙂

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
