PnP Bios, on 07 December 2011 - 05:23 PM, said:
Yes, the code is exactly the same as the tutorial. I downloaded the template package.
int main( int argc, char **argv )
{
redirectIO();
printf( "application started.\n" );
SDL_Init( SDL_INIT_VIDEO );
SDL_SetVideoMode( SCRWIDTH, SCRHEIGHT, 32, SDL_OPENGL );
SDL_EnableKeyRepeat( 0, 0 );
bool vbo = true;
if (!init())
{
SDL_SetVideoMode( SCRWIDTH, SCRHEIGHT, 32, SDL_HWSURFACE|SDL_DOUBLEBUF );
SDL_Surface* s = SDL_GetVideoSurface(); //
surface = new Surface( SCRWIDTH, SCRHEIGHT, (Pixel*)s->pixels, s->pitch ); // Error
surface->InitCharset();
vbo = false;
SDL_WM_SetCaption( "Template - FALLBACK", NULL );
}
else SDL_WM_SetCaption( "Template", NULL );
int exitapp = 0;
game = new Game();
game->SetTarget( surface );
while (!exitapp)
{
if (vbo) // frame buffer swapping for VBO mode
{
swap();
surface->SetBuffer( (Pixel*)framedata );
}
else // frame buffer swapping for fall-back path
{
SDL_Surface* s = SDL_GetVideoSurface();
SDL_UpdateRect( s, 0, 0, 0, 0 );
framedata = (unsigned char*)s->pixels;
surface->SetPitch( s->pitch / 4 );
surface->SetBuffer( (Pixel*)framedata );
}
if (firstframe)
{
game->Init();
firstframe = false;
}
// calculate frame time and pass it to game->Tick
LARGE_INTEGER start, end;
QueryPerformanceCounter( &start );
game->Tick( (float)lastftime );
QueryPerformanceCounter( &end );
lastftime = float( end.QuadPart - start.QuadPart ) / float( ticksPS.QuadPart / 1000 );
// event loop
//...event stuff
SDL_Quit();
return 1;
}
Reedbeta, on 07 December 2011 - 06:07 PM, said:
Double-check that your graphics drivers are up-to-date.
They are up-to-date.
I just don't get it..
Looks like more people have the same problem:
http://webcache.goog...l&ct=clnk&gl=nl
but the answers in this topic are not really clearly.