PrevUpHomeNext

DSA textures

#include <oglplus/dsa/texture.hpp>

Operations with explicit selector

#if GL_VERSION_4_5 || GL_ARB_direct_state_access

template <>
class ObjectOps<tag::DirectState, tag::Texture>
 : public ObjZeroOps<tag::DirectState, tag::Texture> 1
{
public:
	struct Property
	{
		typedef TextureCompareMode CompareMode;

		typedef TextureFilter Filter;

		typedef TextureMagFilter MagFilter;

		typedef TextureMinFilter MinFilter;

		typedef TextureSwizzleCoord SwizzleCoord;

		typedef TextureSwizzle Swizzle;

#if GL_ARB_texture_swizzle
		typedef TextureSwizzleTuple SwizzleTuple;
#endif
		typedef TextureWrapCoord WrapCoord;

		typedef TextureWrap Wrap;

		typedef OneOf<
			DataType,
			PixelDataType
		> PixDataType;
	};

	SizeType Width(GLint level = 0) const; 2

	SizeType Height(GLint level = 0) const; 3

	SizeType Depth(GLint level = 0) const; 4

	PixelDataType RedType(GLint level = 0) const; 5

	PixelDataType GreenType(GLint level = 0) const; 6

	PixelDataType BlueType(GLint level = 0) const; 7

	PixelDataType AlphaType(GLint level = 0) const; 8

	PixelDataType DepthType(GLint level = 0) const; 9

	SizeType RedSize(GLint level = 0) const; 10

	SizeType GreenSize(GLint level = 0) const; 11

	SizeType BlueSize(GLint level = 0) const; 12

	SizeType AlphaSize(GLint level = 0) const; 13

	SizeType DepthSize(GLint level = 0) const; 14

	SizeType StencilSize(GLint level = 0) const; 15

	SizeType SharedSize(GLint level = 0) const; (16)

1

Indirectly inherits from ObjCommonOps<tag::Texture>.

2

Returns the width of the texture image on the specified level. See glGetTextureLevelParameter, GL_TEXTURE_WIDTH.

3

Returns the height of the texture image on the specified level. See glGetTextureLevelParameter, GL_TEXTURE_HEIGHT.

4

Returns the depth of the texture image on the specified level. See glGetTextureLevelParameter, GL_TEXTURE_DEPTH.

5

Returns the data type used to store the RED component. See glGetTextureLevelParameter, GL_TEXTURE_RED_TYPE.

6

Returns the data type used to store the GREEN component. See glGetTextureLevelParameter, GL_TEXTURE_GREEN_TYPE.

7

Returns the data type used to store the BLUE component. See glGetTextureLevelParameter, GL_TEXTURE_BLUE_TYPE.

8

Returns the data type used to store the ALPHA component. See glGetTextureLevelParameter, GL_TEXTURE_ALPHA_TYPE.

9

Returns the data type used to store the DEPTH component. See glGetTextureLevelParameter, GL_TEXTURE_DEPTH_TYPE.

10

Returns the actual resolution of the RED component. See glGetTextureLevelParameter, GL_TEXTURE_RED_SIZE.

11

Returns the actual resolution of the GREEN component. See glGetTextureLevelParameter, GL_TEXTURE_GREEN_SIZE.

12

Returns the actual resolution of the BLUE component. See glGetTextureLevelParameter, GL_TEXTURE_BLUE_SIZE.

13

Returns the actual resolution of the ALPHA component. See glGetTextureLevelParameter, GL_TEXTURE_ALPHA_SIZE.

14

Returns the actual resolution of the DEPTH component. See glGetTextureLevelParameter, GL_TEXTURE_DEPTH_SIZE.

15

Returns the actual resolution of the STENCIL component. See glGetTextureLevelParameter, GL_TEXTURE_STENCIL_SIZE.

(16)

Returns the actual resolution of all texture components. See glGetTextureLevelParameter, GL_TEXTURE_SHARED_SIZE.

	SizeType CompressedImageSize(GLint level = 0) const; 1

	PixelDataInternalFormat InternalFormat(GLint level = 0) const; 2

	void GetImage(
		GLint level,
		PixelDataFormat format,
		const OutputData& dest
	) const; 3
	void GetImage(
		GLint level,
		PixelDataFormat format,
		Property::PixDataType type,
		SizeType size,
		GLvoid* buffer
	) const;

	void GetCompressedImage(
		GLint level,
		const OutputData& dest
	) const; 4
	void GetCompressedImage(
		GLint level,
		std::vector<GLubyte>& dest
	) const;
	void GetCompressedImage(
		GLint level,
		SizeType size,
		GLubyte* buffer
	) const;

	ObjectOps& Image3D(
		GLint level,
		PixelDataInternalFormat internal_format,
		SizeType width,
		SizeType height,
		SizeType depth,
		GLint border,
		PixelDataFormat format,
		Property::PixDataType type,
		const void* data
	); 5

	ObjectOps& Image3D(
		const images::Image& image,
		GLint level = 0,
		GLint border = 0
	);

	ObjectOps& SubImage3D(
		GLint level,
		GLint xoffs,
		GLint yoffs,
		GLint zoffs,
		SizeType width,
		SizeType height,
		SizeType depth,
		PixelDataFormat format,
		Property::PixDataType type,
		const void* data
	); 6

	ObjectOps& SubImage3D(
		const images::Image& image,
		GLint xoffs,
		GLint yoffs,
		GLint zoffs,
		GLint level = 0
	);

	ObjectOps& Image2D(
		GLint level,
		PixelDataInternalFormat internal_format,
		SizeType width,
		SizeType height,
		GLint border,
		PixelDataFormat format,
		Property::PixDataType type,
		const void* data
	); 7

	ObjectOps& Image2D(
		const images::Image& image,
		GLint level = 0,
		GLint border = 0
	);

	ObjectOps& SubImage2D(
		GLint level,
		GLint xoffs,
		GLint yoffs,
		SizeType width,
		SizeType height,
		PixelDataFormat format,
		Property::PixDataType type,
		const void* data
	); 8

	ObjectOps& SubImage2D(
		const images::Image& image,
		GLint xoffs,
		GLint yoffs,
		GLint level = 0
	);

	ObjectOps& Image1D(
		GLint level,
		PixelDataInternalFormat internal_format,
		SizeType width,
		GLint border,
		PixelDataFormat format,
		Property::PixDataType type,
		const void* data
	); 9

	ObjectOps& Image1D(
		const images::Image& image,
		GLint level = 0,
		GLint border = 0
	);

	ObjectOps& SubImage1D(
		GLint level,
		GLint xoffs,
		SizeType width,
		PixelDataFormat format,
		Property::PixDataType type,
		const void* data
	);  10

	ObjectOps& SubImage1D(
		const images::Image& image,
		GLint xoffs,
		GLint level = 0
	);

1

Returns the size (in bytes) of the image array if it is compressed. See glGetTextureLevelParameter, GL_TEXTURE_COMPRESSED_IMAGE_SIZE.

2

Returns the internal data format of the image array. See glGetTextureLevelParameter, GL_TEXTURE_INTERNAL_FORMAT.

3

Stores the image of this texture with the specified level of detail in uncompressed form into the dest buffer. See glGetTextureImage.

[Note] Note

This function, unlike GetCompressedImage, does NOT automatically resize the destination buffer so that it can accomodate the texture data. The caller is responsible for keeping track or querying the type of the texture, its dimensions and current pixel transfer settings and resize the dest buffer accordingly.

4

Stores the image of this texture with the specified level of detail in compressed form into the dest buffer. See glGetCompressedTextureImage. This function automatically resizes the buffer so that it can accomodate the texture data.

5

Specifies a three dimensional texture image. See glTextureImage3D.

6

Specifies a three dimensional texture subimage. See glTextureSubImage3D.

7

Specifies a two dimensional texture image. See glTextureImage2D.

8

Specifies a two dimensional texture subimage. See glTextureSubImage2D.

9

Specifies a one dimensional texture image. See glTextureImage1D.

10

Specifies a one dimensional texture subimage. See glTextureSubImage1D.

	ObjectOps& CopySubImage3D(
		GLint level,
		GLint xoffs,
		GLint yoffs,
		GLint zoffs,
		GLint x,
		GLint y,
		SizeType width,
		SizeType height
	); 1

	ObjectOps& CopySubImage2D(
		GLint level,
		GLint xoffs,
		GLint yoffs,
		GLint x,
		GLint y,
		SizeType width,
		SizeType height
	); 2

	ObjectOps& CopySubImage1D(
		GLint level,
		GLint xoffs,
		GLint x,
		GLint y,
		SizeType width
	); 3

	ObjectOps& CompressedSubImage3D(
		GLint level,
		GLint xoffs,
		GLint yoffs,
		GLint zoffs,
		SizeType width,
		SizeType height,
		SizeType depth,
		PixelDataFormat format,
		SizeType image_size,
		const void* data
	); 4

	ObjectOps& CompressedSubImage2D(
		GLint level,
		GLint xoffs,
		GLint yoffs,
		SizeType width,
		SizeType height,
		PixelDataFormat format,
		SizeType image_size,
		const void* data
	); 5

	ObjectOps& CompressedSubImage1D(
		GLint level,
		GLint xoffs,
		SizeType width,
		PixelDataFormat format,
		SizeType image_size,
		const void* data
	); 6

1

Copies a three dimensional texture subimage from the current framebuffer. See glCopyTextureSubImage3D.

2

Copies a two dimensional texture subimage from the current framebuffer. See glCopyTextureSubImage2D.

3

Copies a one dimensional texture subimage from the current framebuffer. See glCopyTextureSubImage2D.

4

Specifies a three dimensional compressed texture subimage. See glCompressedTextureSubImage3D.

5

Specifies a two dimensional compressed texture subimage. See glCompressedTextureSubImage2D.

6

Specifies a one dimensional compressed texture subimage. See glCompressedTextureSubImage1D.

	ObjectOps& Buffer(
		PixelDataInternalFormat internal_format,
		BufferName buffer
	); 1

#if GL_ARB_texture_storage
	static void Storage3D(
		TextureTarget target,
		SizeType levels,
		PixelDataInternalFormat internal_format,
		SizeType width,
		SizeType height,
		SizeType depth
	); 2

	static void Storage2D(
		TextureTarget target,
		SizeType levels,
		PixelDataInternalFormat internal_format,
		SizeType width,
		SizeType height
	); 3

	static void Storage1D(
		TextureTarget target,
		SizeType levels,
		PixelDataInternalFormat internal_format,
		SizeType width
	); 4
#endif

	GLuint BaseLevel(void) const; 5

	ObjectOps& BaseLevel(GLuint level); 6

	Vector<GLfloat, 4> BorderColor(TypeTag<GLfloat>) const; 7
	Vector<GLint, 4> BorderColor(TypeTag<GLint>) const;
	Vector<GLuint, 4> BorderColor(TypeTag<GLuint>) const;

	ObjectOps& BorderColor(Vector<GLfloat, 4> color); 8
	ObjectOps& BorderColor(Vector<GLint, 4> color);
	ObjectOps& BorderColor(Vector<GLuint, 4> color);

	TextureCompareMode CompareMode(void) const; 9

	ObjectOps& CompareMode(TextureCompareMode mode); 10

	CompareFunction CompareFunc(void) const; 11

	ObjectOps& CompareFunc(CompareFunction func); 12

1

Assigns a buffer storing the texel data to the texture. See glTexureBuffer.

2

Specifies all levels of 3D texture at the same time. See glTextureStorage3D.

3

Specifies all levels of 2D texture at the same time. See glTextureStorage2D.

4

Specifies all levels of 1D texture at the same time. See glTextureStorage1D.

5

Returns the texture base level. See glGetTextureParameter, GL_TEXTURE_BASE_LEVEL.

6

Sets the texture base level. See glTextureParameter, GL_TEXTURE_BASE_LEVEL.

7

Gets the texture border color. See glGetTextureParameter, GL_TEXTURE_BORDER_COLOR.

8

Sets the texture border color. See glTextureParameter, GL_TEXTURE_BORDER_COLOR.

9

Gets the texture compare mode. See glGetTextureParameter, GL_TEXTURE_COMPARE_MODE.

10

Sets the texture compare mode. See glTextureParameter, GL_TEXTURE_COMPARE_MODE.

11

Gets the texture compare function. See glGetTextureParameter, GL_TEXTURE_COMPARE_FUNC.

12

Sets the texture compare function. See glTextureParameter, GL_TEXTURE_COMPARE_FUNC.

	GLfloat LODBias(void) const; 1

	ObjectOps& LODBias(GLfloat value); 2

	ObjectOps& Filter(TextureFilter filter); 3

	TextureMagFilter MagFilter(void) const; 4

	ObjectOps& MagFilter(TextureMagFilter filter); 5

	TextureMinFilter MinFilter(void) const; 6

	ObjectOps& MinFilter(TextureMinFilter filter); 7

	GLfloat MinLOD(void) const; 8

	ObjectOps& MinLOD(GLfloat value); 9

	GLfloat MaxLOD(void) const; 10

	ObjectOps& MaxLOD(GLfloat value); 11

	GLint MaxLevel(void) const; 12

	ObjectOps& MaxLevel(GLint value); 13

1

Gets the level-of-detail bias value. See glGetTextureParameter, GL_TEXTURE_LOD_BIAS.

2

Sets the level-of-detail bias value. See glTextureParameter, GL_TEXTURE_LOD_BIAS.

3

Sets both the minification and magnification filter. See glTextureParameter, GL_TEXTURE_MIN_FILTER, GL_TEXTURE_MAG_FILTER.

4

Gets the magnification filter. See glGetTextureParameter, GL_TEXTURE_MAG_FILTER.

5

Sets the magnification filter. See glTextureParameter, GL_TEXTURE_MAG_FILTER.

6

Gets the minification filter. See glGetTextureParameter, GL_TEXTURE_MIN_FILTER.

7

Sets the minification filter. See glTextureParameter, GL_TEXTURE_MIN_FILTER.

8

Gets minimal level-of-detail value. See glGetTextureParameter, GL_TEXTURE_MIN_LOD.

9

Sets minimal level-of-detail value. See glTextureParameter, GL_TEXTURE_MIN_LOD.

10

Gets maximal level-of-detail value. See glGetTextureParameter, GL_TEXTURE_MAX_LOD.

11

Sets maximal level-of-detail value. See glTextureParameter, GL_TEXTURE_MAX_LOD.

12

Gets the maximum level value. See glGetTextureParameter, GL_TEXTURE_MAX_LEVEL.

13

Sets the maximum level value. See glTextureParameter, GL_TEXTURE_MAX_LEVEL.

	GLfloat MaxAnisotropy(void) const; 1

	GLfloat Anisotropy(void) const; 2

	ObjectOps& Anisotropy(GLfloat value); 3

#if GL_ARB_texture_swizzle
	TextureSwizzle Swizzle(TextureSwizzleCoord coord) const; 4
	TextureSwizzle SwizzleR(void) const;
	TextureSwizzle SwizzleG(void) const;
	TextureSwizzle SwizzleB(void) const;
	TextureSwizzle SwizzleA(void) const;
	TextureSwizzleTuple SwizzleRGBA(void) const;

	ObjectOps& Swizzle(
		TextureSwizzleCoord coord,
		TextureSwizzle mode
	); 5
	ObjectOps& SwizzleR(TextureSwizzle mode);
	ObjectOps& SwizzleG(TextureSwizzle mode);
	ObjectOps& SwizzleB(TextureSwizzle mode);
	ObjectOps& SwizzleA(TextureSwizzle mode);
	ObjectOps& SwizzleRGBA(TextureSwizzle mode);
	ObjectOps& SwizzleRGBA(
		TextureSwizzle mode_r,
		TextureSwizzle mode_g,
		TextureSwizzle mode_b,
		TextureSwizzle mode_a
	);
	ObjectOps& SwizzleRGBA(const TextureSwizzleTuple& modes);
#endif

	TextureWrap Wrap(TextureWrapCoord coord) const; 6
	TextureWrap WrapS(void) const;
	TextureWrap WrapT(void) const;
	TextureWrap WrapR(void) const;


	ObjectOps& Wrap(
		TextureWrapCoord coord,
		TextureWrap mode
	); 7
	ObjectOps& WrapS(TextureWrap mode);
	ObjectOps& WrapT(TextureWrap mode);
	ObjectOps& WrapR(TextureWrap mode);

	PixelDataFormat DepthStencilMode(void) const; 8

	ObjectOps& DepthStencilMode(PixelDataFormat mode); 9

#if GL_ARB_seamless_cubemap_per_texture
	Boolean Seamless(void); 10

	ObjectOps& Seamless(Boolean enable); 11
#endif

	ObjectOps& GenerateMipmap(void) 12
};

