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; }
165 size_t offset,
size_t size,
bool blocking)
override;
169 size_t offset,
size_t size,
bool blocking)
override;
211 GLuint allocate(
size_t memsize);
212 bool deallocate(GLuint handle);
215 GLuint m_bufferHandle;
350 virtual void configure(agx::TiXmlElement *eKernel)
override;
void AGXCORE_EXPORT glCheckError_impl(const char *file, int line, const char *title=nullptr)
#define AGX_DECLARE_POINTER_TYPES(type)
Abstract representation of a data buffer.
Only use as member allocated variable.
GLuint getImplementation()
Buffer(agxData::Format *format, Device *device, GLenum usage=GL_STREAM_DRAW)
static void initializeElements(agxData::Buffer *buffer, const agx::IndexRange &range)
virtual void reallocate(size_t size) override
virtual void addedToKernel(Kernel *kernel)
static CapabilityState * load(agx::TiXmlElement *eState)
CapabilityState(GLenum capability, agx::String &capabilityName, agx::String &bindPath, agx::Bool enabled=true)
DepthMaskState(GLboolean enabled)
static void clearGLDevice()
static Device * instance()
virtual agx::SyncTag * sendData(const void *hostBuffer, agxData::Buffer *deviceBuffer, size_t offset, size_t size, bool blocking) override
Send data to a buffer on the device.
virtual agxData::Buffer * createBuffer(agxData::Format *format) override
virtual agx::SyncTag * receiveData(void *hostBuffer, agxData::Buffer *deviceBuffer, size_t offset, size_t size, bool blocking) override
Receive data from a buffer on the device.
void build(const agx::String &shaderSourcePath, const agx::String &buildFlags)
void build(const agx::String &shaderSourcePath, const agx::String &buildFlags)
Kernel(const agx::Name &name, agx::Device *device, const agx::String &shaderSourcePath, const agx::String &buildFlags)
virtual void addState(State *state)
agx::ArrayParameterRef m_multiDrawCountArgument
GLsizei m_numVerticesPerPrimitive
Kernel(const agx::Name &name)
void parseState(agx::TiXmlElement *eKernel)
static Kernel * load(agx::TiXmlElement *eKernel, agx::Device *device)
GLuint getShaderProgram()
agx::Vector< StateRef > m_states
agx::ArrayParameterRef m_indexArgument
void addAttribute(agx::TiXmlElement *eAttribute)
void addUniform(agx::TiXmlElement *eUniform)
FragmentShader m_fragmentShader
agx::ArrayParameterRef m_multiDrawFirstArgument
void addSharedAttribute(agx::TiXmlElement *eAttribute)
VertexShader m_vertexShader
agx::ScalarParameterRef m_numInstances
void parsePrimitive(agx::TiXmlElement *eKernel)
virtual void configure(agx::TiXmlElement *eKernel) override
GeometryShader m_geometryShader
void build(agx::Device *device)
agx::Vector< ShaderVariable > m_attributes
agx::Vector< ShaderVariable > m_uniforms
LineWidthState(GLfloat size)
PointSizeState(GLfloat size)
PolygonModeState(GLenum face, GLenum mode)
void build_impl(GLenum shaderType, const agx::String &buildFlags)
GLuint getImplementation()
agx::String m_sourceFilePath
static State * load(agx::TiXmlElement *eState, agx::Device *)
State(const agx::String &name)
virtual void addedToKernel(Kernel *kernel)
virtual Status wait() override
virtual Status getStatus() override
Task(const agx::Name &name, agx::Device *device=Device::instance())
TexEnvState(GLenum target, GLenum pname, GLint param)
void build(const agx::String &shaderSourcePath, const agx::String &buildFlags)
An agx::Device is an abstract representation of a device on which data can be stored and processed.
agxData::Buffer * createBuffer(agxData::Type *type)
An event with no arguments.
A kernel is an abstract representation of data parallel tasks.
Representation of a name string.
agx::Object is a refcounted object with a name.
A representation of a task/kernel parameter, which can be bound using a string path or explicitly to ...
A representation of a generic task.
This namespace contains OpenGL specific details for connecting OpenCL/OpenGL.
void AGXCORE_EXPORT init()
AGXCORE_EXPORT agx::Event initEvent
void AGXCORE_EXPORT setCurrentContext(ContextHandle context)
ContextHandle AGXCORE_EXPORT getCurrentContext()
The agx namespace contains the dynamics/math part of the AGX Dynamics API.
agx::ScalarParameterRef divisor
ShaderVariable(const agx::String &name, agx::Parameter *parameter_, GLint numComponents_=1, GLsizei stride_=1, agx::ScalarParameter *divisor_=nullptr)
agx::ParameterRef parameter