diff --git a/source/ps/KeyName.h b/source/ps/KeyName.h index 6fbcbbee99..fdb0c10b0e 100644 --- a/source/ps/KeyName.h +++ b/source/ps/KeyName.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2009 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 @@ -28,7 +28,7 @@ extern CStr8 FindKeyName( int keycode ); extern int FindKeyCode( const CStr8& keyname ); // Pick a code which is greater than any keycodes used by SDL itself -#if SDL_VERSION_ATLEAST(1, 3, 0) +#if SDL_VERSION_ATLEAST(2, 0, 0) # define CUSTOM_SDL_KEYCODE SDL_SCANCODE_TO_KEYCODE(SDL_NUM_SCANCODES) #else # define CUSTOM_SDL_KEYCODE SDLK_LAST diff --git a/source/ps/VideoMode.cpp b/source/ps/VideoMode.cpp index 5c1c5f59b2..f1e2afd973 100644 --- a/source/ps/VideoMode.cpp +++ b/source/ps/VideoMode.cpp @@ -234,12 +234,13 @@ bool CVideoMode::InitSDL() SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 24); SDL_GL_SetAttribute(SDL_GL_STENCIL_SIZE, 8); SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1); -#if !SDL_VERSION_ATLEAST(1, 3, 0) +#if !SDL_VERSION_ATLEAST(2, 0, 0) SDL_GL_SetAttribute(SDL_GL_SWAP_CONTROL, g_VSync ? 1 : 0); #endif -#if CONFIG2_GLES && SDL_VERSION_ATLEAST(1, 3, 0) +#if CONFIG2_GLES && SDL_VERSION_ATLEAST(2, 0, 0) // Require GLES 2.0 + SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_ES); SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2); SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 0); #endif @@ -254,7 +255,7 @@ bool CVideoMode::InitSDL() return false; } -#if SDL_VERSION_ATLEAST(1, 3, 0) +#if SDL_VERSION_ATLEAST(2, 0, 0) SDL_GL_SetSwapInterval(g_VSync ? 1 : 0); #endif diff --git a/source/renderer/PatchRData.cpp b/source/renderer/PatchRData.cpp index 8cdf2657fc..0bb55f3efc 100644 --- a/source/renderer/PatchRData.cpp +++ b/source/renderer/PatchRData.cpp @@ -1399,8 +1399,11 @@ void CPatchRData::BuildWater() water_indices.push_back(water_index_map[z + water_cell_size][x - water_cell_size]); water_indices.push_back(water_index_map[z][x - water_cell_size]); - water_indices.push_back(water_index_map[z][x]); water_indices.push_back(water_index_map[z + water_cell_size][x]); + + water_indices.push_back(water_index_map[z + water_cell_size][x]); + water_indices.push_back(water_index_map[z][x - water_cell_size]); + water_indices.push_back(water_index_map[z][x]); } } } @@ -1439,12 +1442,8 @@ void CPatchRData::RenderWater(CShaderProgramPtr& shader) if (!g_Renderer.m_SkipSubmit) { u8* indexBase = m_VBWaterIndices->m_Owner->Bind(); -#if CONFIG2_GLES -#warning TODO: fix CPatchRData::RenderWater for GLES (avoid GL_QUADS) -#else - glDrawElements(GL_QUADS, (GLsizei) m_VBWaterIndices->m_Count, + glDrawElements(GL_TRIANGLES, (GLsizei) m_VBWaterIndices->m_Count, GL_UNSIGNED_SHORT, indexBase + sizeof(u16)*(m_VBWaterIndices->m_Index)); -#endif } // bump stats