 |
AGX Dynamics
2.38.0.2
|
Go to the documentation of this file.
17 #ifndef AGXGL_OPENGL_H
18 #define AGXGL_OPENGL_H
21 #include <agx/config/AGX_USE_OPENGL.h>
22 #include <agx/config/AGX_USE_EGL.h>
23 #include <agx/config/AGX_USE_OSG.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 AGX_CUSTOM_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);
215 GLuint m_bufferHandle;
241 GLuint getImplementation();
244 void build_impl(GLenum shaderType,
const agx::String& buildFlags);
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();
327 TexEnvState(GLenum target, GLenum pname, GLint param);
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();
void AGXCORE_EXPORT glCheckError_impl(const char *file, int line, const char *title=nullptr)
A representation of a task/kernel parameter, which can be bound using a string path or explicitly to ...
agx::String m_sourceFilePath
A kernel is an abstract representation of data parallel tasks.
void AGXCORE_EXPORT init()
virtual Status getStatus() override
AGXCORE_EXPORT agx::Event initEvent
agx::ArrayParameterRef m_indexArgument
The agx namespace contains the dynamics/math part of the AGX Dynamics API.
A representation of a generic task.
agx::ScalarParameterRef divisor
agx::Vector< StateRef > m_states
FragmentShader m_fragmentShader
agxData::Buffer * createBuffer(agxData::Type *type)
GLsizei m_numVerticesPerPrimitive
Abstract representation of a data buffer.
agx::ArrayParameterRef m_multiDrawCountArgument
agx::Vector< ShaderVariable > m_attributes
Representation of a name string.
virtual Status wait() override
agx::Object is a refcounted object with a name.
agx::ArrayParameterRef m_multiDrawFirstArgument
Templated callback with one argument.
void AGXCORE_EXPORT setCurrentContext(ContextHandle context)
agx::ScalarParameterRef m_numInstances
#define AGX_DECLARE_POINTER_TYPES(type)
This namespace contains OpenGL specific details for connecting OpenCL/OpenGL.
static Device * instance()
agx::ParameterRef parameter
An agx::Device is an abstract representation of a device on which data can be stored and processed.
ContextHandle AGXCORE_EXPORT getCurrentContext()
GeometryShader m_geometryShader
An event with no arguments.
agx::Vector< ShaderVariable > m_uniforms
VertexShader m_vertexShader