示例#1
0
		/// 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;
	}
示例#10
0
	/**
	 *  @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);
	}
示例#11
0
	static GLuint _query_limit(void)
	{
		GLint limit = 0;
		OGLPLUS_GLFUNC(GetIntegerv)(Query, &limit);
		OGLPLUS_VERIFY(OGLPLUS_ERROR_INFO(GetIntegerv));
		return GLuint(limit);
	}
示例#12
0
	/**
	 *  @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);
	}
示例#13
0
	/**
	 *  @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;
	}
示例#14
0
	/**
	 *  @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);
	}
示例#15
0
	/**
	 *  @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;
	}
示例#16
0
	/**
	 *  @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;
	}
示例#17
0
	/// 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));
		}
	}
示例#18
0
	/**
	 *  @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));
	}
示例#19
0
	/**
	 *  @glsymbols
	 *  @glfunref{DrawBuffers}
	 */
	static void DrawBuffers(const EnumArray<ColorBuffer>& buffers)
	{
		OGLPLUS_GLFUNC(DrawBuffers)(
			buffers.Count(),
			buffers.Values()
		);
		OGLPLUS_VERIFY(OGLPLUS_ERROR_INFO(DrawBuffers));
	}
示例#20
0
	/**
	 *  @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));
	}
示例#21
0
	/**
	 *  @glsymbols
	 *  @glfunref{DisableVertexArrayAttribEXT}
	 */
	const DSAVertexArrayAttribEXT& Disable(void) const
	{
		OGLPLUS_GLFUNC(DisableVertexArrayAttribEXT)(
			_vao,
			GLuint(_location)
		);
		OGLPLUS_CHECK(OGLPLUS_ERROR_INFO(DisableVertexArrayAttribEXT));
		return *this;
	}
示例#22
0
	/**
	 *  @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;
	}
示例#23
0
	/**
	 *  @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;
	}
示例#24
0
	/**
	 *  @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;
	}
示例#25
0
	/**
	 *  @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));
	}
示例#26
0
	/**
	 *  @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));
	}
示例#27
0
	/**
	 *  @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);
	}
示例#28
0
	/**
	 *  @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;
	}
示例#29
0
	/**
	 *  @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;
	}
示例#30
0
	/**
	 *  @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));
	}