Changeset View
Changeset View
Standalone View
Standalone View
source/graphics/LOSTexture.cpp
Show First 20 Lines • Show All 61 Lines • ▼ Show 20 Lines | CLOSTexture::CLOSTexture(CSimulation2& simulation) | ||||
m_Texture(0), m_TextureSmooth1(0), m_TextureSmooth2(0), m_smoothFbo(0), | m_Texture(0), m_TextureSmooth1(0), m_TextureSmooth2(0), m_smoothFbo(0), | ||||
m_MapSize(0), m_TextureSize(0), whichTex(true) | m_MapSize(0), m_TextureSize(0), whichTex(true) | ||||
{ | { | ||||
if (CRenderer::IsInitialised() && g_Renderer.m_Options.m_SmoothLOS) | if (CRenderer::IsInitialised() && g_Renderer.m_Options.m_SmoothLOS) | ||||
CreateShader(); | CreateShader(); | ||||
} | } | ||||
CLOSTexture::~CLOSTexture() | CLOSTexture::~CLOSTexture() | ||||
{ | { | ||||
if (m_Texture) | if (m_Texture) | ||||
nwtour: Compilation error with --gles
```
../../../source/graphics/LOSTexture.cpp: In destructor… | |||||
DeleteTexture(); | DeleteTexture(); | ||||
} | } | ||||
// Create the LOS texture engine. Should be ran only once. | // Create the LOS texture engine. Should be ran only once. | ||||
bool CLOSTexture::CreateShader() | bool CLOSTexture::CreateShader() | ||||
{ | { | ||||
m_smoothShader = g_Renderer.GetShaderManager().LoadEffect(str_los_interp); | m_smoothShader = g_Renderer.GetShaderManager().LoadEffect(str_los_interp); | ||||
CShaderProgramPtr shader = m_smoothShader->GetShader(); | CShaderProgramPtr shader = m_smoothShader->GetShader(); | ||||
m_ShaderInitialized = m_smoothShader && shader; | m_ShaderInitialized = m_smoothShader && shader; | ||||
if (!m_ShaderInitialized) | if (!m_ShaderInitialized) | ||||
{ | { | ||||
LOGERROR("Failed to load SmoothLOS shader, disabling."); | LOGERROR("Failed to load SmoothLOS shader, disabling."); | ||||
g_Renderer.m_Options.m_SmoothLOS = false; | g_Renderer.m_Options.m_SmoothLOS = false; | ||||
return false; | return false; | ||||
} | } | ||||
pglGenFramebuffersEXT(1, &m_smoothFbo); | glGenFramebuffersEXT(1, &m_smoothFbo); | ||||
return true; | return true; | ||||
} | } | ||||
void CLOSTexture::DeleteTexture() | void CLOSTexture::DeleteTexture() | ||||
{ | { | ||||
glDeleteTextures(1, &m_Texture); | glDeleteTextures(1, &m_Texture); | ||||
if (m_TextureSmooth1) | if (m_TextureSmooth1) | ||||
▲ Show 20 Lines • Show All 52 Lines • ▼ Show 20 Lines | void CLOSTexture::InterpolateLOS() | ||||
{ | { | ||||
RecomputeTexture(0); | RecomputeTexture(0); | ||||
m_Dirty = false; | m_Dirty = false; | ||||
} | } | ||||
GLint originalFBO; | GLint originalFBO; | ||||
glGetIntegerv(GL_FRAMEBUFFER_BINDING_EXT, &originalFBO); | glGetIntegerv(GL_FRAMEBUFFER_BINDING_EXT, &originalFBO); | ||||
pglBindFramebufferEXT(GL_FRAMEBUFFER_EXT, m_smoothFbo); | glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, m_smoothFbo); | ||||
pglFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_TEXTURE_2D, | glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_TEXTURE_2D, | ||||
whichTex ? m_TextureSmooth2 : m_TextureSmooth1, 0); | whichTex ? m_TextureSmooth2 : m_TextureSmooth1, 0); | ||||
GLenum status = pglCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT); | GLenum status = glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT); | ||||
if (status != GL_FRAMEBUFFER_COMPLETE_EXT) | if (status != GL_FRAMEBUFFER_COMPLETE_EXT) | ||||
{ | { | ||||
LOGWARNING("LOS framebuffer object incomplete: 0x%04X", status); | LOGWARNING("LOS framebuffer object incomplete: 0x%04X", status); | ||||
} | } | ||||
m_smoothShader->BeginPass(); | m_smoothShader->BeginPass(); | ||||
CShaderProgramPtr shader = m_smoothShader->GetShader(); | CShaderProgramPtr shader = m_smoothShader->GetShader(); | ||||
Show All 33 Lines | void CLOSTexture::InterpolateLOS() | ||||
shader->AssertPointersBound(); | shader->AssertPointersBound(); | ||||
glDrawArrays(GL_TRIANGLES, 0, 6); | glDrawArrays(GL_TRIANGLES, 0, 6); | ||||
g_Renderer.SetViewport(oldVp); | g_Renderer.SetViewport(oldVp); | ||||
shader->Unbind(); | shader->Unbind(); | ||||
m_smoothShader->EndPass(); | m_smoothShader->EndPass(); | ||||
pglFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_TEXTURE_2D, 0, 0); | glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_TEXTURE_2D, 0, 0); | ||||
pglBindFramebufferEXT(GL_FRAMEBUFFER_EXT, originalFBO); | glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, originalFBO); | ||||
whichTex = !whichTex; | whichTex = !whichTex; | ||||
} | } | ||||
GLuint CLOSTexture::GetTexture() | GLuint CLOSTexture::GetTexture() | ||||
{ | { | ||||
if (m_Dirty) | if (m_Dirty) | ||||
▲ Show 20 Lines • Show All 217 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator
Compilation error with --gles
glDeleteFramebuffersEXT - not exists in gles2.h (error if disable in ogl.h)