void BindTextureToSlot(int textureId, GLenum TEXTURE) { int textureIndex=TEXTURE-GL_TEXTURE0; BindTextureSlot(TEXTURE); if(textureBinded[textureIndex]!=textureId) { textureBinded[textureIndex]=textureId; GL_CHECK( glBindTexture(GL_TEXTURE_2D, textureId) ); } }
void PostEffect::Apply() { m_shader->BindShader(); m_shader->UpdateFrameUniforms(); BindTextureSlot(GL_TEXTURE0); GL_CHECK( glBindTexture(GL_TEXTURE_2D, s_renderTexture1->m_colorTex->m_texId) ); m_shader->EnableVertexAttributes(); GL_CHECK( glBindBuffer(GL_ARRAY_BUFFER,s_screenVertexBuffer) ); m_shader->SendVertexBuffer(); GL_CHECK( glBindBuffer(GL_ELEMENT_ARRAY_BUFFER,s_screenIndexBuffer) ); GL_CHECK( glDrawElements(GL_TRIANGLES,s_screenIndexCount,GL_UNSIGNED_SHORT,BUFFER_OFFSET(0)) ); m_shader->DisableVertexAttributes(); GL_CHECK( glBindBuffer(GL_ARRAY_BUFFER,0) ); GL_CHECK( glBindBuffer(GL_ELEMENT_ARRAY_BUFFER,0) ); }