void SetTextureF(unsigned int textureId)
{
	if (lastTextureId == textureId)
		return;
	
	glBindTexture(GL_TEXTURE_2D, textureId);
	STATS_AddTexSwitch();
	
	lastTextureId = textureId;
}
Esempio n. 2
0
void SetTexture(unsigned int textureId)
{
	if (lastId == textureId)
		return;
	
	glActiveTexture(GL_TEXTURE0);
	glBindTexture(GL_TEXTURE_2D,textureId);
	glUniform1i ( currentShader->vars[SHADER_TEXT_COLOR_SAMPLER], 0 );
	STATS_AddTexSwitch();
	lastId = textureId;
}
Esempio n. 3
0
void SetTextures(material_t* material)
{
	unsigned int textureId;
	
	textureId = material->textures[TEXTURE_DIFFUSE]->textureId ;
	
	if (lastId != textureId)
	{
		glActiveTexture(GL_TEXTURE0);
		glBindTexture(GL_TEXTURE_2D,textureId);
		glUniform1i ( currentShader->vars[SHADER_TEXT_COLOR_SAMPLER], 0 );
		STATS_AddTexSwitch();
		lastId = textureId;
	}
	
	if ( (currentShader->props & PROP_BUMP) == PROP_BUMP)
	{
		textureId = material->textures[TEXTURE_BUMP]->textureId ;
		
		if (lastBumpId != textureId)
		{
			glActiveTexture(GL_TEXTURE1);
			glBindTexture(GL_TEXTURE_2D,textureId);
			glUniform1i ( currentShader->vars[SHADER_TEXT_BUMP_SAMPLER], 1 );
			lastBumpId = textureId;
		}
	}
	
	if ( (currentShader->props & PROP_SPEC) == PROP_SPEC)
	{
		textureId = material->textures[TEXTURE_SPECULAR]->textureId ;
		
		if (lastSpecId != textureId)
		{
			glActiveTexture(GL_TEXTURE2);
			glBindTexture(GL_TEXTURE_2D,textureId);
			glUniform1i ( currentShader->vars[SHADER_TEXT_SPEC_SAMPLER], 2 );
			lastSpecId = textureId;
		}
	}
	
}