UltraGrid
UltraGrid Low-Latency High-Resolution Transmission System
Loading...
Searching...
No Matches
sdl_window.hpp
Go to the documentation of this file.
1
5/*
6 * Copyright (c) 2010-2021 CESNET, z. s. p. o.
7 * All rights reserved.
8 *
9 * Redistribution and use in source and binary forms, with or without
10 * modification, is permitted provided that the following conditions
11 * are met:
12 *
13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 *
16 * 2. Redistributions in binary form must reproduce the above copyright
17 * notice, this list of conditions and the following disclaimer in the
18 * documentation and/or other materials provided with the distribution.
19 *
20 * 3. Neither the name of CESNET nor the names of its contributors may be
21 * used to endorse or promote products derived from this software without
22 * specific prior written permission.
23 *
24 * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS
25 * "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING,
26 * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
27 * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
28 * EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
29 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
30 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
31 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
32 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
33 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
34 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
35 * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36 */
37#ifndef SDL_WINDOW_HPP
38#define SDL_WINDOW_HPP
39
40#ifdef HAVE_CONFIG_H
41# include "config.h"
42#endif //HAVE_CONFIG_H
43
44#ifdef __APPLE__
45# include <OpenGL/OpenGL.h> // CGL
46# include <OpenGL/gl3.h>
47# include <OpenGL/glext.h>
48#elif defined __linux__
49# include <X11/Xlib.h>
50# include <GL/glew.h>
51# include <GL/glx.h>
52#else // _WIN32
53# include <GL/glew.h>
54#endif //__APPLE__
55
56
57
58#include <string>
59#include <SDL2/SDL.h>
60
71 Sdl_window(bool double_buffer = false);
72
87 Sdl_window(const char *title,
88 int x, int y, int w, int h,
89 Uint32 flags, bool double_buffer = false);
90
92
93 Sdl_window(const Sdl_window&) = delete;
95 Sdl_window& operator=(const Sdl_window&) = delete;
96 Sdl_window& operator=(Sdl_window&& o) { swap(o); return *this; }
97
98#ifdef __linux__
102 void getXlibHandles(Display **xDisplay,
103 GLXContext *glxContext,
104 GLXDrawable *glxDrawable);
105#endif // defined __linux__
106
112 void set_title(const std::string& title){
113 SDL_SetWindowTitle(sdl_window, title.c_str());
114 }
115
121
127
133 SDL_GLContext get_worker_context();
134
135 void swap(Sdl_window& o);
136
137 SDL_Window *sdl_window;
138 SDL_GLContext sdl_gl_context;
139 SDL_GLContext sdl_gl_worker_context = nullptr;
140 int width;
142};
143
144#endif //SDL_WINDOW_HPP
const char unsigned int flags
Sdl_window(bool double_buffer=false)
Sdl_window(Sdl_window &&o)
void set_title(const std::string &title)
void swap(Sdl_window &o)
void make_render_context_current()
Sdl_window(const Sdl_window &)=delete
SDL_GLContext sdl_gl_context
Sdl_window & operator=(Sdl_window &&o)
SDL_GLContext get_worker_context()
SDL_GLContext sdl_gl_worker_context
void make_worker_context_current()
SDL_Window * sdl_window
Sdl_window & operator=(const Sdl_window &)=delete