17 #ifndef AGXGL_OPENGL_H
18 #define AGXGL_OPENGL_H
36 #if defined( __APPLE__ )
37 #define GL_SILENCE_DEPRECATION 1
40 #include <OpenGLES/ES1/gl.h>
41 #include <OpenGLES/ES1/glext.h>
42 #include <OpenGLES/ES2/gl.h>
43 #include <OpenGLES/ES2/glext.h>
44 #include <CoreGraphics/CGContext.h>
46 #include <OpenGL/OpenGL.h>
48 #include <OpenGL/gl.h>
49 #include <OpenGL/glu.h>
52 #elif defined( _WIN32 )
53 #define GL_GLEXT_PROTOTYPES
54 #define GLAD_API_CALL_EXPORT
63 #define GL_GLEXT_PROTOTYPES
83 #define GL_REAL GL_DOUBLE
84 #define glVertex3r glVertex3d
85 #define glVertex3rv glVertex3dv
86 #define glColor3r glColor3d
87 #define glColor3rv glColor3dv
88 #define glColor4r glColor4d
89 #define glColor4rv glColor4dv
90 #define glNormal3r glNormal3d
91 #define glNormal3rv glNormal3dv
92 #define glMultMatrixr glMultMatrixd
93 #define glTranslater glTranslated
94 #define glRotater glRotated
97 #define glCheckError() glCheckError_impl(__FILE__,__LINE__)
98 #define glCheckErrorTitle(title_) glCheckError_impl(__FILE__,__LINE__, (title_))
101 #define gluErrorString(x) agx::String::format("%d", x).c_str()
127 typedef CGContextRef ContextHandle;
129 typedef CGLContextObj ContextHandle;
131 #elif defined( UNIX ) || defined( __linux__ )
132 typedef GLXContext ContextHandle;
134 typedef HGLRC ContextHandle;
136 #error "OpenGL context handling on other platforms"
150 virtual Status
wait()
override {
return SYNC_TAG_COMPLETED; }
151 virtual Status
getStatus()
override {
return SYNC_TAG_COMPLETED; }
157 static Device *instance();
163 virtual agx::SyncTag* sendData(
165 size_t offset,
size_t size,
bool blocking)
override;
167 virtual agx::SyncTag* receiveData(
169 size_t offset,
size_t size,
bool blocking)
override;
179 static void clearGLDevice();
197 GLuint getImplementation();
205 virtual void reallocate(
size_t size)
override;
211 GLuint allocate(
size_t memsize);
212 bool deallocate(
GLuint handle);
241 GLuint getImplementation();
279 virtual void apply() = 0;
280 virtual void addedToKernel(
Kernel* kernel);
287 virtual void apply();
289 virtual void addedToKernel(
Kernel* kernel);
300 virtual void apply();
309 virtual void apply();
318 virtual void apply();
328 virtual void apply();
339 virtual void apply();
350 virtual void configure(agx::TiXmlElement *eKernel)
override;
359 virtual void addState(
State* state);
360 GLuint getShaderProgram();
364 void parsePrimitive(agx::TiXmlElement* eKernel);
365 void parseState(agx::TiXmlElement* eKernel);
366 void locateUniforms();
367 void locateAttributes();
368 void updateUniforms();
369 void updateAttributes();
370 void addUniform(agx::TiXmlElement *eUniform);
371 void addAttribute(agx::TiXmlElement *eAttribute);
372 void addSharedAttribute(agx::TiXmlElement *eAttribute);
374 bool deallocateVao();
agx::ArrayParameterRef m_multiDrawFirstArgument
agx::ParameterRef parameter
VertexShader m_vertexShader
agx::Vector< StateRef > m_states
agx::Vector< ShaderVariable > m_uniforms
GeometryShader m_geometryShader
#define AGX_DECLARE_POINTER_TYPES(type)
A representation of a generic task.
agx::ScalarParameterRef m_numInstances
Representation of a name string.
void AGXCORE_EXPORT setCurrentContext(ContextHandle context)
GLsizei m_numVerticesPerPrimitive
virtual Status wait() override
A representation of a task/kernel parameter, which can be bound using a string path or explicitly to ...
A kernel is an abstract representation of data parallel tasks.
Abstract representation of a data buffer.
Callback1< Task * > CallbackType
void AGXCORE_EXPORT glCheckError_impl(const char *file, int line, const char *title=nullptr)
agxData::Buffer * createBuffer(agxData::Type *type)
AGXCORE_EXPORT agx::Event initEvent
static Device * instance()
agx::ArrayParameterRef m_indexArgument
ContextHandle AGXCORE_EXPORT getCurrentContext()
void AGXCORE_EXPORT init()
agx::Vector< ShaderVariable > m_attributes
An agx::Device is an abstract representation of a device on which data can be stored and processed...
virtual Status getStatus() override
An event with no arguments.
agx::String m_sourceFilePath
FragmentShader m_fragmentShader
agx::ArrayParameterRef m_multiDrawCountArgument
agx::ScalarParameterRef divisor
agx::Object is a refcounted object with a name.