Esempio n. 1
0
void Game::SwapBuffers() {
	Program* p = this->_blitProgram;

	if (this->_paused) {
		p = this->_blitProgramMap["Sepia"];
	}

	if (p != NULL && p->ProgramId != 0) {
		p->Use();
		p->BindTextures();
		if (this->_paused) {
			p->SetUniform("sepiaRgb", vec3(1.2f, 1.0f, 0.8f));
		}
		p->SetUniform("iGlobalTime", (float)this->_totalTicks);
		p->SetUniform("MVP", GLFuncs::GetInstance()->StaticProjection);
		p->SetUniform("iResolution", vec2(this->_g->DisplayWidth, this->_g->DisplayHeight));
	}

	this->_g->SwapBuffers();
}
Esempio n. 2
0
	void Skin::Bind(int flags, Program& program) const {
		static const char* names[] = {
			"uniTexDiffuse", "uniTexNormal", "uniTexAdd", "uniTexSpec"
		};

		for(int i = 0; i < NUM_LAYERS; ++i) {
			if((1 << i) & flags) {
				if(!_textures[i]) COM::log << "Skin::Bind: attempting to bind non-existent texture on layer " << names[i] << std::endl;
				else {
					program.SetUniform(names[i], i);
					_textures[i]->Bind(i);
				}
			} else {
				glx.ActiveTexture(GL_TEXTURE0 + i);
				glBindTexture(GL_TEXTURE_2D, 0);
			}
		}
	}