Example #1
0
	/**
	 *  @param target use the buffer bound to the target specified
	 *  @param access the access specifier for the buffer mapping
	 *
	 * This class is non-copyable.
	 *
	 *  @glsymbols
	 *  @glfunref{MapBuffer}
	 *
	 *  @throws Error
	 */
	BufferRawMap(BufferTarget target, Bitfield<BufferMapAccess> access)
	 : _offset(0)
	 , _size(_get_size(target))
	 , _ptr(
		OGLPLUS_GLFUNC(MapBuffer)(
			GLenum(target),
			_translate(GLbitfield(access))
		)
	), _target(target)
	{
		OGLPLUS_CHECK(
			MapBuffer,
			ObjectError,
			ObjectBinding(_target)
		);
	}
Example #2
0
	void Storage(
		const BufferData& data,
		Bitfield<BufferStorageBit> flags
	) const
	{
		OGLPLUS_GLFUNC(NamedBufferStorage)(
			_name,
			GLsizeiptr(data.Size()),
			data.Data(),
			GLbitfield(flags)
		);
		OGLPLUS_CHECK(
			NamedBufferStorage,
			ObjectError,
			Object(*this)
		);
	}
Example #3
0
	/**
	 *  @param buffer use the specified buffer
	 *  @param access the access specifier for the buffer mapping
	 *
	 * This class is non-copyable.
	 *
	 *  @throws Error
	 */
	DSABufferRawMapEXT(
		BufferName buffer,
		Bitfield<BufferMapAccess> access
	): _offset(0)
	 , _size(_get_size(GetGLName(buffer)))
	 , _ptr(
		OGLPLUS_GLFUNC(MapNamedBufferEXT)(
			GetGLName(buffer),
			_translate(GLbitfield(access))
		)
	), _buf_name(GetGLName(buffer))
	{
		OGLPLUS_CHECK(
			MapNamedBufferEXT,
			ObjectError,
			Object(buffer)
		);
	}
Example #4
0
	/**
	 *  @param buffer use the specified buffer
	 *  @param offset map offset in units of Type
	 *  @param size map size in units of Type
	 *  @param access the access specifier for the buffer mapping
	 *
	 *  @throws Error
	 */
	DSABufferRawMapEXT(
		BufferName buffer,
		BufferSize offset,
		BufferSize size,
		Bitfield<BufferMapAccess> access
	): _offset(GLintptr(offset.Get()))
	 , _size(GLsizeiptr(size.Get()))
	 , _ptr(
		OGLPLUS_GLFUNC(MapNamedBufferRangeEXT)(
			GetGLName(buffer),
			_offset,
			_size,
			GLbitfield(access)
		)
	), _buf_name(GetGLName(buffer))
	{
		OGLPLUS_CHECK(
			MapNamedBufferRangeEXT,
			ObjectError,
			Object(buffer)
		);
	}
Example #5
0
	/**
	 *  @param target use the buffer bound to the specified target
	 *  @param byte_offset map offset in machine bytes
	 *  @param size_bytes map size in machine bytes
	 *  @param access the access specifier for the buffer mapping
	 *
	 *  @glsymbols
	 *  @glfunref{MapBufferRange}
	 *
	 *  @throws Error
	 */
	BufferRawMap(
		BufferTarget target,
		GLintptr byte_offset,
		GLsizeiptr size_bytes,
		Bitfield<BufferMapAccess> access
	): _offset(byte_offset)
	 , _size(size_bytes)
	 , _ptr(
		OGLPLUS_GLFUNC(MapBufferRange)(
			GLenum(target),
			byte_offset,
			size_bytes,
			GLbitfield(access)
		)
	), _target(target)
	{
		OGLPLUS_CHECK(
			MapBufferRange,
			Error,
			EnumParam(target)
		);
	}
