13 #ifndef OGLPLUS_SAMPLER_1107121519_HPP
14 #define OGLPLUS_SAMPLER_1107121519_HPP
24 #include <oglplus/texture_compare.hpp>
32 #if OGLPLUS_DOCUMENTATION_ONLY || GL_VERSION_3_3 || GL_ARB_sampler_objects
47 static void Gen(tag::Generate, GLsizei count, GLuint* names)
49 assert(names !=
nullptr);
50 OGLPLUS_GLFUNC(GenSamplers)(count, names);
51 OGLPLUS_CHECK_SIMPLE(GenSamplers);
53 #if GL_VERSION_4_5 || GL_ARB_direct_state_access
54 static void Gen(tag::Create, GLsizei count, GLuint* names)
56 assert(names !=
nullptr);
57 OGLPLUS_GLFUNC(CreateSamplers)(count, names);
58 OGLPLUS_CHECK_SIMPLE(CreateSamplers);
62 static void Delete(GLsizei count, GLuint* names)
64 assert(names !=
nullptr);
65 OGLPLUS_GLFUNC(DeleteSamplers)(count, names);
66 OGLPLUS_VERIFY_SIMPLE(DeleteSamplers);
69 static GLboolean IsA(GLuint name)
72 GLboolean result = OGLPLUS_GLFUNC(IsSampler)(name);
73 OGLPLUS_VERIFY_SIMPLE(IsSampler);
110 OGLPLUS_GLFUNC(BindSampler)(
118 Index(GLuint(target))
122 #if OGLPLUS_DOCUMENTATION_ONLY || GL_VERSION_4_4 || GL_ARB_multi_bind
129 OGLPLUS_GLFUNC(BindSamplers)(
134 OGLPLUS_VERIFY_SIMPLE(BindSamplers);
162 ,
public ObjBindingOps<tag::Sampler>
185 :
public ObjZeroOps<tag::DirectState, tag::Sampler>
190 GLint GetIntParam(GLenum query)
const
193 OGLPLUS_GLFUNC(GetSamplerParameteriv)(
199 GetSamplerParameteriv,
207 GLfloat GetFloatParam(GLenum query)
const
210 OGLPLUS_GLFUNC(GetSamplerParameterfv)(
216 GetSamplerParameterfv,
233 OGLPLUS_GLFUNC(GetSamplerParameterfv)(
235 GL_TEXTURE_BORDER_COLOR,
239 GetSamplerParameterfv,
254 OGLPLUS_GLFUNC(SamplerParameterfv)(
256 GL_TEXTURE_BORDER_COLOR,
275 OGLPLUS_GLFUNC(GetSamplerParameterIiv)(
277 GL_TEXTURE_BORDER_COLOR,
281 GetSamplerParameterIiv,
296 OGLPLUS_GLFUNC(SamplerParameterIiv)(
298 GL_TEXTURE_BORDER_COLOR,
317 OGLPLUS_GLFUNC(GetSamplerParameterIuiv)(
319 GL_TEXTURE_BORDER_COLOR,
323 GetSamplerParameterIuiv,
338 OGLPLUS_GLFUNC(SamplerParameterIuiv)(
340 GL_TEXTURE_BORDER_COLOR,
344 SamplerParameterIuiv,
359 GL_TEXTURE_COMPARE_MODE
371 OGLPLUS_GLFUNC(SamplerParameteri)(
373 GL_TEXTURE_COMPARE_MODE,
393 GL_TEXTURE_COMPARE_FUNC
405 OGLPLUS_GLFUNC(SamplerParameteri)(
407 GL_TEXTURE_COMPARE_FUNC,
426 return GetFloatParam(GL_TEXTURE_LOD_BIAS);
437 OGLPLUS_GLFUNC(SamplerParameterf)(
458 OGLPLUS_GLFUNC(SamplerParameteri)(
460 GL_TEXTURE_MIN_FILTER,
469 OGLPLUS_GLFUNC(SamplerParameteri)(
471 GL_TEXTURE_MAG_FILTER,
491 GL_TEXTURE_MAG_FILTER
503 OGLPLUS_GLFUNC(SamplerParameteri)(
505 GL_TEXTURE_MAG_FILTER,
525 GL_TEXTURE_MIN_FILTER
537 OGLPLUS_GLFUNC(SamplerParameteri)(
539 GL_TEXTURE_MIN_FILTER,
558 return GetFloatParam(GL_TEXTURE_MIN_LOD);
569 OGLPLUS_GLFUNC(SamplerParameterf)(
589 return GetFloatParam(GL_TEXTURE_MAX_LOD);
600 OGLPLUS_GLFUNC(SamplerParameterf)(
629 OGLPLUS_GLFUNC(SamplerParameteri)(
708 #if OGLPLUS_DOCUMENTATION_ONLY || GL_ARB_seamless_cubemap_per_texture
717 return GetIntParam(GL_TEXTURE_CUBE_MAP_SEAMLESS) == GL_TRUE;
728 OGLPLUS_GLFUNC(SamplerParameteri)(
730 GL_TEXTURE_CUBE_MAP_SEAMLESS,
731 enable?GL_TRUE:GL_FALSE
743 typedef ObjectOps<tag::DirectState, tag::Sampler>
747 struct SamplerOpsAndSlot
759 inline SamplerOpsAndSlot operator | (
764 return SamplerOpsAndSlot(sam, slot);
770 TextureUnitSelector tus
841 SamplerOpsAndSlot sas,
847 case 0: sas.sam.WrapS(wrap);
break;
848 case 1: sas.sam.WrapT(wrap);
break;
849 case 2: sas.sam.WrapR(wrap);
break;
850 default: assert(!
"Invalid texture wrap slot");
856 template <
typename T>
859 const Vector<T, 4>& col
870 typedef ObjectZero<ObjZeroOps<tag::DirectState, tag::Sampler>>
879 #endif // sampler object
883 #endif // include guard
Texture wrap enumerations.
void MinLOD(GLfloat value)
Sets minimal LOD value.
Definition: sampler.hpp:567
void BorderColor(Vector< GLuint, 4 > color)
Sets the texture border color.
Definition: sampler.hpp:336
Common base class for Object name sequences.
Definition: fwd.hpp:139
void CompareMode(TextureCompareMode mode)
Sets the compare mode.
Definition: sampler.hpp:369
GLfloat LODBias(void) const
Gets the LOD bias value.
Definition: sampler.hpp:424
TextureWrap WrapR(void) const
Gets the wrap parameter for the R coordinate.
Definition: sampler.hpp:692
void MagFilter(TextureMagFilter filter)
Sets the magnification filter.
Definition: sampler.hpp:501
TextureUnitSelector Target
Sampler bind targets.
Definition: sampler.hpp:88
Vector< GLint, 4 > BorderColor(TypeTag< GLint >) const
Gets the texture border color.
Definition: sampler.hpp:272
void WrapT(TextureWrap mode)
Sets the wrap parameter for the T coordinate.
Definition: sampler.hpp:681
void Bind(Target target) const
Binds this sampler to the specified target (texture unit)
Definition: sampler.hpp:174
void Filter(TextureFilter filter) const
Sets both the minification and magnification filter.
Definition: sampler.hpp:456
void BorderColor(Vector< GLfloat, 4 > color)
Sets the texture border color.
Definition: sampler.hpp:252
bool Seamless(void) const
Gets the seamless cubemap setting.
Definition: sampler.hpp:715
TextureWrap WrapT(void) const
Gets the wrap parameter for the T coordinate.
Definition: sampler.hpp:670
TextureFilter
Texture filter enumeration.
Definition: texture_filter.hpp:29
CompareFunction CompareFunc(void) const
Gets the compare function.
Definition: sampler.hpp:390
void BorderColor(Vector< GLint, 4 > color)
Sets the texture border color.
Definition: sampler.hpp:294
TextureMinFilter MinFilter(void) const
Gets the minification filter.
Definition: sampler.hpp:522
TextureMinFilter
Texture minification filter enumeration.
Definition: texture_filter.hpp:71
TextureWrap Wrap(TextureWrapCoord coord) const
Gets the wrap parameter (TEXTURE_WRAP_*)
Definition: sampler.hpp:617
void CompareFunc(CompareFunction func)
Sets the compare function.
Definition: sampler.hpp:403
Declaration of OGLplus object-related error.
Object< SamplerOps > Sampler
An oglplus_object encapsulating the OpenGL sampler functionality.
Definition: sampler.hpp:877
Vector< GLfloat, 4 > BorderColor(TypeTag< GLfloat >) const
Gets the texture border color.
Definition: sampler.hpp:230
Generic OpenGL object wrapper.
A tag template used mainly for data-type-based function overload dispatching.
Definition: data_type.hpp:23
Vector< GLuint, 4 > BorderColor(TypeTag< GLuint >) const
Gets the texture border color.
Definition: sampler.hpp:314
std::size_t size(void) const
Returns the size of the sequence.
Definition: seq_tpl.hpp:166
void MaxLOD(GLfloat value)
Sets maximal LOD value.
Definition: sampler.hpp:598
TextureMagFilter
Texture magnification filter enumeration.
Definition: texture_filter.hpp:50
Implements operations applicable to named (non-zero) objects.
Definition: wrap_tpl.hpp:45
TextureWrap
Texture wrap enumeration.
Definition: texture_wrap.hpp:51
GLuint GetGLName(ObjectName< ObjTag > named)
Returns the GLuint OpenGL name assigned to named object.
Definition: name.hpp:38
static void Bind(Target target, SamplerName sampler)
Binds the specified sampler to the specified target (tex. unit)
Definition: sampler.hpp:105
Class wrapping sampler functions (with direct state access)
Definition: sampler.hpp:184
TextureCompareMode CompareMode(void) const
Gets the compare mode.
Definition: sampler.hpp:356
TextureMagFilter MagFilter(void) const
Gets the magnification filter.
Definition: sampler.hpp:488
OpenGL test/comparison function enumeration.
Sequence of Object names.
TextureCompareMode
Texture compare mode enumeration.
Definition: texture_compare.hpp:29
static void Bind(GLuint first, const Sequence< SamplerName > &samplers)
Sequentially bind samplers to texture units starting with first.
Definition: sampler.hpp:145
Helper macro for optional checking of availability of GL function.
TextureWrap WrapS(void) const
Gets the wrap parameter for the S coordinate.
Definition: sampler.hpp:648
const GLuint * GetGLNames(const Sequence< ObjName > &sequence)
Returns a pointer to array of GL object names stored in a sequence.
Definition: sequence.hpp:23
Texture magnification/minification filter enumerations.
Implements operations applicable to any object including object 0 (zero)
Definition: fwd.hpp:157
Data type-related declarations.
ObjectZero< ObjZeroOps< tag::DirectState, tag::Sampler > > NoSampler
Class that can be used to unbind the currently bound sampler.
Definition: sampler.hpp:871
GLfloat MinLOD(void) const
Gets minimal LOD value.
Definition: sampler.hpp:556
void MinFilter(TextureMinFilter filter)
Sets the minification filter.
Definition: sampler.hpp:535
Exception class for GL object-related errors.
Definition: object.hpp:24
void Wrap(TextureWrapCoord coord, TextureWrap mode)
Sets the wrap parameter (TEXTURE_WRAP_*)
Definition: sampler.hpp:627
GLfloat MaxLOD(void) const
Gets maximal LOD value.
Definition: sampler.hpp:587
ObjectOps< tag::DirectState, tag::Sampler > SamplerOps
Sampler operations with direct state access.
Definition: sampler.hpp:744
void Seamless(bool enable)
Sets the seamless cubemap setting.
Definition: sampler.hpp:726
TextureWrapCoord
Texture wrap parameter coordinate enumeration.
Definition: texture_wrap.hpp:28
void WrapR(TextureWrap mode)
Sets the wrap parameter for the R coordinate.
Definition: sampler.hpp:703
Type for the texture unit selector (implementation-dependent limited) number.
Definition: texture_unit.hpp:22
Implements operations applicable to any object and any operation kind.
Definition: fwd.hpp:151
void WrapS(TextureWrap mode)
Sets the wrap parameter for the S coordinate.
Definition: sampler.hpp:659
void LODBias(GLfloat value)
Sets the LOD bias value.
Definition: sampler.hpp:435
CompareFunction
Comparison function type enumeration.
Definition: compare_function.hpp:30
Basic template for vector types.
Definition: fwd.hpp:43
Texture and image unit selectors.
A common template for "named" objects like textures, buffers, etc.
Definition: fwd.hpp:136
static SamplerName Binding(Target target)
Returns the current Sampler bound to specified target (tex. unit)
Definition: sampler.hpp:95