16#include "ResourcePool.h"
17#include <AUI/GL/State.h>
20template<
unsigned int TEXTURE_TARGET>
23 gl::State::bindTexture(TEXTURE_TARGET, mTexture);
25 setupMirroredRepeat();
28template<
unsigned int TEXTURE_TARGET>
31 gl::State::bindTexture(TEXTURE_TARGET, 0);
34template<
unsigned int TEXTURE_TARGET>
36 if (mFiltering == Filtering::NEAREST) {
40 mFiltering = Filtering::NEAREST;
41 glTexParameteri(TEXTURE_TARGET, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
42 glTexParameteri(TEXTURE_TARGET, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
44template<
unsigned int TEXTURE_TARGET>
46 if (mFiltering == Filtering::LINEAR) {
50 mFiltering = Filtering::LINEAR;
51 glTexParameteri(TEXTURE_TARGET, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
52 glTexParameteri(TEXTURE_TARGET, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
55template<
unsigned int TEXTURE_TARGET>
57 if (mWrapping == Wrapping::REPEAT) {
61 mWrapping = Wrapping::REPEAT;
62 glTexParameteri(TEXTURE_TARGET, GL_TEXTURE_WRAP_S, GL_REPEAT);
63 glTexParameteri(TEXTURE_TARGET, GL_TEXTURE_WRAP_T, GL_REPEAT);
66template<
unsigned int TEXTURE_TARGET>
68 if (mWrapping == Wrapping::MIRRORED_REPEAT) {
72 mWrapping = Wrapping::MIRRORED_REPEAT;
73 glTexParameteri(TEXTURE_TARGET, GL_TEXTURE_WRAP_S, GL_MIRRORED_REPEAT);
74 glTexParameteri(TEXTURE_TARGET, GL_TEXTURE_WRAP_T, GL_MIRRORED_REPEAT);
77template<
unsigned int TEXTURE_TARGET>
79 if (mWrapping == Wrapping::CLAMP_TO_EDGE) {
83 mWrapping = Wrapping::CLAMP_TO_EDGE;
84 glTexParameteri(TEXTURE_TARGET, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
85 glTexParameteri(TEXTURE_TARGET, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
88template<
unsigned int TEXTURE_TARGET>
90 AUI_ASSERTX(getHandle() != 0,
"gl::Texture::bind: mTexture == 0");
91 gl::State::activeTexture(index);
92 gl::State::bindTexture(TEXTURE_TARGET, mTexture);
95template<
unsigned int TEXTURE_TARGET>
97 gl::State::activeTexture(index);
98 gl::State::bindTexture(TEXTURE_TARGET, 0);
Definition: ResourcePool.h:56
#define AUI_ASSERTX(condition, what)
Asserts that the passed condition evaluates to true. Adds extra message string.
Definition: Assert.h:74