1

Gets the maximum anisotropy value. See glGetTextureParameter, GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT.

2

Gets the current anisotropy level. See glGetTextureParameter, GL_TEXTURE_MAX_ANISOTROPY_EXT.

3

Sets the anisotropy level. See glTextureParameter, GL_TEXTURE_MAX_ANISOTROPY_EXT.

4

Gets the swizzle parameter. See glGetTextureParameter, GL_TEXTURE_SWIZZLE_R, GL_TEXTURE_SWIZZLE_G, GL_TEXTURE_SWIZZLE_B, GL_TEXTURE_SWIZZLE_A, GL_TEXTURE_SWIZZLE_RGBA.

5

Sets the swizzle parameter. See glTextureParameter, GL_TEXTURE_SWIZZLE_R, GL_TEXTURE_SWIZZLE_G, GL_TEXTURE_SWIZZLE_B, GL_TEXTURE_SWIZZLE_A, GL_TEXTURE_SWIZZLE_RGBA.

6

Gets the swizzle parameter. See glGetTextureParameter, GL_TEXTURE_WRAP_S, GL_TEXTURE_WRAP_T, GL_TEXTURE_WRAP_R.

7

Sets the swizzle parameter. See glTextureParameter, GL_TEXTURE_WRAP_S, GL_TEXTURE_WRAP_T, GL_TEXTURE_WRAP_R.

