Valkka  1.6.1
OpenSource Video Management
opengl.h
Go to the documentation of this file.
1 #ifndef OPENGL_HEADER_GUARD
2 #define OPENGL_HEADER_GUARD
3 
4 /*
5  * opengl.h : OpenGL calls for reserving PBOs and TEXtures, plus some auxiliary routines
6  *
7  * (c) Copyright 2017-2024 Sampsa Riikonen
8  *
9  * Authors: Sampsa Riikonen <sampsa.riikonen@iki.fi>
10  *
11  * This file is part of the Valkka library.
12  *
13  * Valkka is free software: you can redistribute it and/or modify
14  * it under the terms of the GNU Lesser General Public License as
15  * published by the Free Software Foundation, either version 3 of the
16  * License, or (at your option) any later version.
17  *
18  * This program is distributed in the hope that it will be useful,
19  * but WITHOUT ANY WARRANTY; without even the implied warranty of
20  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21  * GNU Lesser General Public License for more details.
22  *
23  * You should have received a copy of the GNU Lesser General Public License
24  * along with this program. If not, see <https://www.gnu.org/licenses/>
25  *
26  */
27 
38 #include "frame.h"
39 #include "constant.h"
40 //#include<GL/glew.h>
41 //#include<GL/glx.h>
42 //#include<GL/glxext.h>
43 
44 
45 int is_glx_extension_supported(Display *dpy, const char *query);
46 
50 namespace glx_attr { // https://stackoverflow.com/questions/11623451/static-vs-non-static-variables-in-namespace
51  static int singleBufferAttributes[] = {
52  GLX_DRAWABLE_TYPE, GLX_WINDOW_BIT,
53  GLX_RENDER_TYPE, GLX_RGBA_BIT,
54  GLX_RED_SIZE, 1, // Request a single buffered color buffer
55  GLX_GREEN_SIZE, 1, // with the maximum number of color bits
56  GLX_BLUE_SIZE, 1, // for each component
57  None
58  };
59  static int doubleBufferAttributes[] = {
60  GLX_DRAWABLE_TYPE, GLX_WINDOW_BIT,
61  GLX_RENDER_TYPE, GLX_RGBA_BIT,
62  GLX_DOUBLEBUFFER, True, // Request a double-buffered color buffer with
63  GLX_RED_SIZE, 1, // the maximum number of bits per component
64  GLX_GREEN_SIZE, 1,
65  GLX_BLUE_SIZE, 1,
66  None
67  };
68 };
69 
70 
74 int readbytes(const char* fname, char*& buffer);
75 int readyuvbytes(const char* fname, GLubyte*& Y, GLubyte*& U, GLubyte*& V);
76 void zeroyuvbytes(int ysize, GLubyte*& Y, GLubyte*& U, GLubyte*& V);
77 
78 void getPBO(GLuint& index, GLsizei size, GLubyte*& payload);
79 void releasePBO(GLuint* index, GLubyte* payload);
80 
81 void getTEX(GLuint& index, GLint internal_format, GLint format, GLsizei w, GLsizei h);
82 
86 #endif
Constant/default values, version numbers.
Frame classes.
int readyuvbytes(const char *fname, GLubyte *&Y, GLubyte *&U, GLubyte *&V)
Auxiliary routine for testing.
Definition: opengl.cpp:82
void getTEX(GLuint &index, GLint internal_format, GLint format, GLsizei w, GLsizei h)
Get texture from the GPU.
Definition: opengl.cpp:185
int readbytes(const char *fname, char *&buffer)
Definition: opengl.cpp:62
void zeroyuvbytes(int ysize, GLubyte *&Y, GLubyte *&U, GLubyte *&V)
Auxiliary routine for testing.
Definition: opengl.cpp:126
void getPBO(GLuint &index, GLsizei size, GLubyte *&payload)
Get PBO from the GPU. There are two versions of this function: other one can be enabled in source for...
Definition: opengl.cpp:157
GLX parameter groups.
Definition: opengl.h:50
int is_glx_extension_supported(Display *dpy, const char *query)
// ripped off from glxgears.c Determine whether or not a GLX extension is supported.
Definition: opengl.cpp:45