aboutsummaryrefslogtreecommitdiff
path: root/src/libjin/graphics/shaders/je_shader.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/libjin/graphics/shaders/je_shader.cpp')
-rw-r--r--src/libjin/graphics/shaders/je_shader.cpp23
1 files changed, 7 insertions, 16 deletions
diff --git a/src/libjin/graphics/shaders/je_shader.cpp b/src/libjin/graphics/shaders/je_shader.cpp
index 0803e65..8ebca8c 100644
--- a/src/libjin/graphics/shaders/je_shader.cpp
+++ b/src/libjin/graphics/shaders/je_shader.cpp
@@ -56,14 +56,13 @@ namespace JinEngine
// it clear to anybody reading your code that you really mean to sample from
// texture unit 0, and did not just forget to set the value.
//
- const int DEFAULT_TEXTURE_UNIT = 0;
+ const int MAIN_TEXTURE_UNIT = 0;
static GLint textureUnit = 0;
GLint Shader::mAttributeIndex = 0;
Shader::Shader(const string& program)
- //: mCurrentTextureUnit(DEFAULT_TEXTURE_UNIT)
{
if (!compile(program))
{
@@ -83,10 +82,10 @@ namespace JinEngine
Shader& Shader::begin()
{
- textureUnit = DEFAULT_TEXTURE_UNIT;
+ textureUnit = MAIN_TEXTURE_UNIT;
// Send uniforms.
- sendInt(SHADER_MAIN_TEXTURE, DEFAULT_TEXTURE_UNIT);
+ sendInt(SHADER_MAIN_TEXTURE, MAIN_TEXTURE_UNIT);
sendVec2(SHADER_TIME, Time::getSecond(), Time::getDeltaTime());
Canvas* rt = gl.getCanvas();
if (rt == OpenGL::DEFAULT_CANVAS)
@@ -157,14 +156,6 @@ namespace JinEngine
GLint Shader::claimTextureUnit(/*const std::string& name*/)
{
- //std::map<std::string, GLint>::iterator unit = mTextureUnits.find(name);
- //if (unit != mTextureUnits.end())
- // return unit->second;
- //static GLint MAX_TEXTURE_UNITS = getMaxTextureUnits();
- //if (++mCurrentTextureUnit >= MAX_TEXTURE_UNITS)
- // return 0;
- //mTextureUnits[name] = mCurrentTextureUnit;
- //return mCurrentTextureUnit;
return textureUnit++;
}
@@ -224,10 +215,10 @@ namespace JinEngine
// TODO: 쳣󶨵
return *this;
}
- gl.activeTexUnit(unit);
+ gl.activeTextureUnit(unit);
glUniform1i(location, unit);
- gl.bindTexture(tex->getGLTexture());
- gl.activeTexUnit(0);
+ gl.bindTexture2D(tex->getGLTexture());
+ gl.activeTextureUnit(MAIN_TEXTURE_UNIT);
return *this;
}
@@ -245,7 +236,7 @@ namespace JinEngine
}
glUniform1i(location, unit);
glActiveTexture(GL_TEXTURE0 + unit);
- gl.bindTexture(canvas->getGLTexture());
+ gl.bindTexture2D(canvas->getGLTexture());
glActiveTexture(GL_TEXTURE0);
return *this;