reference

This documentation is automatically generated from the openFrameworks source code using doxygen and refers to the most recent release, version 0.12.0.

ofGLUtils.h
Go to the documentation of this file.
1/*
2 * ofGLUtils.h
3 *
4 * Created on: 02/03/2011
5 * Author: arturo
6 */
7
8#pragma once
9
10#include "ofGraphicsConstants.h"
11#include "ofConstants.h"
12
13class ofShader;
16class ofTexture;
17
18template<typename T>
19class ofPixels_;
20
25
26enum ofImageType: short;
27enum ofPixelFormat: short;
28
29int ofGetGLInternalFormat(const ofPixels & pixels);
30int ofGetGLInternalFormat(const ofShortPixels & pixels);
31int ofGetGLInternalFormat(const ofFloatPixels & pixels);
32
33OF_DEPRECATED_MSG("Use ofGetGLInternalFormat() instead", int ofGetGlInternalFormat(const ofPixels & pixels));
34OF_DEPRECATED_MSG("Use ofGetGLInternalFormat() instead", int ofGetGlInternalFormat(const ofShortPixels & pixels));
35OF_DEPRECATED_MSG("Use ofGetGLInternalFormat() instead", int ofGetGlInternalFormat(const ofFloatPixels & pixels));
36
37//---------------------------------
38// this is helpful for debugging ofTexture
39
40std::string ofGetGLInternalFormatName(int glInternalFormat);
41int ofGetGLFormatFromInternal(int gInternalFormat);
42int ofGetGLTypeFromInternal(int glInternalFormat);
43
44OF_DEPRECATED_MSG("Use ofGetGLInternalFormatName() instead", std::string ofGetGlInternalFormatName(int glInternalFormat));
45OF_DEPRECATED_MSG("Use ofGetGLTypeFromInternal() instead", int ofGetGlTypeFromInternal(int glInternalFormat));
46
47std::shared_ptr<ofBaseGLRenderer> ofGetGLRenderer();
48
49int ofGetGLType(const ofPixels & pixels);
50int ofGetGLType(const ofShortPixels & pixels);
51int ofGetGLType(const ofFloatPixels & pixels);
52
53OF_DEPRECATED_MSG("Use ofGetGLType() instead", int ofGetGlType(const ofPixels & pixels));
54OF_DEPRECATED_MSG("Use ofGetGLType() instead", int ofGetGlType(const ofShortPixels & pixels));
55OF_DEPRECATED_MSG("Use ofGetGLType() instead", int ofGetGlType(const ofFloatPixels & pixels));
56
58
61
64
67int ofGetBytesPerChannelFromGLType(int glType);
68int ofGetNumChannelsFromGLFormat(int glFormat);
69void ofSetPixelStoreiAlignment(GLenum pname, int w, int bpc, int numChannels);
70void ofSetPixelStoreiAlignment(GLenum panme, int stride);
71
72std::vector<std::string> ofGLSupportedExtensions();
73bool ofGLCheckExtension(std::string searchName);
75
77
78template<class T>
79OF_DEPRECATED_MSG("Use ofGetGLFormat() instead", int ofGetGlFormat(const ofPixels_<T> & pixels));
80
81template<class T>
82int ofGetGlFormat(const ofPixels_<T> & pixels) {
84}
85
86template<class T>
87int ofGetGLFormat(const ofPixels_<T> & pixels) {
89}
90
91std::string ofGLSLVersionFromGL(int major, int minor);
92std::string ofGLSLVersionFromGL();
93std::string ofGLSLGetDefaultHeader();
94
95#ifndef TARGET_OPENGLES
98#endif
99
100#ifndef TARGET_OPENGLES
101 #define GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT
102 #define GL_FRAMEBUFFER_INCOMPLETE_FORMATS GL_FRAMEBUFFER_INCOMPLETE_FORMATS_EXT
103
104 #ifndef GL_UNSIGNED_INT_24_8
105 #define GL_UNSIGNED_INT_24_8 GL_UNSIGNED_INT_24_8_EXT
106 #endif
107#else
108 // ES1 - check if GL_FRAMEBUFFER is defined, if not assume ES1 is running.
109 #ifndef GL_FRAMEBUFFER
110 #define GL_FRAMEBUFFER GL_FRAMEBUFFER_OES
111 #define GL_RENDERBUFFER GL_RENDERBUFFER_OES
112 #define GL_DEPTH_ATTACHMENT GL_DEPTH_ATTACHMENT_OES
113 #define GL_STENCIL_ATTACHMENT GL_STENCIL_ATTACHMENT_OES
114 //#define GL_DEPTH_STENCIL_ATTACHMENT GL_DEPTH_STENCIL_ATTACHMENT_OES
115 #define GL_DEPTH_COMPONENT GL_DEPTH_COMPONENT16_OES
116 #define GL_STENCIL_INDEX GL_STENCIL_INDEX8_OES
117 #define GL_FRAMEBUFFER_BINDING GL_FRAMEBUFFER_BINDING_OES
118 #define GL_MAX_COLOR_ATTACHMENTS GL_MAX_COLOR_ATTACHMENTS_OES
119 #define GL_MAX_SAMPLES GL_MAX_SAMPLES_OES
120 #define GL_READ_FRAMEBUFFER GL_READ_FRAMEBUFFER_OES
121 #define GL_DRAW_FRAMEBUFFER GL_DRAW_FRAMEBUFFER_OES
122 #define GL_WRITE_FRAMEBUFFER GL_WRITE_FRAMEBUFFER_OES
123 #define GL_COLOR_ATTACHMENT0 GL_COLOR_ATTACHMENT0_OES
124 #define GL_FRAMEBUFFER_COMPLETE GL_FRAMEBUFFER_COMPLETE_OES
125 #define GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_OES
126 #define GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_OES
127 #define GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_OES
128 #define GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_OES
129 #define GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER_OES
130 #define GL_FRAMEBUFFER_UNSUPPORTED GL_FRAMEBUFFER_UNSUPPORTED_OES
131 #define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_OES
132 #define GL_DEPTH_COMPONENT16 GL_DEPTH_COMPONENT16_OES
133 #endif
134
135 // ES2 + ES3 - GL_STENCIL_INDEX has been removed from gl header, and now replaced with GL_STENCIL_INDEX8.
136 #ifndef GL_STENCIL_INDEX
137 #ifdef GL_STENCIL_INDEX8
138 #define GL_STENCIL_INDEX GL_STENCIL_INDEX8
139 #endif
140 #endif
141
142 #define GL_FRAMEBUFFER_INCOMPLETE_FORMATS GL_FRAMEBUFFER_INCOMPLETE_FORMATS_OES
143 #define GL_UNSIGNED_INT_24_8 GL_UNSIGNED_INT_24_8_OES
144
145 #define GL_DEPTH24_STENCIL8 GL_DEPTH24_STENCIL8_OES
146 #define GL_DEPTH_STENCIL GL_DEPTH24_STENCIL8_OES
147 #define GL_DEPTH_COMPONENT24 GL_DEPTH_COMPONENT24_OES
148 #ifdef GL_DEPTH_COMPONENT32_OES
149 #ifndef GL_DEPTH_COMPONENT32
150 #define GL_DEPTH_COMPONENT32 GL_DEPTH_COMPONENT32_OES
151 #endif
152 #endif
153
154 #ifndef GL_RGBA32F
155 #ifdef GL_RGBA32F_EXT
156 #define GL_RGBA32F GL_RGBA32F_EXT
157 #endif
158 #endif
159
160 #ifdef TARGET_OPENGLES
161 #ifndef GL_UNSIGNED_INT
162 #define GL_UNSIGNED_INT GL_UNSIGNED_INT_OES
163 #endif
164 #ifndef GL_HALF_FLOAT
165 #define GL_HALF_FLOAT GL_HALF_FLOAT_OES
166 #endif
167 #ifndef GL_TEXTURE_CUBE_MAP
168 #ifdef GL_TEXTURE_CUBE_MAP_OES
169 #define GL_TEXTURE_CUBE_MAP GL_TEXTURE_CUBE_MAP_OES
170 #endif
171 #endif
172 #endif
173
174 #ifndef glTexStorage2D
175 #ifdef glTexStorage2DEXT
176 #define glTexStorage2D glTexStorage2DEXT
177 #endif
178 #endif
179#endif
Definition ofGLBaseTypes.h:95
Definition ofGLProgrammableRenderer.h:17
A class representing a collection of pixels.
Definition ofPixels.h:170
ofPixelFormat getPixelFormat() const
Definition ofPixels.cpp:986
Definition ofShader.h:35
A wrapper class for an OpenGL texture.
Definition ofTexture.h:253
#define OF_DEPRECATED_MSG(message,...)
Definition ofConstants.h:78
int ofGetGlInternalFormat(const ofPixels &pixels)
Definition ofGLUtils.cpp:20
std::string ofGetGlInternalFormatName(int glInternalFormat)
Definition ofGLUtils.cpp:32
int ofGetGlType(const ofPixels &pixels)
Definition ofGLUtils.cpp:40
int ofGetGlTypeFromInternal(int glInternalFormat)
Definition ofGLUtils.cpp:36
ofPixels_< float > ofFloatPixels
Definition ofGLUtils.h:22
int ofGetGLTypeFromInternal(int glInternalFormat)
Definition ofGLUtils.cpp:251
std::shared_ptr< ofBaseGLRenderer > ofGetGLRenderer()
Definition ofGLUtils.cpp:909
void ofEnableGLDebugLog()
Definition ofGLUtils.cpp:983
GLuint ofGetGLPrimitiveMode(ofPrimitiveMode mode)
Definition ofGLUtils.cpp:471
int ofGetGLFormatFromPixelFormat(ofPixelFormat pixelFormat)
Definition ofGLUtils.cpp:627
void ofDisableGLDebugLog()
Definition ofGLUtils.cpp:991
ofPixels_< unsigned char > ofPixels
Definition ofGLUtils.h:21
bool ofIsGLProgrammableRenderer()
Definition ofGLProgrammableRenderer.cpp:37
bool ofGLSupportsNPOTTextures()
Definition ofGLUtils.cpp:809
int ofGetBytesPerChannelFromGLType(int glType)
Definition ofGLUtils.cpp:719
ofPolyRenderMode ofGetOFPolyMode(GLuint m)
Definition ofGLUtils.cpp:448
void ofSetPixelStoreiAlignment(GLenum pname, int w, int bpc, int numChannels)
Definition ofGLUtils.cpp:758
int ofGetGLInternalFormat(const ofPixels &pixels)
Definition ofGLUtils.cpp:53
std::string ofGetGLInternalFormatName(int glInternalFormat)
Definition ofGLUtils.cpp:123
std::string ofGLSLVersionFromGL()
Definition ofGLUtils.cpp:865
int ofGetGLFormatFromInternal(int gInternalFormat)
Definition ofGLUtils.cpp:151
int ofGetGLType(const ofPixels &pixels)
Definition ofGLUtils.cpp:349
GLuint ofGetGLPolyMode(ofPolyRenderMode m)
Definition ofGLUtils.cpp:426
ofPrimitiveMode ofGetOFPrimitiveMode(GLuint mode)
Definition ofGLUtils.cpp:518
int ofGetGLFormat(const ofPixels_< T > &pixels)
Definition ofGLUtils.h:87
ofPixels_< unsigned short > ofShortPixels
Definition ofGLUtils.h:23
std::string ofGLSLGetDefaultHeader()
Definition ofGLUtils.cpp:878
int ofGetGlFormat(const ofPixels_< T > &pixels)
Definition ofGLUtils.h:82
int ofGetNumChannelsFromGLFormat(int glFormat)
Definition ofGLUtils.cpp:695
ofImageType ofGetImageTypeFromGLType(int glType)
Definition ofGLUtils.cpp:372
std::vector< std::string > ofGLSupportedExtensions()
Definition ofGLUtils.cpp:775
ofPixels & ofPixelsRef
Definition ofGLUtils.h:24
bool ofGLCheckExtension(std::string searchName)
int ofGetGLInternalFormatFromPixelFormat(ofPixelFormat pixelFormat)
Definition ofGLUtils.cpp:566
ofPrimitiveMode
Definition ofGraphicsConstants.h:20
ofImageType
Used to represent the available channel types in ofImage.
Definition ofGraphicsConstants.h:154
ofPolyRenderMode
Definition ofGraphicsConstants.h:13
ofPixelFormat
Used to represent the available pixel formats.
Definition ofPixels.h:68