Example #1
0
GLuint CTerritoryTexture::GetTexture()
{
	if (UpdateDirty())
		RecomputeTexture(0);

	return m_Texture;
}
Example #2
0
void CTerritoryTexture::BindTexture(int unit)
{
	if (UpdateDirty())
		RecomputeTexture(unit);

	g_Renderer.BindTexture(unit, m_Texture);
}
Example #3
0
GLuint CLOSTexture::GetTexture()
{
	if (m_Dirty)
	{
		RecomputeTexture(0);
		m_Dirty = false;
	}

	return m_Texture;
}
Example #4
0
void CLOSTexture::BindTexture(int unit)
{
	if (m_Dirty)
	{
		RecomputeTexture(unit);
		m_Dirty = false;
	}

	g_Renderer.BindTexture(unit, m_Texture);
}
Example #5
0
void CLOSTexture::InterpolateLOS()
{
	if (CRenderer::IsInitialised() && !g_Renderer.m_Options.m_SmoothLOS)
		return;
	
	if (m_Dirty)
	{
		RecomputeTexture(0);
		m_Dirty = false;
	}
	
	GLint originalFBO;
	glGetIntegerv(GL_FRAMEBUFFER_BINDING, &originalFBO);
	
	pglBindFramebufferEXT(GL_FRAMEBUFFER, m_smoothFbo);
	pglFramebufferTexture2DEXT(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, 
				   whichTex ? m_TextureSmooth2 : m_TextureSmooth1, 0);
	
	GLenum status = pglCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT);
	if (status != GL_FRAMEBUFFER_COMPLETE_EXT)
	{
		LOGWARNING(L"LOS framebuffer object incomplete: 0x%04X", status);
	}

	m_smoothShader->BeginPass();
	CShaderProgramPtr shader = m_smoothShader->GetShader();
	
	shader->Bind();	
	
	shader->BindTexture("losTex1", m_Texture);
	shader->BindTexture("losTex2", whichTex ? m_TextureSmooth1 : m_TextureSmooth2);
	
	shader->Uniform("delta", (float)g_Renderer.GetTimeManager().GetFrameDelta() * 4.0f, 0.0f, 0.0f, 0.0f);
	
	glPushAttrib(GL_VIEWPORT_BIT); 
	glViewport(0, 0, m_TextureSize, m_TextureSize);
	
	glBegin(GL_QUADS);
	    glColor4f(1.f, 1.f, 1.f, 1.f);
	    glTexCoord2f(1.0, 1.0);	glVertex2f(1,1);
	    glTexCoord2f(0.0, 1.0);	glVertex2f(-1,1);	    
	    glTexCoord2f(0.0, 0.0);	glVertex2f(-1,-1);
	    glTexCoord2f(1.0, 0.0);	glVertex2f(1,-1);
	glEnd();
	
	glPopAttrib(); 
	shader->Unbind();
	m_smoothShader->EndPass();
	
	pglFramebufferTexture2DEXT(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, 0, 0);
	
	pglBindFramebufferEXT(GL_FRAMEBUFFER_EXT, originalFBO);
	
	whichTex = !whichTex;
}