[SDL] Multisampling crash problem

Will willeom at gmail.com
Mon Jul 16 10:50:25 PDT 2007


> What platform is this crashing on? What version of SDL and the OS?

Sorry, I'm using SDL-1.2.11 on windows vista compiled with MinGW GCC through the
Code::Blocks IDE.

I get this message when run:
 Checking for existence: C:\dev\C++\Expariment\sdl\sdl.exe
 Executing: "C:\dev\C++\Expariment\sdl\sdl.exe"  (in C:\dev\C++\Expariment\sdl\.)
 Process terminated with status 3 (0 minutes, 1 seconds)

For convenience, the full source follows:

#include <GL/gl.h>
#include <SDL.h>

int main (int argc,char** argv)
{
    //Initialize SDL video
    if ( SDL_Init( SDL_INIT_VIDEO ) < 0 )
        return 1;
    atexit(SDL_Quit);

    SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER,1);
    SDL_GL_SetAttribute(SDL_GL_MULTISAMPLEBUFFERS,1);
    SDL_GL_SetAttribute(SDL_GL_MULTISAMPLESAMPLES,4);

    SDL_Surface* screen = SDL_SetVideoMode(640, 480, 32, SDL_OPENGL);
    if ( !screen )
        return 1;

    //Ant-Aliasing disabled by user
    SDL_GL_SetAttribute(SDL_GL_MULTISAMPLEBUFFERS,0);
    SDL_GL_SetAttribute(SDL_GL_MULTISAMPLESAMPLES,0);
    screen = SDL_SetVideoMode(640, 480, 32, SDL_OPENGL);
    if ( !screen )
        return 1;

    glScalef(0.5f,0.5f,0.5f);

    // program main loop
    bool done = false;
    while (!done)
    {
        // message processing loop
        SDL_Event event;
        while (SDL_PollEvent(&event))
        {
            switch (event.type)
            {
                case SDL_QUIT:
                    done = true;
                    break;
                case SDL_KEYDOWN:
                    if (event.key.keysym.sym == SDLK_ESCAPE)
                        done = true;
                    break;
            }
        }

        glClear(GL_COLOR_BUFFER_BIT);
        glRotatef((22.0f/7.0f)*(1.0f/128.0f),0,0,1);
        glBegin(GL_TRIANGLES);
            glColor3ub(255,0,0);
            glVertex2f(-1,-1);
            glColor3ub(0,255,0);
            glVertex2f(1,-1);
            glColor3ub(0,0,255);
            glVertex2f(0,1);
        glEnd();

        SDL_GL_SwapBuffers();
    }

    return 0;
}






More information about the SDL mailing list