No hardware on Macs?

Hello,

On my Macintosh PowerBook Titanium (with a ATI Radeon Mobility 16Mo),
SDL cannot find any hardware acceleration. Do someone know why ?

Thanks;
Mathieu Godart

Hello,

On my Macintosh PowerBook Titanium (with a ATI Radeon Mobility 16Mo),
SDL cannot find any hardware acceleration. Do someone know why ?

Thanks;
Mathieu Godart

It does it just fine, but ONLY in fullscreen mode in my experiences with
SDL and the mac. =)

The hardware acceleration support that SDL needs is not built into Mac
OS X itself. (It is present in Mac OS 9, and SDL will use it when you
choose the DrawSprocket video driver).

The only way to get some acceleration is to use OpenGL - but
unfortunately the way OpenGL works doesn’t fit well within SDL’s 2D
API, so we haven’t been able to use it to accelerate 2D operations.

You can rewrite your blitting to use OpenGL - but this can be
difficult. With OpenGL you can only blit to the screen surface, and you
can’t (shouldn’t) read back pixels from the screen. This means if you
are reading surface pixels to do collision detection, etc. you’ll have
to rewrite this code.

If you want to stay away from OpenGL, use David Olofson’s glSDL hack:
http://olofson.net/mixed.html, which has the same limitations but you
don’t have to write any OpenGL code.On Saturday, March 29, 2003, at 03:01 PM, Andrew1300 at aol.com wrote:

Hello,

On my Macintosh PowerBook Titanium (with a ATI Radeon Mobility 16Mo),
SDL cannot find any hardware acceleration. Do someone know why ?

Le samedi, 29 mars 2003, ? 23:15 Europe/Paris, Darrell Walisser a ?crit
:

The only way to get some acceleration is to use OpenGL - but
unfortunately the way OpenGL works doesn’t fit well within SDL’s 2D
API, so we haven’t been able to use it to accelerate 2D operations.

I’m sorry, I was not clear on that point : I’m writing a 3D game using
OpenGL. :wink:

But when I init the screen, it says that I don’t have any hw
acceleration. But is it talking about 2D or 3D ? I cannot get this ?

Here is my initialization code :=================================================
const char *windowName = “Tupper”;
int videoFlags = SDL_OPENGL; //| SDL_FULLSCREEN;

#ifdef VERBOSE
std::cout << “Initializing SDL…” << std::endl;
#endif

if( ( SDL_Init( SDL_INIT_VIDEO ) == -1 ) )
{
	std::cerr << "SDL initialization failed: " << SDL_GetError() << 

std::endl;
exit( 1 );
}

const SDL_VideoInfo *videoInfo = SDL_GetVideoInfo();
if( videoInfo == NULL )
{
	std::cerr << "Failed getting Video Info : " << SDL_GetError() << 

std::endl;
exit( 2 );
}

if( videoInfo->hw_available )
{
	videoFlags |= SDL_HWSURFACE;

#ifdef VERBOSE
std::cout << “Hardware acceleration detected” << std::endl;
#endif
}
else
{
videoFlags |= SDL_SWSURFACE;
#ifdef VERBOSE
std::cout << “No hardware acceleration, using software” << std::endl;
#endif
}

if( videoInfo->blit_hw )
	videoFlags |= SDL_HWACCEL;

#ifdef VERBOSE
std::cout << “Setting up SDL_GL attributes…” << std::endl;
#endif
SDL_GL_SetAttribute( SDL_GL_DOUBLEBUFFER, 1 );
SDL_GL_SetAttribute( SDL_GL_RED_SIZE, 5 );
SDL_GL_SetAttribute( SDL_GL_GREEN_SIZE, 5 );
SDL_GL_SetAttribute( SDL_GL_BLUE_SIZE, 5 );
SDL_GL_SetAttribute( SDL_GL_DEPTH_SIZE, 16 );

SDL_Rect **modes;
modes = SDL_ListModes( videoInfo->vfmt, videoFlags );
if( modes == NULL )
{
	std::cerr << "No video mode available!" << std::endl;
	exit( 3 );
}

#ifdef VERBOSE
if( modes == (SDL_Rect **)-1 )
{
std::cout << “All resolutions available” << std::endl;
}
else
{
std::cout << “Available Modes” << std::endl;
for( int i=0; modes[i]; ++i )
std::cout << " " << modes[i]->w << " x " << modes[i]->h <<
std::endl;
}
#endif

m_window = SDL_SetVideoMode( m_iWindowWidth, m_iWindowHeight, 0, 

videoFlags );
SDL_WM_SetCaption( windowName, windowName );
#ifdef VERBOSE
std::cout << “SDL successfully initialized” << std::endl;
#endif

Thanks,
Mathieu Godart

It’s only talking about 2D hardware acceleration(which seems to be very hard
to get). SDL is a VERY thin layer overtop of OpenGL - design philosophy
seems to be ‘set it up and get out of the way’ - so SDL doesn’t know too much
about whatever OpenGL backend it’s running on. I think.On Sunday 30 March 2003 06:33 am, Mathieu Godart wrote:

Le samedi, 29 mars 2003, ? 23:15 Europe/Paris, Darrell Walisser a ?crit

The only way to get some acceleration is to use OpenGL - but
unfortunately the way OpenGL works doesn’t fit well within SDL’s 2D
API, so we haven’t been able to use it to accelerate 2D operations.

I’m sorry, I was not clear on that point : I’m writing a 3D game using
OpenGL. :wink:

But when I init the screen, it says that I don’t have any hw
acceleration. But is it talking about 2D or 3D ? I cannot get this ?

Message: 10

Le samedi, 29 mars 2003, =E0 23:15 Europe/Paris, Darrell Walisser a
=E9crit=20
:

The only way to get some acceleration is to use OpenGL - but
unfortunately the way OpenGL works doesn’t fit well within SDL’s 2D
API, so we haven’t been able to use it to accelerate 2D operations.

I’m sorry, I was not clear on that point : I’m writing a 3D game using

OpenGL. :wink:

But when I init the screen, it says that I don’t have any hw
acceleration. But is it talking about 2D or 3D ? I cannot get this ?

The SDL_GetVideoInfo() attributes only apply to 2D modes. If you pass
SDL_OPENGL to SDL_SetVideoMode(), SDL_SWSURFACE, SDL_HWSURFACE,
SDL_ASYNCBLIT, SDL_ANYFORMAT, SDL_HWPALETTE, and SDL_DOUBLEBUF are
invalid parameters.

Currently, there isn’t a way in SDL to test for or demand hardware
OpenGL acceleration when you set the video mode (though the underlying
WGL, XGL, AGL, etc API’s support it, hint, hint SDL 1.3 ;-).

Usually this lack of acceleration will be painfully obvious (due to
incredible slowness). To see if you got hardware accelerated OpenGL,
you could use glGetString(GL_RENDERER) or glGetString(GL_VENDOR); If it
doesn’t say ATI or NVidia (on Mac OS X), you’ve got a software renderer.

Oh, by the way, older Macs (~ 1998-99) with the Rage Pro series
graphics chips have no hardware OpenGL drivers in Mac OS X. You’ll get
the Apple software renderer on these systems.

Cheers,
DarrellOn Sunday, March 30, 2003, at 03:02 PM, sdl-request at libsdl.org wrote:

Date: Sun, 30 Mar 2003 14:33:44 +0200
Subject: Re: [SDL] No hardware on Macs ?
From: Mathieu Godart
To: sdl at libsdl.org
Reply-To: sdl at libsdl.org