Hi I am trying to organise my first boiler plate code for Opengl and SDL2.0 window on linux in C++ or C I plan to change he code to keep the window open and constantly re-draw the sceen to make animations using a true while loop and set it to break the loop with EOF, for the time being why is the screen not appearing black and just appearing transparent, is my opengl code in the right place?or am I missing some code to blank the screen? thanks.
/*
* -lSDL2
* -lGL -lGLU -lglut
*/
#include <SDL2/SDL.h>
#include <stdio.h>
#include <GL/gl.h>
#include <GL/glu.h>
#include <GL/glut.h>
int main(int argc, char* argv[])
{
SDL_Window *window;
SDL_Init(SDL_INIT_VIDEO);
//Create an application window with the following settings
window = SDL_CreateWindow(
"An SDL2 Window",
SDL_WINDOWPOS_UNDEFINED,
SDL_WINDOWPOS_UNDEFINED,
640,
480,
SDL_WINDOW_OPENGL
);
if (window == NULL) {
printf("Could not create window: %s\n",SDL_GetError());
return 1;
}
glClearColor(0.0,0.0,0.0,0.0);
glClear(GL_COLOR_BUFFER_BIT);
SDL_Delay(3000);
SDL_DestroyWindow(window);
SDL_Quit();
return 0;
}