forked from 0ad/0ad
Fixes basic water rendering on GLES (replaces GL_QUADS with GL_TRIANGLES).
Sets SDL2 to use correct profile for GLES. Cleans up some old SDL 1.3 version checks. This was SVN commit r14150.
This commit is contained in:
parent
5771bee032
commit
81eabfc934
@ -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
|
||||
|
@ -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
|
||||
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user