diff --git a/source/graphics/LOSTexture.cpp b/source/graphics/LOSTexture.cpp index 2fe3831318..e2b8d07734 100644 --- a/source/graphics/LOSTexture.cpp +++ b/source/graphics/LOSTexture.cpp @@ -1,4 +1,4 @@ -/* Copyright (C) 2012 Wildfire Games. +/* Copyright (C) 2013 Wildfire Games. * This file is part of 0 A.D. * * 0 A.D. is free software: you can redistribute it and/or modify @@ -22,6 +22,7 @@ #include "graphics/ShaderManager.h" #include "graphics/Terrain.h" #include "lib/bits.h" +#include "lib/config2.h" #include "ps/CLogger.h" #include "ps/Game.h" #include "ps/Profile.h" @@ -147,6 +148,9 @@ void CLOSTexture::InterpolateLOS() shader->Uniform(str_delta, (float)g_Renderer.GetTimeManager().GetFrameDelta() * 4.0f, 0.0f, 0.0f, 0.0f); +#if CONFIG2_GLES +#warning TODO: fix CLOSTexture::InterpolateLOS for GLES (avoid GL_QUADS/glPushAttrib) +#else glPushAttrib(GL_VIEWPORT_BIT); glViewport(0, 0, m_TextureSize, m_TextureSize); @@ -159,6 +163,7 @@ void CLOSTexture::InterpolateLOS() glEnd(); glPopAttrib(); +#endif shader->Unbind(); m_smoothShader->EndPass(); diff --git a/source/graphics/ShaderManager.cpp b/source/graphics/ShaderManager.cpp index b18a84578e..929123c9ac 100644 --- a/source/graphics/ShaderManager.cpp +++ b/source/graphics/ShaderManager.cpp @@ -1,4 +1,4 @@ -/* Copyright (C) 2012 Wildfire Games. +/* Copyright (C) 2013 Wildfire Games. * This file is part of 0 A.D. * * 0 A.D. is free software: you can redistribute it and/or modify @@ -20,6 +20,7 @@ #include "ShaderManager.h" #include "graphics/ShaderTechnique.h" +#include "lib/config2.h" #include "lib/timer.h" #include "lib/utf8.h" #include "ps/CLogger.h" @@ -246,11 +247,19 @@ bool CShaderManager::NewProgram(const char* name, const CShaderDefines& baseDefi GLenum type = GL_TEXTURE_2D; CStr t = Attrs.GetNamedItem(at_type); if (t == "sampler1D") +#if CONFIG2_GLES + debug_warn(L"sampler1D not implemented on GLES"); +#else type = GL_TEXTURE_1D; +#endif else if (t == "sampler2D") type = GL_TEXTURE_2D; else if (t == "sampler3D") +#if CONFIG2_GLES + debug_warn(L"sampler3D not implemented on GLES"); +#else type = GL_TEXTURE_3D; +#endif else if (t == "samplerCube") type = GL_TEXTURE_CUBE_MAP; diff --git a/source/graphics/ShaderProgram.cpp b/source/graphics/ShaderProgram.cpp index 356e6a9015..817ff41d73 100644 --- a/source/graphics/ShaderProgram.cpp +++ b/source/graphics/ShaderProgram.cpp @@ -1,4 +1,4 @@ -/* Copyright (C) 2012 Wildfire Games. +/* Copyright (C) 2013 Wildfire Games. * This file is part of 0 A.D. * * 0 A.D. is free software: you can redistribute it and/or modify @@ -660,7 +660,7 @@ CShaderProgram::CShaderProgram(int streamflags) #if CONFIG2_GLES /*static*/ CShaderProgram* CShaderProgram::ConstructARB(const VfsPath& vertexFile, const VfsPath& fragmentFile, const CShaderDefines& UNUSED(defines), - const std::map& UNUSED(vertexIndexes), const std::map& UNUSED(fragmentIndexes), + const std::map& UNUSED(vertexIndexes), const std::map& UNUSED(fragmentIndexes), int UNUSED(streamflags)) { LOGERROR(L"CShaderProgram::ConstructARB: '%ls'+'%ls': ARB shaders not supported on this device", diff --git a/source/lib/external_libraries/glext_funcs.h b/source/lib/external_libraries/glext_funcs.h index c33c4e28b8..2034fc1e1d 100644 --- a/source/lib/external_libraries/glext_funcs.h +++ b/source/lib/external_libraries/glext_funcs.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2011 Wildfire Games +/* Copyright (c) 2013 Wildfire Games * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the @@ -115,6 +115,7 @@ actually supported). #define GL_DEPTH_ATTACHMENT_EXT GL_DEPTH_ATTACHMENT #define GL_COLOR_ATTACHMENT0_EXT GL_COLOR_ATTACHMENT0 +#define GL_FRAMEBUFFER_BINDING_EXT GL_FRAMEBUFFER_BINDING #define GL_FRAMEBUFFER_COMPLETE_EXT GL_FRAMEBUFFER_COMPLETE #define GL_FRAMEBUFFER_EXT GL_FRAMEBUFFER diff --git a/source/renderer/PostprocManager.cpp b/source/renderer/PostprocManager.cpp index e98a092e30..5eefcb4249 100644 --- a/source/renderer/PostprocManager.cpp +++ b/source/renderer/PostprocManager.cpp @@ -1,4 +1,4 @@ -/* Copyright (C) 2012 Wildfire Games. +/* Copyright (C) 2013 Wildfire Games. * This file is part of 0 A.D. * * 0 A.D. is free software: you can redistribute it and/or modify @@ -34,6 +34,7 @@ #include "renderer/PostprocManager.h" #include "renderer/Renderer.h" +#if !CONFIG2_GLES CPostprocManager::CPostprocManager() : m_IsInitialised(false), m_PingFbo(0), m_PongFbo(0), m_PostProcEffect(L"default"), m_ColourTex1(0), m_ColourTex2(0), @@ -486,3 +487,66 @@ void CPostprocManager::SetPostEffect(CStrW name) { LoadEffect(name); } + +#else + +#warning TODO: implement PostprocManager for GLES + +void ApplyBlurDownscale2x(GLuint UNUSED(inTex), GLuint UNUSED(outTex), int UNUSED(inWidth), int UNUSED(inHeight)) +{ +} + +void CPostprocManager::ApplyBlurGauss(GLuint UNUSED(inOutTex), GLuint UNUSED(tempTex), int UNUSED(inWidth), int UNUSED(inHeight)) +{ +} + +void CPostprocManager::ApplyEffect(CShaderTechniquePtr &UNUSED(shaderTech1), int UNUSED(pass)) +{ +} + +CPostprocManager::CPostprocManager() +{ +} + +CPostprocManager::~CPostprocManager() +{ +} + +void CPostprocManager::Initialize() +{ +} + +void CPostprocManager::Cleanup() +{ +} + +void CPostprocManager::RecreateBuffers() +{ +} + +void CPostprocManager::LoadEffect(CStrW &UNUSED(name)) +{ +} + +std::vector CPostprocManager::GetPostEffects() const +{ + return std::vector(); +} + +void CPostprocManager::SetPostEffect(CStrW UNUSED(name)) +{ +} + +void CPostprocManager::CaptureRenderOutput() +{ +} + +void CPostprocManager::ApplyPostproc() +{ +} + +void CPostprocManager::ReleaseRenderOutput() +{ +} + +#endif diff --git a/source/renderer/SkyManager.cpp b/source/renderer/SkyManager.cpp index a05706c036..fa92b14c72 100644 --- a/source/renderer/SkyManager.cpp +++ b/source/renderer/SkyManager.cpp @@ -1,4 +1,4 @@ -/* Copyright (C) 2012 Wildfire Games. +/* Copyright (C) 2013 Wildfire Games. * This file is part of 0 A.D. * * 0 A.D. is free software: you can redistribute it and/or modify @@ -167,8 +167,11 @@ void SkyManager::LoadSkyTextures() glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MIN_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); +#if CONFIG2_GLES +#warning TODO: fix SkyManager::LoadSkyTextures for GLES +#else glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_R, GL_CLAMP_TO_EDGE); - +#endif glBindTexture(GL_TEXTURE_2D, 0); /////////////////////////////////////////////////////////////////////////// } diff --git a/source/renderer/TerrainRenderer.cpp b/source/renderer/TerrainRenderer.cpp index f5592ed404..ba9c4f931f 100644 --- a/source/renderer/TerrainRenderer.cpp +++ b/source/renderer/TerrainRenderer.cpp @@ -703,16 +703,25 @@ bool TerrainRenderer::RenderFancyWater(const CShaderDefines& context, ShadowMap* glGenTextures(1, (GLuint*)&depthTex); WaterMgr->m_depthTT = depthTex; glBindTexture(GL_TEXTURE_2D, WaterMgr->m_depthTT); + +#if CONFIG2_GLES + GLenum format = GL_DEPTH_COMPONENT; +#else + GLenum format = GL_DEPTH_COMPONENT32; +#endif + // TODO: use POT texture - glTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT32, g_Renderer.GetWidth(), g_Renderer.GetHeight(), + glTexImage2D(GL_TEXTURE_2D, 0, format, g_Renderer.GetWidth(), g_Renderer.GetHeight(), 0, GL_DEPTH_COMPONENT, GL_UNSIGNED_BYTE,NULL); } glBindTexture(GL_TEXTURE_2D, WaterMgr->m_depthTT); +#if !CONFIG2_GLES glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_COMPARE_MODE, GL_NONE); +#endif glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); glCopyTexImage2D(GL_TEXTURE_2D,0,GL_DEPTH_COMPONENT, 0, 0, g_Renderer.GetWidth(), g_Renderer.GetHeight(), 0); @@ -781,7 +790,11 @@ bool TerrainRenderer::RenderFancyWater(const CShaderDefines& context, ShadowMap* m->wavesShader->TexCoordPointer(GL_TEXTURE0,2,GL_BYTE, stride,&base[WaterMgr->m_VBWaves->m_Index].m_UV); m->wavesShader->AssertPointersBound(); u8* indexBase = WaterMgr->m_VBWavesIndices->m_Owner->Bind(); +#if CONFIG2_GLES +#warning TODO: fix TerrainRenderer::RenderFancyWater for GLES (avoid GL_QUADS) +#else glDrawElements(GL_QUADS, (GLsizei) WaterMgr->m_VBWavesIndices->m_Count, GL_UNSIGNED_SHORT, indexBase + sizeof(u16)*(WaterMgr->m_VBWavesIndices->m_Index)); +#endif g_Renderer.m_Stats.m_DrawCalls++; CVertexBuffer::Unbind(); m->wavesShader->Unbind();