/// Installs the @p callback and remembers the previous LogSink(Callback callback) : _callback(callback) , _prev_callback(nullptr) , _prev_context(nullptr) { // get the previous callback GLDEBUGPROCARB _tmp_callback = nullptr; void** _tmp_ptr=reinterpret_cast<void**>(&_tmp_callback); OGLPLUS_GLFUNC(GetPointerv)( GL_DEBUG_CALLBACK_FUNCTION_ARB, _tmp_ptr ); OGLPLUS_IGNORE(OGLPLUS_ERROR_INFO(GetPointerv)); _prev_callback = _tmp_callback; //get the previous context OGLPLUS_GLFUNC(GetPointerv)( GL_DEBUG_CALLBACK_USER_PARAM_ARB, &_prev_context ); OGLPLUS_IGNORE(OGLPLUS_ERROR_INFO(GetPointerv)); OGLPLUS_GLFUNC(DebugMessageCallbackARB)( &LogSink::_gl_debug_proc, static_cast<void*>(this) ); OGLPLUS_VERIFY( OGLPLUS_ERROR_INFO(DebugMessageCallbackARB) ); }
/** * @glsymbols * @glfunref{GetPerfMonitorCountersAMD} */ void GetCounters( GLint& max_active_counters, std::vector<PerfMonitorAMDCounter>& counters ) const { GLint count = 0; OGLPLUS_GLFUNC(GetPerfMonitorCountersAMD)( _group, &count, &max_active_counters, 0, nullptr ); OGLPLUS_CHECK(OGLPLUS_ERROR_INFO(GetPerfMonitorCountersAMD)); std::vector<GLuint> buffer(count); OGLPLUS_GLFUNC(GetPerfMonitorCountersAMD)( _group, &count, &max_active_counters, buffer.size(), buffer.data() ); OGLPLUS_CHECK(OGLPLUS_ERROR_INFO(GetPerfMonitorCountersAMD)); counters.clear(); counters.reserve(count); for(auto i=buffer.begin(), e=buffer.end(); i!=e; ++i) counters.push_back(PerfMonitorAMDCounter(_group, *i)); }
/** * @glsymbols * @glfunref{Get} * @gldefref{POLYGON_MODE} */ static oglplus::PolygonMode PolygonMode(void) { GLint result[2]; OGLPLUS_GLFUNC(GetIntegerv)(GL_POLYGON_MODE, result); OGLPLUS_VERIFY(OGLPLUS_ERROR_INFO(GetIntegerv)); return oglplus::PolygonMode(result[1]); }
/** * @glsymbols * @glfunref{PushClientAttrib} */ static void PushClientAttrib( Bitfield<CompatibilityClientAttributeGroup> attrib_groups ) { OGLPLUS_GLFUNC(PushClientAttrib)(GLbitfield(attrib_groups)); OGLPLUS_VERIFY(OGLPLUS_ERROR_INFO(PushClientAttrib)); }
/** * @glvoereq{3,2,ARB,provoking_vertex} * @glsymbols * @glfunref{Get} * @gldefref{PROVOKING_VERTEX} */ static ProvokeMode ProvokingVertex(void) { GLint result; OGLPLUS_GLFUNC(GetIntegerv)(GL_PROVOKING_VERTEX, &result); OGLPLUS_VERIFY(OGLPLUS_ERROR_INFO(GetIntegerv)); return ProvokeMode(result); }
/** * @glsymbols * @glfunref{Get} * @gldefref{POINT_FADE_THRESHOLD_SIZE} */ static GLfloat PointFadeThresholdSize(void) { GLfloat result; OGLPLUS_GLFUNC(GetFloatv)(GL_POINT_FADE_THRESHOLD_SIZE,&result); OGLPLUS_VERIFY(OGLPLUS_ERROR_INFO(GetFloatv)); return result; }
/** * @glsymbols * @glfunref{Get} * @gldefref{POINT_SIZE} */ static GLfloat PointSize(void) { GLfloat result; OGLPLUS_GLFUNC(GetFloatv)(GL_POINT_SIZE, &result); OGLPLUS_VERIFY(OGLPLUS_ERROR_INFO(GetFloatv)); return result; }
/** * @glsymbols * @glfunref{Get} * @gldefref{LINE_WIDTH} */ static GLfloat LineWidth(void) { GLfloat result; OGLPLUS_GLFUNC(GetFloatv)(GL_LINE_WIDTH, &result); OGLPLUS_VERIFY(OGLPLUS_ERROR_INFO(GetFloatv)); return result; }
/** * @glsymbols * @glfunref{Get} * @gldefref{POLYGON_OFFSET_UNITS} */ static GLfloat PolygonOffsetUnits(void) { GLfloat result; OGLPLUS_GLFUNC(GetFloatv)(GL_POLYGON_OFFSET_UNITS, &result); OGLPLUS_VERIFY(OGLPLUS_ERROR_INFO(GetFloatv)); return result; }
/** * @throws Error * * @see GetExtension * * @glsymbols * @glfunref{Get} * @gldefref{NUM_EXTENSIONS} */ static GLuint NumExtensions(void) { GLint result = 0; OGLPLUS_GLFUNC(GetIntegerv)(GL_NUM_EXTENSIONS, &result); OGLPLUS_VERIFY(OGLPLUS_ERROR_INFO(GetIntegerv)); return GLuint(result); }
static GLuint _query_limit(void) { GLint limit = 0; OGLPLUS_GLFUNC(GetIntegerv)(Query, &limit); OGLPLUS_VERIFY(OGLPLUS_ERROR_INFO(GetIntegerv)); return GLuint(limit); }
/** * @glsymbols * @glfunref{Get} * @gldefref{CULL_FACE_MODE} */ static Face CullFaceMode(void) { GLint result; OGLPLUS_GLFUNC(GetIntegerv)(GL_CULL_FACE_MODE, &result); OGLPLUS_VERIFY(OGLPLUS_ERROR_INFO(GetIntegerv)); return Face(result); }
/** * @glsymbols * @glfunref{VertexAttribPointer} */ const VertexAttribArray& LPointer( GLuint values_per_vertex, DataType data_type, GLsizei stride, const void* pointer ) const { #if GL_VERSION_4_2 || GL_ARB_vertex_attrib_64bit OGLPLUS_GLFUNC(VertexAttribLPointer)( _location, values_per_vertex, GLenum(data_type), stride, pointer ); OGLPLUS_CHECK(OGLPLUS_ERROR_INFO(VertexAttribLPointer)); #else assert(! "The glVertexAttribLPointer function is " "required but not available! Double-precision " "vertex attribute values are not supported." ); #endif return *this; }
/** * @glsymbols * @glfunref{Get} * @gldefref{COLOR_LOGIC_OP} */ static ColorLogicOperation LogicOpMode(void) { GLint result; OGLPLUS_GLFUNC(GetIntegerv)(GL_LOGIC_OP_MODE, &result); OGLPLUS_VERIFY(OGLPLUS_ERROR_INFO(GetIntegerv)); return ColorLogicOperation(result); }
/** * @throws Error * * @glvoereq{4,1,ARB,viewport_array} * @glsymbols * @glfunref{Get} * @gldefref{SCISSOR_BOX} */ static ScissorRectangle ScissorBox(GLuint viewport) { ScissorRectangle result; OGLPLUS_GLFUNC(GetIntegeri_v)(GL_SCISSOR_BOX, viewport,result._v); OGLPLUS_CHECK(OGLPLUS_ERROR_INFO(GetIntegeri_v)); return result; }
/** * @throws Error * * @see MajorVersion * * @glsymbols * @glfunref{Get} * @gldefref{MINOR_VERSION} */ static GLint MinorVersion(void) { GLint result = 0; OGLPLUS_GLFUNC(GetIntegerv)(GL_MINOR_VERSION, &result); OGLPLUS_VERIFY(OGLPLUS_ERROR_INFO(GetIntegerv)); return result; }
/// Enables or disables synchronous debug output static void Synchronous(bool enable) { if(enable) { OGLPLUS_GLFUNC(Enable)( GL_DEBUG_OUTPUT_SYNCHRONOUS_ARB ); OGLPLUS_VERIFY(OGLPLUS_ERROR_INFO(Enable)); } else { OGLPLUS_GLFUNC(Disable)( GL_DEBUG_OUTPUT_SYNCHRONOUS_ARB ); OGLPLUS_VERIFY(OGLPLUS_ERROR_INFO(Disable)); } }
/** * @glsymbols * @glfunref{PointParameter} * @gldefref{POINT_FADE_THRESHOLD_SIZE} */ static void PointFadeThresholdSize(GLfloat size) { OGLPLUS_GLFUNC(PointParameterf)( GL_POINT_FADE_THRESHOLD_SIZE, size ); OGLPLUS_VERIFY(OGLPLUS_ERROR_INFO(PointParameterf)); }
/** * @glsymbols * @glfunref{DrawBuffers} */ static void DrawBuffers(const EnumArray<ColorBuffer>& buffers) { OGLPLUS_GLFUNC(DrawBuffers)( buffers.Count(), buffers.Values() ); OGLPLUS_VERIFY(OGLPLUS_ERROR_INFO(DrawBuffers)); }
/** * @glsymbols * @glfunref{StencilFunc} */ static void StencilFunc( CompareFunction func, GLint ref = GLint(0), GLuint mask = ~GLuint(0) ) { OGLPLUS_GLFUNC(StencilFunc)(GLenum(func), ref, mask); OGLPLUS_VERIFY(OGLPLUS_ERROR_INFO(StencilFunc)); }
/** * @glsymbols * @glfunref{DisableVertexArrayAttribEXT} */ const DSAVertexArrayAttribEXT& Disable(void) const { OGLPLUS_GLFUNC(DisableVertexArrayAttribEXT)( _vao, GLuint(_location) ); OGLPLUS_CHECK(OGLPLUS_ERROR_INFO(DisableVertexArrayAttribEXT)); return *this; }
/** * @glsymbols * @glfunref{IsEnabled} */ static bool IsEnabled(Functionality functionality, GLuint offset) { GLboolean result = OGLPLUS_GLFUNC(IsEnabled)( GLenum(functionality)+ offset ); OGLPLUS_VERIFY(OGLPLUS_ERROR_INFO(IsEnabled)); return result == GL_TRUE; }
/** * @throws Error * * @see NumExtensions * * @glsymbols * @glfunref{GetStringi} * @gldefref{EXTENSIONS} */ static const GLubyte* Extensions(GLuint index) { const GLubyte* result = OGLPLUS_GLFUNC(GetStringi)( GL_EXTENSIONS, index ); OGLPLUS_VERIFY(OGLPLUS_ERROR_INFO(GetStringi)); return result; }
/** * @glsymbols * @glfunref{IsEnabledi} */ static bool IsEnabled(Capability capability, GLuint index) { GLboolean result = OGLPLUS_GLFUNC(IsEnabledi)( GLenum(capability), index ); OGLPLUS_VERIFY(OGLPLUS_ERROR_INFO(IsEnabledi)); return result == GL_TRUE; }
/** * @glverreq{4,0} * @glsymbols * @glfunref{BlendFunci} */ static void BlendFunc( GLuint buffer, BlendFunction src, BlendFunction dst ) { OGLPLUS_GLFUNC(BlendFunci)(buffer, GLenum(src), GLenum(dst)); OGLPLUS_VERIFY(OGLPLUS_ERROR_INFO(BlendFunci)); }
/** * @throws Error * * @glsymbols * @glfunref{Scissor} */ static void Scissor( GLint left, GLint bottom, GLsizei width, GLsizei height ) { OGLPLUS_GLFUNC(Scissor)(left, bottom, width, height); OGLPLUS_VERIFY(OGLPLUS_ERROR_INFO(Scissor)); }
/** * @glsymbols * @glfunref{ClientWaitSync} */ SyncWaitResult ClientWait(GLuint64 timeout) const { GLenum result = OGLPLUS_GLFUNC(ClientWaitSync)( _sync, 0, timeout ); OGLPLUS_VERIFY(OGLPLUS_ERROR_INFO(ClientWaitSync)); return SyncWaitResult(result); }
/** * @glsymbols * @glfunref{Get} * @gldefref{RENDERBUFFER_FREE_MEMORY_ATI} */ static AvailableMemory RenderbufferFreeMemory(void) { AvailableMemory result; OGLPLUS_GLFUNC(GetIntegerv)( GL_RENDERBUFFER_FREE_MEMORY_ATI, result._v ); OGLPLUS_VERIFY(OGLPLUS_ERROR_INFO(GetIntegerv)); return result; }
/** * @glsymbols * @glfunref{Get} * @gldefref{TEXTURE_FREE_MEMORY_ATI} */ static AvailableMemory TextureFreeMemory(void) { AvailableMemory result; OGLPLUS_GLFUNC(GetIntegerv)( GL_TEXTURE_FREE_MEMORY_ATI, result._v ); OGLPLUS_VERIFY(OGLPLUS_ERROR_INFO(GetIntegerv)); return result; }
/** * @glsymbols * @glfunref{BlendEquationSeparate} */ static void BlendEquationSeparate( oglplus::BlendEquation eq_rgb, oglplus::BlendEquation eq_alpha ) { OGLPLUS_GLFUNC(BlendEquationSeparate)( GLenum(eq_rgb), GLenum(eq_alpha) ); OGLPLUS_VERIFY(OGLPLUS_ERROR_INFO(BlendEquationSeparate)); }