AbstractFramebuffer& AbstractFramebuffer::clear(const FramebufferClearMask mask) {
    bindInternal(FramebufferTarget::Draw);
    glClear(GLbitfield(mask));

    return *this;
}
void AbstractFramebuffer::blitImplementationNV(AbstractFramebuffer& source, AbstractFramebuffer& destination, const Range2Di& sourceRectangle, const Range2Di& destinationRectangle, const FramebufferBlitMask mask, const FramebufferBlitFilter filter) {
    #ifndef CORRADE_TARGET_NACL
    source.bindInternal(FramebufferTarget::Read);
    destination.bindInternal(FramebufferTarget::Draw);
    glBlitFramebufferNV(sourceRectangle.left(), sourceRectangle.bottom(), sourceRectangle.right(), sourceRectangle.top(), destinationRectangle.left(), destinationRectangle.bottom(), destinationRectangle.right(), destinationRectangle.top(), GLbitfield(mask), GLenum(filter));
    #else
    static_cast<void>(source);
    static_cast<void>(destination);
    static_cast<void>(sourceRectangle);
    static_cast<void>(destinationRectangle);
    static_cast<void>(mask);
    static_cast<void>(filter);
    CORRADE_ASSERT_UNREACHABLE();
    #endif
}
void AbstractFramebuffer::blitImplementationDSA(AbstractFramebuffer& source, AbstractFramebuffer& destination, const Range2Di& sourceRectangle, const Range2Di& destinationRectangle, const FramebufferBlitMask mask, const FramebufferBlitFilter filter) {
    glBlitNamedFramebuffer(source._id, destination._id, sourceRectangle.left(), sourceRectangle.bottom(), sourceRectangle.right(), sourceRectangle.top(), destinationRectangle.left(), destinationRectangle.bottom(), destinationRectangle.right(), destinationRectangle.top(), GLbitfield(mask), GLenum(filter));
}
void AbstractFramebuffer::blitImplementationDefault(AbstractFramebuffer& source, AbstractFramebuffer& destination, const Range2Di& sourceRectangle, const Range2Di& destinationRectangle, const FramebufferBlitMask mask, const FramebufferBlitFilter filter) {
    source.bindInternal(FramebufferTarget::Read);
    destination.bindInternal(FramebufferTarget::Draw);
    glBlitFramebuffer(sourceRectangle.left(), sourceRectangle.bottom(), sourceRectangle.right(), sourceRectangle.top(), destinationRectangle.left(), destinationRectangle.bottom(), destinationRectangle.right(), destinationRectangle.top(), GLbitfield(mask), GLenum(filter));
}
Example #10
0
	/** This function clears the specified buffers.
	 *
	 *  example:
	 *  @code
	 *  Context gl;
	 *  gl.Clear(ClearBit::ColorBuffer);
	 *  gl.Clear(ClearBit::ColorBuffer|ClearBit::DepthBuffer);
	 *  gl.Clear({ClearBit::ColorBuffer});
	 *  gl.Clear({ClearBit::ColorBuffer, ClearBit::DepthBuffer});
	 *  gl.Clear({ClearBit::ColorBuffer, ClearBit::StencilBuffer});
	 *  @endcode
	 *
	 *  @throws Error
	 *
	 *  @see ClearColor
	 *  @see ClearDepth
	 *  @see ClearStencil
	 *
	 *  @glsymbols
	 *  @glfunref{Clear}
	 */
	static void Clear(Bitfield<oglplus::ClearBit> bits)
	{
		OGLPLUS_GLFUNC(Clear)(GLbitfield(bits));
		OGLPLUS_VERIFY_SIMPLE(Clear);
	}
Example #11
0
	/**
	 *  @see Usage
	 *
	 *  @glsymbols
	 *  @glfunref{GetBufferParameter}
	 *  @gldefref{BUFFER_ACCESS}
	 *
	 *  @throws Error
	 */
	Bitfield<BufferMapAccess> Access(void) const
	{
		return Bitfield<BufferMapAccess>(
			GLbitfield(GetIntParam(GL_BUFFER_ACCESS))
		);
	}