glClearColor() problem

I have the following code:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#include "SDL.h"
#include "SDL_opengl.h"
#include <iostream>

int main(int argc, char* args[]){
    SDL_Init(SDL_INIT_EVERYTHING);

    SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 8);
    SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 8);
    SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 8);
    SDL_GL_SetAttribute(SDL_GL_ALPHA_SIZE, 8);
    SDL_GL_SetAttribute(SDL_GL_BUFFER_SIZE, 32);
    SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 16);
    SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);

    SDL_WM_SetCaption("Game Window", NULL);

    SDL_SetVideoMode(600, 400, 32, SDL_OPENGL);

    glClearColor(1,1,1,1);
    glViewport(0,0,600,400);

    glShadeModel(GL_SMOOTH);

    glMatrixMode(GL_PROJECTION);
    glLoadIdentity();

    glDisable(GL_DEPTH_TEST);

    SDL_Delay(8000);

    SDL_Quit();
    return 0;
}


I am using Code Blocks as IDE with mingw32 compiler. I have downloaded SDL library and configured Code Blocks to use it. I have also added some linker parameters like -lmingw32 -lSDLmain -lSDL -lopengl32 -lglu32. The problem is that when i run the program the background is white not black as it should be. It stays open for 8s and then closes. Can someone please give me some suggestions on what can be wrong?
Last edited on
Topic archived. No new replies allowed.