Ginga  0.13.6.1771-df200
The iTV middleware.
aux-gl.h
Go to the documentation of this file.
1 /* Copyright (C) 2006-2017 PUC-Rio/Laboratorio TeleMidia
2 
3 This file is part of Ginga (Ginga-NCL).
4 
5 Ginga is free software: you can redistribute it and/or modify it
6 under the terms of the GNU General Public License as published by
7 the Free Software Foundation, either version 2 of the License, or
8 (at your option) any later version.
9 
10 Ginga is distributed in the hope that it will be useful, but WITHOUT
11 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
13 License for more details.
14 
15 You should have received a copy of the GNU General Public License
16 along with Ginga. If not, see <http://www.gnu.org/licenses/>. */
17 
18 #ifndef AUX_GL_H
19 #define AUX_GL_H
20 
21 #if defined WITH_OPENGL && WITH_OPENGL
22 # define GL_GLEXT_PROTOTYPES 1
23 # if defined WITH_OPENGLES2 && WITH_OPENGLES2
24 # include <GLES2/gl2.h>
25 # include <GLES2/gl2ext.h>
26 # else
27 # include <GL/gl.h>
28 # include <GL/glext.h>
29 # endif
30 # define WITH_OPENGLES2 0
31 #else
32 typedef unsigned int GLuint;
33 typedef float GLfloat;
34 #endif
35 
36 #include "ginga.h"
37 
38 #define CHECK_GL_ERROR() \
39  G_STMT_START \
40  { \
41  GLenum glerror; \
42  if ((glerror = glGetError ()) != GL_NO_ERROR) \
43  { \
44  ERROR ("OpenGL error (%d) in %s:%d.", (int) glerror, \
45  __FILE__, __LINE__); \
46  } \
47  } \
48  G_STMT_END
49 
50 class GL {
51 
52 public:
53  static void init ();
54  static void beginDraw ();
55 
56  static void clear_scene (int w, int h);
57 
58  static void create_texture (GLuint *);
59  static void create_texture (GLuint *, int, int, unsigned char *);
60  static void delete_texture (GLuint *);
61 
62  static void update_texture (GLuint, int, int, unsigned char*);
63  static void update_subtexture (GLuint, int, int, int, int, unsigned char *);
64 
65  static void draw_quad (int, int, int, int, GLuint, GLfloat a = 1.0f);
66  static void draw_quad (int, int, int, int,
68 };
69 
70 #endif // AUX_GINGA_H
static void clear_scene(int w, int h)
GL::clear_scene Clear and configure OpenGL context.
Definition: aux-gl.cpp:229
static void create_texture(GLuint *)
GL::create_texture Creates a new uninitialized OpenGL texture.
Definition: aux-gl.cpp:262
unsigned int GLuint
Definition: aux-gl.h:32
static void draw_quad(int, int, int, int, GLuint, GLfloat a=1.0f)
GL::draw_quad Draws a textured rectangle.
Definition: aux-gl.cpp:364
static void init()
GL::init Initiliazes the OpenGL context.
Definition: aux-gl.cpp:131
static void delete_texture(GLuint *)
GL::delete_texture Deletes the texture.
Definition: aux-gl.cpp:302
static void update_subtexture(GLuint, int, int, int, int, unsigned char *)
GL::update_subtexture Updates subtexture with the data content.
Definition: aux-gl.cpp:338
float GLfloat
Definition: aux-gl.h:33
Definition: aux-gl.h:50
static void update_texture(GLuint, int, int, unsigned char *)
GL::update_texture Updates texture with the data content.
Definition: aux-gl.cpp:320
static void beginDraw()
Definition: aux-gl.cpp:201