I have problem with compiling c code which worked earlier before updating o OS X Mavericks.
#include <GL/gl.h>
#include <GL/glu.h>
#include <GL/glx.h>
#include <stdio.h>
#include <stdlib.h>
#include <X11/Xutil.h>
#include <X11/Xlib.h>
#include <GL/glx.h>
char WINDOW_NAME[] = "Graphics Window";
char ICON_NAME[] = "Icon";
Display *display;
int screen;
Window main_window;
unsigned long foreground, background;
static int snglBuf[] = {GLX_RGBA, GLX_RED_SIZE, 1, GLX_GREEN_SIZE, 1, GLX_BLUE_SIZE, 1, GLX_DEPTH_SIZE, 12, None};
static int dblBuf[] = {GLX_RGBA, GLX_RED_SIZE, 1, GLX_GREEN_SIZE, 1, GLX_BLUE_SIZE, 1, GLX_DEPTH_SIZE, 12,GLX_DOUBLEBUFFER, None};
Bool doubleBuffer = True;
XVisualInfo *vi;
GLXContext cx;
Colormap cmap;
XSetWindowAttributes swa;
Bool recalcModelView = True;
int dummy;
void connectX()
{
display = XOpenDisplay(NULL);
if (display == NULL) {fprintf(stderr, "Cannot connect to X\n");
exit(1);}
screen = DefaultScreen(display);
if (!glXQueryExtension(display, &dummy, &dummy)){
fprintf(stderr, "X server has no OpenGL GLX Extension\n");
exit(1);}
vi = glXChooseVisual(display, screen, dblBuf);
if (vi == NULL){
fprintf(stderr, "Double Buffering not available\n");
vi = glXChooseVisual(display, screen, snglBuf);
if (vi == NULL) fprintf(stderr, "No RGB Visual with depth buffer\n");
doubleBuffer = False;
}
if (doubleBuffer == True) fprintf(stderr, "We have double buffering\n");
if (vi->class != TrueColor){
fprintf(stderr, "Need a TrueColor visual\n");
exit(1);
}
cx = glXCreateContext(display, vi , None, True);
if (cx == NULL){
fprintf(stderr, "No rendering context\n");
exit(1);
}
else printf(stderr, "We have a rendering context\n");
cmap = XCreateColormap(display, RootWindow(display, vi->screen),
vi->visual, AllocNone);
if (cmap == NULL){
fprintf(stderr, "Color map is not available\n");
exit(1);
}
swa.colormap = cmap;
swa.border_pixel = 0;
swa.event_mask = ExposureMask | ButtonPressMask | StructureNotifyMask |
KeyPressMask;
}
Window openWindow(int x, int y, int width, int height,
int border_width, int argc, char** argv)
{
XSizeHints size_hints;
Window new_window;
new_window = XCreateWindow(display, RootWindow(display, vi->screen),
x,y, width, height, border_width, vi->depth, InputOutput,
vi->visual, CWBorderPixel | CWColormap | CWEventMask,
&swa);
size_hints.x = x;
size_hints.y = y;
size_hints.width = width;
size_hints.height = height;
size_hints.flags = PPosition | PSize;
XSetStandardProperties(display, new_window, WINDOW_NAME, ICON_NAME,
None, argv, argc, &size_hints);
XSelectInput(display, new_window, (ButtonPressMask | KeyPressMask |
StructureNotifyMask | ExposureMask));
return (new_window);
}
void init(void)
{
const GLubyte *renderer = glGetString(GL_RENDERER);
const GLubyte *vendor = glGetString(GL_VENDOR);
const GLubyte *version = glGetString(GL_VERSION);
const GLubyte *glslversion = glGetString(GL_SHADING_LANGUAGE_VERSION);
GLint major, minor;
//glGetIntegerv(GL_MAJOR_VERSION, &major);
//glGetIntegerv(GL_MINOR_VERSION, &minor);
printf("GL_VENDOR : %s\n", vendor);
printf("GL_RENDERER : %s\n", renderer);
printf("GL_VERSION (string) : %s\n", version);
//printf("GL_VERSION (int) : %d.%d\n", major, minor);
printf("GLSL Version : %s\n", glslversion);
}
void disconnectX()
{
XCloseDisplay(display);
exit(0);
}
void doKeyPressEvent(XKeyEvent *pEvent)
{
int key_buffer_size = 10;
char key_buffer[9];
XComposeStatus compose_status;
KeySym key_sym;
XLookupString(pEvent, key_buffer, key_buffer_size,
&key_sym, &compose_status);
switch(key_buffer[0]){
case 'q':
exit(0);
break;
}
}
void redraw(void)
{
glClear(GL_COLOR_BUFFER_BIT);
glShadeModel(GL_SMOOTH);
glBegin(GL_POLYGON);
glColor3f(1.0,0.0,0.0);
glVertex2f(-0.9,-0.9);
glColor3f(0.0,1.0,0.0);
glVertex2f(0.9,-0.9);
glColor3f(0.0,0.0,1.0);
glVertex2f(0.0,0.9);
glEnd();
if (doubleBuffer) glXSwapBuffers(display,main_window); else
glFlush();
fprintf(stderr, "redraw called\n");
}
void doButtonPressEvent(XButtonEvent *pEvent)
{
fprintf(stderr, "Mouse button pressed\n");
}
int main (int argc, char** argv){
XEvent event;
connectX();
main_window = openWindow(10,20,500,400,5, argc, argv);
glXMakeCurrent(display, main_window, cx);
XMapWindow(display, main_window);
glClear(GL_COLOR_BUFFER_BIT);
init();
/*glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glFrustum(-1.0,1.0, -1.0, 1.0,0.0,10.0);*/
while(1){
do{
XNextEvent(display, &event);
switch (event.type){
case KeyPress:
doKeyPressEvent(&event);
break;
case ConfigureNotify:
glViewport(0,0, event.xconfigure.width, event.xconfigure.height);
case Expose:
redraw();
break;
case ButtonPress:
doButtonPressEvent(&event);
break;
}
}
while (True); //XPending(display));
}
}
I get this error:
ld: symbol(s) not found for architecture x86_64 clang: error: linker
command failed with exit code 1 (use -v to see invocation)
I've already install XQuartz and I'm using -I/opt/X11/include and -L/opt/X11/lib.
OpenGL programs which don't use X11 work perfectly.
#Giorgi Shavgulidze, I think my issue is similar. I had code that compiled fine with Mountain Lion. I upgraded to Mavericks. I go to recompile the code with Mavericks and Xcode 5.0.2, and glEnable(GL_SMOOTH) is causing an error. I just commented the line out and everything is fine. Why I do not know...
I know this is probably a little late for you, however, I believe this may help someone else.
I recently had essentially the exact same problem. It is important to note the difference between including something and linking to it in regards to compiling c code through methods such as gcc, as Andon mentioned above. A good SO post about this can be found here.
Your postbin shows that you are not linking properly to both OpenGL and X11. To link to them, you need to add links to your gcc command. My understanding is that you can either link to them through another path specific to your computer, via -L, or you can use pre-made links in your gcc command, which seems to be the far simpler option.
In regards to X11, while you do link to the directory holding the X11 libraries via -L/opt/X11/lib, you do not specify which library(s) you want to use. I believe the additional link you would need for X11 is -lX11.
In regards to OpenGL, you would use a different flag. While I have not used OpenGL (only used GL), my understanding is these are the appropriate flags you would have to use: -lGLU -lglut.
It is also important to note that order matters when linking and libraries should always go last.
I have included my gcc command, even though it is slightly different than what you would need, as an example.
gcc -I/opt/X11/include -L/opt/X11/lib -lX11 -lncurses -lGL spitmat8w_3.c -o hello
Related
A very easy/hard question.
What packages do i need to download to be able to create a simple X11 window with an EGL/OpenGLES contex.
As i have today the the problem with dri2 failing to authenticate.
But it can’t be that i link to the wrong library else it wouldn’t accept the X11 window at all at eglGetDisplay.
I really don’t want to use any library like glfw or sdl (wrapper
wrapper).
I use raspbian stretch with the default full KMS(driver by VMWare).
My Code is(if it matter's):
#include <X11/Xlib.h>
#include <EGL/egl.h>
#include <EGL/eglplatform.h>
#include <GLES2/gl2.h>
#include <iostream>
struct Pane {
Window win;
Display *display;
Atom windowDeletMessage;
int x11_file;
EGLDisplay egl_display;
EGLContext egl_context;
EGLSurface egl_surface;
EGLConfig egl_config;
EGLint egl_num_config;
EGLint egl_minor;
EGLint egl_major;
};
void setup_window(Pane &self) {
self.display = XOpenDisplay(nullptr);
if (self.display == nullptr) {
exit(0);
}
auto s = DefaultScreen(self.display);
self.win = XCreateSimpleWindow(self.display,
RootWindow(self.display, s),
10,
10,
800,
600,
1,
BlackPixel(self.display, s),
WhitePixel(self.display, s));
self.windowDeletMessage = XInternAtom(self.display, "WM_DELETE_WINDOW", false);
XSetWMProtocols(self.display, self.win, &self.windowDeletMessage, 1);
XStoreName(self.display, self.win, "Default Window");
XSelectInput(self.display,self.win, KeyPressMask | KeyReleaseMask | LeaveWindowMask | EnterWindowMask | PointerMotionMask | ResizeRedirectMask);
XMapWindow(self.display, self.win);
XFlush(self.display);
self.x11_file = ConnectionNumber(self.display);
}
void GetEvent(Pane &self, XEvent &e) {
// Event handling...
}
void setup_egl(Pane &self)
{
const EGLint Attributes[] = //Note to much is to much
{
EGL_RED_SIZE,8,
EGL_GREEN_SIZE,8,
EGL_BLUE_SIZE,8,
EGL_ALPHA_SIZE,8,
EGL_NONE,
};
self.egl_display = eglGetDisplay(self.display);
if(self.egl_display == EGL_NO_DISPLAY)
{
printf("EGL Failed to Obtain Window!") // Note this is not Error handling!
exit(103);
}
if(eglInitialize(self.egl_display,&self.egl_major,&self.egl_minor) == EGL_FALSE)
{
printf("EGL Failed to Initzialize!""");
exit(104);
};
eglChooseConfig(self.egl_display, Attributes, &self.egl_config, 1, &self.egl_num_config);
self.egl_context = eglCreateContext(self.egl_display, self.egl_config,EGL_NO_CONTEXT,nullptr);
self.egl_surface = eglCreateWindowSurface(self.egl_display, self.egl_config, self.win, nullptr);
eglMakeCurrent(self.egl_display, self.egl_surface, self.egl_surface, self.egl_context);
glClearColor(1.0f, 1.0f, 1.0f, 1.0f);
glClear(GL_COLOR_BUFFER_BIT);
glFlush();
eglSwapBuffers(self.display, self.egl_surface);
}
int main(int argc, char **argv) {
Pane pane;
setup_window(pane);
setup_egl(pane);
XEvent e;
while (true) {
GetEvent(pane, e);
glClear(GL_COLOR_BUFFER_BIT);
}
}
Edit:
As i used an USB-Drive to boot and not the SD Card. So raspi-config couldn't access the config file on the SD Card and a such it could not enable full KMS.
When I try to run over 128 current OpenGLX rendering contexts on individual threads, the call to glXMakeCurrent starts failing.
Display *display = XOpenDisplay(":0")
Window root_win = RootWindow(display, screen);
Window win = XCreateWindow (display, root_win, ...)
GLXContext context = glXCreateContext(display, visinfo, 0, True);
glXMakeCurrent(display, win, context); <---- Fails here on 128th
This issue only occurs with proprietary Nvidia drivers and Nvidia GPUs. I was not able to reproduce with Intel GPUs.
Reproduction code glx.cpp:
#include <GL/gl.h>
#include <GL/glu.h>
#include <GL/glx.h>
#include <GL/glxext.h>
#include <string.h>
#include <unistd.h>
#include <thread>
#include <vector>
#include <mutex>
#include <condition_variable>
#include <chrono>
#define MAX_CONTEXTS 200;
std::mutex mutex;
std::condition_variable cond;
bool will_stop = false;
int numSuccessfulContexts = 0;
#define EXIT_IF(condition, ...) if (condition) { printf(__VA_ARGS__); exit(EXIT_FAILURE);}
#define RETURN_IF(condition, ...) if (condition) { printf(__VA_ARGS__); stop(); return; }
void stop() {
std::lock_guard<std::mutex> lk(mutex);
will_stop = true;
cond.notify_all();
}
void createWindow() {
/* Init X and GLX */
Display *display = XOpenDisplay(":0.0");
RETURN_IF(!display, "Cannot open X display\n");
int screen = DefaultScreen(display);
Window root_win = RootWindow(display, screen);
RETURN_IF(!glXQueryExtension(display, 0, 0),"X Server doesn't support GLX extension\n");
/* Pick an FBconfig and visual */
static const int attributeList[] = { None };
int fbcount;
GLXFBConfig *fbconfig = glXChooseFBConfig(display, screen, attributeList, &fbcount);
EXIT_IF(!fbconfig, "Failed to get GLXFBConfig\n");
XVisualInfo *visinfo = glXGetVisualFromFBConfig(display, *fbconfig);
EXIT_IF(!visinfo, "Failed to get XVisualInfo\n");
/* Create the X window */
XSetWindowAttributes winAttr ;
winAttr.colormap = XCreateColormap(display, root_win, visinfo->visual, AllocNone);
unsigned int mask = CWColormap;
Window win = XCreateWindow (display, root_win, 256, 64, 320, 320, 0,
visinfo->depth, InputOutput, visinfo->visual, mask, &winAttr) ;
/* Create an OpenGL context and attach it to our X window */
GLXContext context = glXCreateContext(display, visinfo, 0, True);
EXIT_IF(!context, "Could not create GL context\n");
RETURN_IF(! glXMakeCurrent(display, win, context), "glXMakeCurrent failed 1. \n");
RETURN_IF(!glXIsDirect (display, glXGetCurrentContext()), "Indirect GLX rendering context obtained\n");
RETURN_IF(!glXMakeCurrent(display, win, context), "glXMakeCurrent failed 2.\n");
numSuccessfulContexts++;
std::unique_lock<std::mutex> lk(mutex);
cond.wait(lk, [] {return will_stop;});
}
int main(int argc, char *argv[]) {
std::vector<std::thread> ts;
printf("Starting, your computer might become unresponsive...\n");
int maxContexts = MAX_CONTEXTS;
while (maxContexts--) {
ts.push_back(std::thread(&createWindow));
}
{
std::unique_lock<std::mutex> lk(mutex);
cond.wait_for(lk, std::chrono::seconds(10), []{return will_stop;});
}
if (!will_stop) {
stop();
}
for (auto& v: ts) {
v.join();
}
printf("Done. Max concurrent contexts: %d\n", numSuccessfulContexts);
return EXIT_SUCCESS;
}
Build & Run:
g++ -std=c++11 glx.cpp -L/usr/lib/nvidia-375 -lGL -lX11 -lGLU -lGLX -lpthread -o glx && ./glx
As discussed in the comments, it seems you're hitting a driver limitation because you're doing something highly unusual and unexpected. I'm answering this to remove it from the list of unanswered questions.
I am a SDL beginner.
I would like to draw a black background and a filled blue circle on it with SDL2. As there is no way to draw a circle with SDL2, I use SDL2_gfx. I have no problem to draw a black background, but I do not arrive to draw a circle with the function filledCircleRGBA.
#include <stdlib.h>
#include <stdio.h>
#include <stdbool.h>
#include <SDL2/SDL.h>
#include <SDL2/SDL2_gfxPrimitives.h>
#define DEFAULT_WINDOW_WIDTH 800
#define DEFAULT_WINDOW_HEIGHT 600
void
print_SDL_error()
{
fputs("SDL_Error: ", stderr);
fputs(SDL_GetError(), stderr);
fputc('\n', stderr);
}
bool
initSDL()
{
if(SDL_Init(SDL_INIT_VIDEO) < 0)
{
fprintf(stderr, "SDL could not initialize!\n");
print_SDL_error();
return false;
}
return true;
}
SDL_Window*
initMainWindow()
{
SDL_Window* window;
window = SDL_CreateWindow("SDL2 test",
SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED,
DEFAULT_WINDOW_WIDTH, DEFAULT_WINDOW_HEIGHT,
SDL_WINDOW_SHOWN);
if(window == NULL)
{
fprintf(stderr, "SDL could not create a window!\n");
print_SDL_error();
}
return window;
}
SDL_Window*
initSDLAndMainWindow(SDL_Window* * window)
{
return initSDL() ? initMainWindow() : NULL;
}
void
quit(SDL_Window* main_window)
{
SDL_DestroyWindow(main_window);
SDL_Quit();
}
int
main(int argc, char* argv[])
{
SDL_Window* main_window;
main_window = initMainWindow();
if(main_window == NULL)
{
quit(NULL);
return EXIT_FAILURE;
}
SDL_Renderer* main_window_renderer;
main_window_renderer = SDL_CreateRenderer(main_window, -1, SDL_RENDERER_ACCELERATED);
if(main_window_renderer == NULL)
{
fprintf(stderr, "Renderer could not be created!\n");
print_SDL_error();
quit(main_window);
return EXIT_FAILURE;
}
SDL_SetRenderDrawColor(main_window_renderer, 0, 0, 0, 0);
SDL_RenderClear(main_window_renderer);
SDL_RenderPresent(main_window_renderer);
SDL_Delay(2000);
if(filledCircleRGBA(main_window_renderer,
150, 150, 75,
0, 0, 255, 0) != 0)
{
fprintf(stderr, "A circle was not rendered!\n");
print_SDL_error();
SDL_DestroyRenderer(main_window_renderer);
quit(main_window);
return EXIT_FAILURE;
}
SDL_RenderPresent(main_window_renderer);
SDL_Delay(2000);
SDL_DestroyRenderer(main_window_renderer);
quit(main_window);
return EXIT_SUCCESS;
}
I am running under Debian GNU/Linux 8 "Jessie", and I use libsdl2-dev and libsdl2-gfx-dev of my distribution.
To compile, I use gcc -O0 -g sdl2-test.c `sdl2-config --cflags --libs` -lSDL2_gfx.
Moreover, valgrind notifies me that there are 21 errors from 21 contexts. 3 errors come from SDL2 calls, and 19 from nouveau_dri.so that I suppose to be the shared library used by nouveau driver (a free/libre driver for nVidia GPU) so this ones may not be my fault.
Thanks.
You are calling filledCircleRGBA with an alpha value of 0. Your circle is completely transparent.
For the errors reported by Valgrind, I just noticed you are not actually calling SDL_Init. This is causing some leaks, but not all of them. The others aren't caused by your code.
I also see some Conditional jump or move depends on uninitialised value(s). Valgrind can reports where the uninitialised value was created with the --track-origins=yes option, that way you can see if you passed an uninitialised value to a library function or if the error is in the function.
You can create a suppression file for Valgrind to hide the leaks that aren't yours. It is best to have the debug symbols for the libraries if you want to create rules specific enought to avoid hiding cases where you create something with an SDL function and don't destroy it.
I have recently purchased a new laptop and got a new version of VS from my school. And I'm having a little trouble setting up my libraries.
I created a basic SDL_Window, as well as a SDL_GLContext.
I'm able to include my libraries and run the program, but I can't call functions like glClearColor, or glGetString(GL_VERSION). I get a rather strage warning and an error that I have never seen before, I'm guessing it's related to the 2013 version?
I have tried ignoring all specific default libraries, as well as trying to change the programtype (Multithreaded DLL, those 4).
And I have made sure all the dll-files are in place in my system folder.
What makes me wonder is the fact that glewInit() works, but not glClearColor() etc...
Output:
1>MSVCRTD.lib(cinitexe.obj) : warning LNK4098: defaultlib 'msvcrt.lib'
conflicts with use of other libs; use /NODEFAULTLIB:library
1>Window.obj : error LNK2019: unresolved external symbol
__imp__glClearColor#16 referenced in function "public: void __thiscall Window::initOpenGL(void)" (?initOpenGL#Window##QAEXXZ)
1>C:\Users\Aleksander\documents\visual studio 2013\Projects\OpenGL
Test\Debug\OpenGL Test.exe : fatal error LNK1120: 1 unresolved
externals
Header:
#pragma once
#include <SDL.h> //Tested OK
#include <SDL_image.h> //Tested OK
#include <SDL_mixer.h> //Tested OK
#include <SDL_net.h> //Tested OK
#include <OpenGL\glew.h> //?
#include <freeglut\freeglut.h> //?
#include <gl\GL.h> //?
#include <glm\glm.hpp> //Tested OK
#include <iostream> //Standard OK
#include <Box2D\Box2D.h> //Tested OK
using namespace std;
class Window {
SDL_Window *window;
SDL_GLContext context;
bool quit;
public:
Window();
~Window();
void initSDL();
void initOpenGL();
void run();
};
Source:
#include "Window.h"
Window::Window() {
printf("Starting window...\n");
//Initialize window
quit = false;
initSDL();
initOpenGL();
//Run window
run();
}
Window::~Window() {
printf("Closing window...\n");
//Clear window memory
SDL_GL_DeleteContext(context);
SDL_DestroyWindow(window);
//Close window library
SDL_Quit();
}
void Window::initSDL() {
if (SDL_Init(SDL_INIT_EVERYTHING) == -1) {
quit = true;
printf("Unable to initialize SDL!\n");
}
else {
//Create window
const char *title = "OpenGL Test";
int pos = SDL_WINDOWPOS_CENTERED;
int w = 800;
int h = 600;
Uint32 flags = SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN;
window = SDL_CreateWindow(title, pos, pos, w, h, flags);
//Create OpenGL context
SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 8);
SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 8);
SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 8);
SDL_GL_SetAttribute(SDL_GL_ALPHA_SIZE, 8);
SDL_GL_SetAttribute(SDL_GL_BUFFER_SIZE, 32);
SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
context = SDL_GL_CreateContext(window);
}
}
void Window::initOpenGL() {
GLenum init = glewInit();
if (init != GLEW_OK) {
quit = true;
printf("Unable to initialize OpenGL!\n");
printf("Error: %s!\n", glewGetErrorString(init));
}
else {
//printf("Vendor: %s\n", glGetString(GL_VENDOR));
//printf("Version: %s\n", glGetString(GL_VERSION));
//printf("Renderer: %s\n", glGetString(GL_RENDERER));
}
}
void Window::run() {
printf("Window started running!\n");
SDL_Event event;
while (!quit) {
SDL_GL_SwapWindow(window);
while (SDL_PollEvent(&event)) {
if (event.type == SDL_QUIT) {
quit = true;
}
}
}
}
I've been having a lot of trouble trying to render text in SDL with TTF to an SDL window. I'm a little new to C++ and would like this explained in a bit of a 'newbie' way. (with some example code, if possible?)
Thanks!
Here is a simple example. Make sure that you have arial.ttf, or your truetype font of choice in your directory. You will need to link with -lSDL -lSDL_ttf.
#include "SDL.h"
#include "SDL_ttf.h"
SDL_Surface* screen;
SDL_Surface* fontSurface;
SDL_Color fColor;
SDL_Rect fontRect;
SDL_Event Event;
TTF_Font* font;
//Initialize the font, set to white
void fontInit(){
TTF_Init();
font = TTF_OpenFont("arial.ttf", 12);
fColor.r = 255;
fColor.g = 255;
fColor.b = 255;
}
//Print the designated string at the specified coordinates
void printF(char *c, int x, int y){
fontSurface = TTF_RenderText_Solid(font, c, fColor);
fontRect.x = x;
fontRect.y = y;
SDL_BlitSurface(fontSurface, NULL, screen, &fontRect);
SDL_Flip(screen);
}
int main(int argc, char** argv)
{
// Initialize the SDL library with the Video subsystem
SDL_Init(SDL_INIT_VIDEO | SDL_INIT_NOPARACHUTE);
//Create the screen
screen = SDL_SetVideoMode(320, 480, 0, SDL_SWSURFACE);
//Initialize fonts
fontInit();
//Print to center of screen
printF("Hello World", screen->w/2 - 11*3, screen->h/2);
do {
// Process the events
while (SDL_PollEvent(&Event)) {
switch (Event.type) {
case SDL_KEYDOWN:
switch (Event.key.keysym.sym) {
// Escape forces us to quit the app
case SDLK_ESCAPE:
Event.type = SDL_QUIT;
break;
default:
break;
}
break;
default:
break;
}
}
SDL_Delay(10);
} while (Event.type != SDL_QUIT);
// Cleanup
SDL_Quit();
return 0;
}