8

Gets the depth stencil mode parameter. See glGetTextureParameter, GL_DEPTH_STENCIL_TEXTURE_MODE.

9

Sets the depth stencil mode parameter. See glTextureParameter, GL_DEPTH_STENCIL_TEXTURE_MODE.

10

Gets the seamless cubemap setting value. See glGetTextureParameter, GL_TEXTURE_CUBE_MAP_SEAMLESS.

11

Changes the seamless cubemap setting value. See glTextureParameter, GL_TEXTURE_CUBE_MAP_SEAMLESS.

12

Generates mipmap for the texture bound to the specified target. See glGenerateTextureMipmap.

Definition

typedef ObjectOps<tag::DirectState, tag::Texture>
	DSATextureOps;

typedef Object<DSATextureOps> Texture;

Syntax sugar

struct DSATextureOpsAndSlot { }; 1

DSATextureOpsAndSlot operator | (
	DSATextureOps& tex,
	GLuint slot
);

DSATextureOps& operator << (
	DSATextureOps& tex,
	TextureTarget target
); 2

DSATextureOps& operator << (
	DSATextureOps& tex,
	TextureFilter filter
); 3

DSATextureOps& operator << (
	DSATextureOps& tex,
	TextureMinFilter filter
); 4

DSATextureOps& operator << (
	DSATextureOps& tex,
	TextureMagFilter filter
); 5

DSATextureOps& operator << (
	DSATextureOps& tex,
	TextureCompareMode mode
); 6

DSATextureOps& operator << (
	DSATextureOps& tex,
	CompareFunction func
); 7

DSATextureOps& operator << (
	DSATextureOpsAndSlot tas,
	TextureWrap wrap
); 8

DSATextureOps& operator << (
	DSATextureOps& tex,
	TextureSwizzle swizzle
); 9

DSATextureOps& operator << (
	DSATextureOpsAndSlot tas,
	TextureSwizzle swizzle
); 10

template <typename T>
DSATextureOps& operator << (
	DSATextureOps& tex,
	const Vector<T, 4>& col
); 11

// TODO

#endif // GL_VERSION_4_5 || GL_ARB_direct_state_access

1

Helper class for syntax-sugar operators.

2

Bind

3

Filter

4

MinFilter

5

MagFilter

6

CompareMode

7

CompareFunc

8

Wrap

9

Swizzle

10

Swizzle

11

BorderColor


PrevUpHomeNext