anatomist  5.1.2
3D neuroimaging data viewer
glcaps.h
Go to the documentation of this file.
1 /* This software and supporting documentation are distributed by
2  * Institut Federatif de Recherche 49
3  * CEA/NeuroSpin, Batiment 145,
4  * 91191 Gif-sur-Yvette cedex
5  * France
6  *
7  * This software is governed by the CeCILL-B license under
8  * French law and abiding by the rules of distribution of free software.
9  * You can use, modify and/or redistribute the software under the
10  * terms of the CeCILL-B license as circulated by CEA, CNRS
11  * and INRIA at the following URL "http://www.cecill.info".
12  *
13  * As a counterpart to the access to the source code and rights to copy,
14  * modify and redistribute granted by the license, users are provided only
15  * with a limited warranty and the software's author, the holder of the
16  * economic rights, and the successive licensors have only limited
17  * liability.
18  *
19  * In this respect, the user's attention is drawn to the risks associated
20  * with loading, using, modifying and/or developing or reproducing the
21  * software by the user in light of its specific status of free software,
22  * that may mean that it is complicated to manipulate, and that also
23  * therefore means that it is reserved for developers and experienced
24  * professionals having in-depth computer knowledge. Users are therefore
25  * encouraged to load and test the software's suitability as regards their
26  * requirements in conditions enabling the security of their systems and/or
27  * data to be ensured and, more generally, to use and operate it in the
28  * same conditions as regards security.
29  *
30  * The fact that you are presently reading this means that you have had
31  * knowledge of the CeCILL-B license and that you accept its terms.
32  */
33 
34 
35 #ifndef ANATOMIST_WINDOW_GLCAPS_H
36 #define ANATOMIST_WINDOW_GLCAPS_H
37 
38 // this seems needed on old linux distributions (Fedora 4)
39 #ifndef GL_GLEXT_PROTOTYPES
40 #define GL_GLEXT_PROTOTYPES
41 #endif
42 
43 #ifdef _WIN32 // TODO: remove this workaround (added by Denis for Windows)
44 #include <qgl.h>
45 #ifndef HAS_GLEXT
46 # define HAS_GLEXT
47 #endif
48 #endif
49 
50 #if defined(__APPLE__)
51 /* OpenGL on Mac uses non-standard include paths, it would have been
52  too simple and too much like all other systems, they definitely
53  needed to "think different"... (even Windows is more standard !)
54 */
55 # include <OpenGL/gl.h>
56 # include <OpenGL/glu.h>
57 # ifdef HAS_GLEXT
58 # include <OpenGL/glext.h>
59 # endif
60 #else
61 # include <GL/gl.h>
62 # include <GL/glu.h>
63 # ifdef HAS_GLEXT
64 # include <GL/glext.h>
65 # endif
66 #endif
67 
68 namespace anatomist
69 {
70 
76  class GLCaps
77  {
78  public:
79  static bool & mustRefresh();
80  static bool hasMultiTexture();
81  static bool ext_ARB_shadow();
82  static bool ext_SGIX_shadow();
83  static bool ext_ARB_depth_texture();
84  static bool ext_SGIX_depth_texture();
85  static bool ext_ARB_texture_cube_map();
86  static bool ext_EXT_texture_cube_map();
87  static void glActiveTexture( GLenum );
88  static void glClientActiveTexture( GLenum );
89  static unsigned numTextureUnits();
90  static GLenum textureID( unsigned );
91  static bool hasGlBlendEquation();
92  static void glBlendEquation( GLenum );
93  static bool hasGlTexImage3D();
94  static void glTexImage3D( GLenum, GLint, GLenum, GLsizei, GLsizei,
95  GLsizei, GLint, GLenum, GLenum, const void* );
96  static void glMultiTexCoord3f( GLenum target, GLfloat s, GLfloat t,
97  GLfloat r );
98 
99  static bool hasFramebuffer();
100  static void glBindFramebuffer( GLenum target, GLuint framebuffer );
101  static void glBindRenderbuffer( GLenum target, GLuint renderbuffer );
102  static void glFramebufferTexture2D( GLenum target, GLenum attachment,
103  GLenum textarget, GLuint texture,
104  GLint level );
105  static void glGenFramebuffers( GLsizei n, GLuint *ids );
106  static void glGenRenderbuffers( GLsizei n, GLuint *renderbuffers );
107  static void glFramebufferRenderbuffer( GLenum target, GLenum attachment,
108  GLenum renderbuffertarget,
109  GLuint renderbuffer );
110  static void glRenderbufferStorage( GLenum target, GLenum internalformat,
111  GLsizei width, GLsizei height );
112  static GLenum glCheckFramebufferStatus( GLenum target );
113  static void glDeleteRenderbuffers( GLsizei n,
114  const GLuint *renderbuffers );
115  static void glDeleteFramebuffers( GLsizei n, const GLuint *framebuffers );
116  static void glUniform1f( GLint location, GLfloat v0 );
117  static void glUniform1i( GLint location, GLint v0 );
118  static void glUniform4fv( GLint location, GLsizei count,
119  const GLfloat *value );
120  static GLint glGetUniformLocation( GLuint program,
121  const GLchar *name );
122  static void glMultTransposeMatrixf( const GLfloat m[16] );
123  static void glAttachShader( GLuint program, GLuint shader );
124  static void glDetachShader( GLuint program, GLuint shader );
125  static void glCompileShader( GLuint shader );
126  static GLuint glCreateProgram();
127  static GLuint glCreateShader( GLenum type );
128  static void glDeleteProgram( GLuint program );
129  static void glDeleteShader( GLuint shader );
130  static void glGetProgramiv( GLuint program, GLenum pname, GLint *params );
131  static void glGetShaderiv( GLuint shader, GLenum pname, GLint *params );
132  static void glLinkProgram( GLuint program );
133  static void glShaderSource( GLuint shader, GLsizei count,
134  const GLchar *const*string,
135  const GLint *length );
136  static void glUseProgram( GLuint program );
137 
139  static void updateTextureUnits();
140  };
141 
142 }
143 
144 // fix any missing definitions from glext.h
145 #ifndef GL_FRAMEBUFFER
146 #define GL_FRAMEBUFFER 0x8D40
147 #endif
148 #ifndef GL_COLOR_ATTACHMENT0
149 #define GL_COLOR_ATTACHMENT0 0x8CE0
150 #endif
151 #ifndef GL_RENDERBUFFER
152 #define GL_RENDERBUFFER 0x8D41
153 #endif
154 #ifndef GL_DEPTH_ATTACHMENT
155 #define GL_DEPTH_ATTACHMENT 0x8D00
156 #endif
157 #ifndef GL_FRAMEBUFFER_COMPLETE
158 #define GL_FRAMEBUFFER_COMPLETE 0x8CD5
159 #endif
160 #ifndef GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT
161 #define GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT 0x8CD6
162 #endif
163 #ifndef GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT
164 #define GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT 0x8CD7
165 #endif
166 #ifndef GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT
167 #define GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT 0x8CD9
168 #endif
169 #ifndef GL_FRAMEBUFFER_UNSUPPORTED
170 #define GL_FRAMEBUFFER_UNSUPPORTED 0x8CDD
171 #endif
172 
173 #endif
OpenGL capabilities.
Definition: glcaps.h:77
static void glFramebufferTexture2D(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level)
static bool ext_ARB_depth_texture()
static void glDeleteShader(GLuint shader)
static void glUseProgram(GLuint program)
static void glUniform1i(GLint location, GLint v0)
static bool ext_SGIX_depth_texture()
static GLint glGetUniformLocation(GLuint program, const GLchar *name)
static bool ext_ARB_shadow()
static bool ext_EXT_texture_cube_map()
static void glUniform1f(GLint location, GLfloat v0)
static void glBindRenderbuffer(GLenum target, GLuint renderbuffer)
static void glCompileShader(GLuint shader)
static GLenum glCheckFramebufferStatus(GLenum target)
static bool ext_ARB_texture_cube_map()
static void glShaderSource(GLuint shader, GLsizei count, const GLchar *const *string, const GLint *length)
static void glMultTransposeMatrixf(const GLfloat m[16])
static void glTexImage3D(GLenum, GLint, GLenum, GLsizei, GLsizei, GLsizei, GLint, GLenum, GLenum, const void *)
static bool hasFramebuffer()
static void glDeleteProgram(GLuint program)
static void glGetShaderiv(GLuint shader, GLenum pname, GLint *params)
static bool hasGlBlendEquation()
static void glRenderbufferStorage(GLenum target, GLenum internalformat, GLsizei width, GLsizei height)
static void glFramebufferRenderbuffer(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer)
static void glDeleteFramebuffers(GLsizei n, const GLuint *framebuffers)
static void glAttachShader(GLuint program, GLuint shader)
static bool hasGlTexImage3D()
static bool & mustRefresh()
static void glUniform4fv(GLint location, GLsizei count, const GLfloat *value)
static void glMultiTexCoord3f(GLenum target, GLfloat s, GLfloat t, GLfloat r)
static void glClientActiveTexture(GLenum)
static bool hasMultiTexture()
static void glGenFramebuffers(GLsizei n, GLuint *ids)
static void glGetProgramiv(GLuint program, GLenum pname, GLint *params)
static void glDetachShader(GLuint program, GLuint shader)
static void glDeleteRenderbuffers(GLsizei n, const GLuint *renderbuffers)
static GLuint glCreateProgram()
static bool ext_SGIX_shadow()
static GLuint glCreateShader(GLenum type)
static void glBlendEquation(GLenum)
static void glActiveTexture(GLenum)
static void glGenRenderbuffers(GLsizei n, GLuint *renderbuffers)
static void updateTextureUnits()
re-calculate number of texture units
static unsigned numTextureUnits()
static GLenum textureID(unsigned)
static void glBindFramebuffer(GLenum target, GLuint framebuffer)
static void glLinkProgram(GLuint program)