X-Git-Url: https://git.ralfj.de/gltest.git/blobdiff_plain/aa4575e1aa768daff8ca10c7a8a06aa0603e998f..a0cb14324fbd2791d62df09e8d10541f280b60ee:/glwindow.cpp diff --git a/glwindow.cpp b/glwindow.cpp index 67e9b9a..64d0075 100644 --- a/glwindow.cpp +++ b/glwindow.cpp @@ -1,4 +1,23 @@ +/* gltest - small OpenGL tearing test program + * Copyright (C) 2012-2013 Ralf Jung + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + #include "glwindow.h" +#include "glutil.h" #include #include @@ -28,22 +47,6 @@ void GLWindow::create(unsigned int width, unsigned int height) winAttr.event_mask = ExposureMask | KeyPressMask | ButtonPressMask | StructureNotifyMask; winAttr.border_pixel = 0; // create window - /*if (fullscreen) { - // get root window size - width = DisplayWidth(display, vi->screen); - height = DisplayHeight(display, vi->screen); - printf("Display size: %dx%d\n", width, height); - // set window attributes - winAttr.override_redirect = True; - window = XCreateWindow(display, RootWindow(display, vi->screen), - 0, 0, width, height, 0, vi->depth, InputOutput, vi->visual, - CWBorderPixel | CWColormap | CWEventMask | CWOverrideRedirect, &winAttr); - XWarpPointer(display, None, window, 0, 0, 0, 0, 0, 0); - XMapRaised(display, window); - XGrabKeyboard(display, window, True, GrabModeAsync, GrabModeAsync, CurrentTime); - XGrabPointer(display, window, True, ButtonPressMask, GrabModeAsync, GrabModeAsync, window, None, CurrentTime); - } - else {*/ printf("Initial window size: %dx%d\n", width, height); // create a window in window mode window = XCreateWindow(display, RootWindow(display, vi->screen), @@ -58,6 +61,7 @@ void GLWindow::create(unsigned int width, unsigned int height) this->width = width; this->height = height; backend->createContext(window); + printf("Using GL version: %s\n", glGetString(GL_VERSION)); initGL(); resizeGL(width, height); } @@ -122,8 +126,6 @@ void GLWindow::exec() if (strcmp(XGetAtomName(display, event.xclient.message_type), "WM_PROTOCOLS") == 0 && strcmp(XGetAtomName(display, event.xclient.data.l[0]), "WM_DELETE_WINDOW") == 0) { - XDestroyWindow(display, window); - window = 0; return; } break;