Status: | Merged | ||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Merged at revision: | 6242 | ||||||||||||||||||||
Proposed branch: | lp:~shevonar/widelands/opengl | ||||||||||||||||||||
Merge into: | lp:widelands | ||||||||||||||||||||
Diff against target: |
1106 lines (+541/-129) 16 files modified
ChangeLog (+7/-1) src/graphic/graphic.cc (+20/-4) src/graphic/graphic.h (+3/-1) src/graphic/render/gameview.cc (+12/-79) src/graphic/render/gameview.h (+6/-6) src/graphic/render/gameview_opengl.cc (+101/-0) src/graphic/render/gameview_opengl.h (+54/-0) src/graphic/render/gameview_sdl.cc (+105/-0) src/graphic/render/gameview_sdl.h (+50/-0) src/graphic/render/terrain_opengl.h (+130/-19) src/graphic/texture.cc (+31/-6) src/graphic/texture.h (+2/-2) src/ui_fsmenu/options.cc (+3/-3) src/wlapplication.cc (+7/-4) src/wui/mapview.cc (+10/-3) worlds/greenland/terrainconf (+0/-1) |
||||||||||||||||||||
To merge this branch: | bzr merge lp:~shevonar/widelands/opengl | ||||||||||||||||||||
Related bugs: |
|
||||||||||||||||||||
Related blueprints: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Widelands Developers | Pending | ||
Review via email: mp+93852@code.launchpad.net |
Commit message
Description of the change
This branch improves the OpenGL rendering:
- gameview is split into two subclasses: gameviewSDL and gameviewOpenGL
- terrain edges are dithered and rounded in OpenGL mode (via a texture mask)
- minimap is shaded correctly
- road textures should be fixed (resized to 64x64px)
- Made OpenGL the standard renderer and remove * highly experimental * from options menu
- fixed bug 649037
To post a comment you must log in.
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'ChangeLog' | |||
2 | --- ChangeLog 2012-02-07 14:43:41 +0000 | |||
3 | +++ ChangeLog 2012-02-20 16:00:42 +0000 | |||
4 | @@ -12,6 +12,7 @@ | |||
5 | 12 | - Improved a lot of icons and button appearence. | 12 | - Improved a lot of icons and button appearence. |
6 | 13 | - Improved statistics window. | 13 | - Improved statistics window. |
7 | 14 | - Improved the Widelands code to use less resources. | 14 | - Improved the Widelands code to use less resources. |
8 | 15 | - Improved OpenGL rendering which is now active by default. | ||
9 | 15 | - Added a new piece of music to Widelands | 16 | - Added a new piece of music to Widelands |
10 | 16 | - Added new states and animations for unoccupied buildings and empty mines, | 17 | - Added new states and animations for unoccupied buildings and empty mines, |
11 | 17 | to better indicate the current state of a building. | 18 | to better indicate the current state of a building. |
12 | @@ -35,14 +36,16 @@ | |||
13 | 35 | - Fixed a bug that disallowed to connect to different servers (via | 36 | - Fixed a bug that disallowed to connect to different servers (via |
14 | 36 | metaserver) without prior restart of Widelands. | 37 | metaserver) without prior restart of Widelands. |
15 | 37 | - (Re)Fixed bug #536149: miner/master miner mixed up after enhancing | 38 | - (Re)Fixed bug #536149: miner/master miner mixed up after enhancing |
17 | 38 | to deep mine. | 39 | to deep mine. |
18 | 39 | - Fixed bug #565406: focus for save window | 40 | - Fixed bug #565406: focus for save window |
19 | 40 | - Fixed bug #570055: Open house window on doubleclick even when minimized | 41 | - Fixed bug #570055: Open house window on doubleclick even when minimized |
20 | 41 | - Fixed bug #590528: add more details to a replay | 42 | - Fixed bug #590528: add more details to a replay |
21 | 42 | - Fixed bug #590631: All workers die, when warehouse/hq is destroyed | 43 | - Fixed bug #590631: All workers die, when warehouse/hq is destroyed |
22 | 44 | - Fixed bug #594686: Roads not rendered correctly in opengl mode on some systems | ||
23 | 43 | - Fixed bug #601400: Request::get_base_required_time:WARNING nr = 1 but | 45 | - Fixed bug #601400: Request::get_base_required_time:WARNING nr = 1 but |
24 | 44 | count is 1, which is not allowed according to the | 46 | count is 1, which is not allowed according to the |
25 | 45 | comment for this function | 47 | comment for this function |
26 | 48 | - Fixed bug #649037: Many menus are not repainted in OpenGL mode | ||
27 | 46 | - Fixed bug #657266: Unoccupied helmsmithy animation contains a person | 49 | - Fixed bug #657266: Unoccupied helmsmithy animation contains a person |
28 | 47 | - Fixed bug #672085: New stock menu layout too high for small resolutions | 50 | - Fixed bug #672085: New stock menu layout too high for small resolutions |
29 | 48 | - Fixed bug #672098: The priority buttons can be deactivated | 51 | - Fixed bug #672098: The priority buttons can be deactivated |
30 | @@ -50,7 +53,9 @@ | |||
31 | 50 | - Fixed bug #691928: Message icon is not updated in some cases when | 53 | - Fixed bug #691928: Message icon is not updated in some cases when |
32 | 51 | receiving focus | 54 | receiving focus |
33 | 52 | - Fixed bug #695035: Adjusted hotspots of buildings to fit into their space | 55 | - Fixed bug #695035: Adjusted hotspots of buildings to fit into their space |
34 | 56 | - Fixed bug #722196: OpenGL terrain renderer does not dither between adjacent fields | ||
35 | 53 | - Fixed bug #722793: Ducks on land on Three Warriors | 57 | - Fixed bug #722793: Ducks on land on Three Warriors |
36 | 58 | - Fixed bug #722796: Minimap not shaded by terrain height in OpenGL | ||
37 | 54 | - Fixed bug #723112: The name is not shown for resource coal in the | 59 | - Fixed bug #723112: The name is not shown for resource coal in the |
38 | 55 | resource dialog in the editor | 60 | resource dialog in the editor |
39 | 56 | - Fixed bug #726699: Make the wares priority buttons in production sites | 61 | - Fixed bug #726699: Make the wares priority buttons in production sites |
40 | @@ -99,6 +104,7 @@ | |||
41 | 99 | - Fixed bug #886493: Default AI is set to none | 104 | - Fixed bug #886493: Default AI is set to none |
42 | 100 | - Fixed bug #886572: After a while, increasing game speed makes the game | 105 | - Fixed bug #886572: After a while, increasing game speed makes the game |
43 | 101 | lag even at lower speeds | 106 | lag even at lower speeds |
44 | 107 | - Fixed bug #887093: Make OpenGL the standard renderer | ||
45 | 102 | - Fixed bug #902765: Show buttons in the bottom toolbar in the same | 108 | - Fixed bug #902765: Show buttons in the bottom toolbar in the same |
46 | 103 | order, also for spectators | 109 | order, also for spectators |
47 | 104 | - Fixed bug #902823: Show "increase/decrease capacity" buttons only | 110 | - Fixed bug #902823: Show "increase/decrease capacity" buttons only |
48 | 105 | 111 | ||
49 | === modified file 'src/graphic/graphic.cc' | |||
50 | --- src/graphic/graphic.cc 2012-02-19 17:10:12 +0000 | |||
51 | +++ src/graphic/graphic.cc 2012-02-20 16:00:42 +0000 | |||
52 | @@ -1,5 +1,5 @@ | |||
53 | 1 | /* | 1 | /* |
55 | 2 | * Copyright (C) 2002-2004, 2006-2011 by the Widelands Development Team | 2 | * Copyright (C) 2002-2004, 2006-2012 by the Widelands Development Team |
56 | 3 | * | 3 | * |
57 | 4 | * This program is free software; you can redistribute it and/or | 4 | * This program is free software; you can redistribute it and/or |
58 | 5 | * modify it under the terms of the GNU General Public License | 5 | * modify it under the terms of the GNU General Public License |
59 | @@ -1034,8 +1034,9 @@ | |||
60 | 1034 | */ | 1034 | */ |
61 | 1035 | void Graphic::animate_maptextures(uint32_t time) | 1035 | void Graphic::animate_maptextures(uint32_t time) |
62 | 1036 | { | 1036 | { |
64 | 1037 | for (uint32_t i = 0; i < m_maptextures.size(); ++i) | 1037 | for (uint32_t i = 0; i < m_maptextures.size(); ++i) { |
65 | 1038 | m_maptextures[i]->animate(time); | 1038 | m_maptextures[i]->animate(time); |
66 | 1039 | } | ||
67 | 1039 | } | 1040 | } |
68 | 1040 | 1041 | ||
69 | 1041 | /** | 1042 | /** |
70 | @@ -1043,8 +1044,9 @@ | |||
71 | 1043 | */ | 1044 | */ |
72 | 1044 | void Graphic::reset_texture_animation_reminder() | 1045 | void Graphic::reset_texture_animation_reminder() |
73 | 1045 | { | 1046 | { |
75 | 1046 | for (uint32_t i = 0; i < m_maptextures.size(); ++i) | 1047 | for (uint32_t i = 0; i < m_maptextures.size(); ++i) { |
76 | 1047 | m_maptextures[i]->reset_was_animated(); | 1048 | m_maptextures[i]->reset_was_animated(); |
77 | 1049 | } | ||
78 | 1048 | } | 1050 | } |
79 | 1049 | 1051 | ||
80 | 1050 | /** | 1052 | /** |
81 | @@ -1164,8 +1166,9 @@ | |||
82 | 1164 | return 0; | 1166 | return 0; |
83 | 1165 | } | 1167 | } |
84 | 1166 | 1168 | ||
85 | 1169 | |||
86 | 1167 | /** | 1170 | /** |
88 | 1168 | * Sets the name of the current world and loads the fitting road textures | 1171 | * Sets the name of the current world and loads the fitting road and edge textures |
89 | 1169 | */ | 1172 | */ |
90 | 1170 | void Graphic::set_world(std::string worldname) { | 1173 | void Graphic::set_world(std::string worldname) { |
91 | 1171 | char buf[255]; | 1174 | char buf[255]; |
92 | @@ -1179,6 +1182,10 @@ | |||
93 | 1179 | m_roadtextures->pic_road_normal = get_picture(PicMod_Game, buf, false); | 1182 | m_roadtextures->pic_road_normal = get_picture(PicMod_Game, buf, false); |
94 | 1180 | snprintf(buf, sizeof(buf), "worlds/%s/pics/roadt_busy.png", worldname.c_str()); | 1183 | snprintf(buf, sizeof(buf), "worlds/%s/pics/roadt_busy.png", worldname.c_str()); |
95 | 1181 | m_roadtextures->pic_road_busy = get_picture(PicMod_Game, buf, false); | 1184 | m_roadtextures->pic_road_busy = get_picture(PicMod_Game, buf, false); |
96 | 1185 | |||
97 | 1186 | // load edge texture | ||
98 | 1187 | snprintf(buf, sizeof(buf), "worlds/%s/pics/edge.png", worldname.c_str()); | ||
99 | 1188 | m_edgetexture = get_picture(PicMod_Game, buf, false); | ||
100 | 1182 | } | 1189 | } |
101 | 1183 | 1190 | ||
102 | 1184 | /** | 1191 | /** |
103 | @@ -1191,3 +1198,12 @@ | |||
104 | 1191 | return | 1198 | return |
105 | 1192 | (roadtex == Widelands::Road_Normal ? m_roadtextures->pic_road_normal : m_roadtextures->pic_road_busy); | 1199 | (roadtex == Widelands::Road_Normal ? m_roadtextures->pic_road_normal : m_roadtextures->pic_road_busy); |
106 | 1193 | } | 1200 | } |
107 | 1201 | |||
108 | 1202 | /** | ||
109 | 1203 | * Returns the alpha mask texture for edges. | ||
110 | 1204 | * \return The edge texture (alpha mask) | ||
111 | 1205 | */ | ||
112 | 1206 | PictureID Graphic::get_edge_texture() | ||
113 | 1207 | { | ||
114 | 1208 | return m_edgetexture; | ||
115 | 1209 | } | ||
116 | 1194 | 1210 | ||
117 | === modified file 'src/graphic/graphic.h' | |||
118 | --- src/graphic/graphic.h 2011-11-30 21:38:37 +0000 | |||
119 | +++ src/graphic/graphic.h 2012-02-20 16:00:42 +0000 | |||
120 | @@ -1,5 +1,5 @@ | |||
121 | 1 | /* | 1 | /* |
123 | 2 | * Copyright (C) 2002-2004, 2006-2011 by the Widelands Development Team | 2 | * Copyright (C) 2002-2004, 2006-2012 by the Widelands Development Team |
124 | 3 | * | 3 | * |
125 | 4 | * This program is free software; you can redistribute it and/or | 4 | * This program is free software; you can redistribute it and/or |
126 | 5 | * modify it under the terms of the GNU General Public License | 5 | * modify it under the terms of the GNU General Public License |
127 | @@ -189,6 +189,7 @@ | |||
128 | 189 | 189 | ||
129 | 190 | void set_world(std::string); | 190 | void set_world(std::string); |
130 | 191 | PictureID get_road_texture(int32_t roadtex); | 191 | PictureID get_road_texture(int32_t roadtex); |
131 | 192 | PictureID get_edge_texture(); | ||
132 | 192 | 193 | ||
133 | 193 | GraphicCaps const & caps() const throw () {return m_caps;} | 194 | GraphicCaps const & caps() const throw () {return m_caps;} |
134 | 194 | 195 | ||
135 | @@ -236,6 +237,7 @@ | |||
136 | 236 | Picturemap m_picturemap; | 237 | Picturemap m_picturemap; |
137 | 237 | 238 | ||
138 | 238 | Road_Textures * m_roadtextures; | 239 | Road_Textures * m_roadtextures; |
139 | 240 | PictureID m_edgetexture; | ||
140 | 239 | std::vector<Texture *> m_maptextures; | 241 | std::vector<Texture *> m_maptextures; |
141 | 240 | std::vector<AnimationGfx *> m_animations; | 242 | std::vector<AnimationGfx *> m_animations; |
142 | 241 | }; | 243 | }; |
143 | 242 | 244 | ||
144 | === modified file 'src/graphic/render/gameview.cc' | |||
145 | --- src/graphic/render/gameview.cc 2012-02-12 17:17:26 +0000 | |||
146 | +++ src/graphic/render/gameview.cc 2012-02-20 16:00:42 +0000 | |||
147 | @@ -1,5 +1,5 @@ | |||
148 | 1 | /* | 1 | /* |
150 | 2 | * Copyright (C) 2010-2011 by the Widelands Development Team | 2 | * Copyright (C) 2010-2012 by the Widelands Development Team |
151 | 3 | * | 3 | * |
152 | 4 | * This program is free software; you can redistribute it and/or | 4 | * This program is free software; you can redistribute it and/or |
153 | 5 | * modify it under the terms of the GNU General Public License | 5 | * modify it under the terms of the GNU General Public License |
154 | @@ -39,7 +39,6 @@ | |||
155 | 39 | #include "wui/overlay_manager.h" | 39 | #include "wui/overlay_manager.h" |
156 | 40 | 40 | ||
157 | 41 | #include "terrain_sdl.h" | 41 | #include "terrain_sdl.h" |
158 | 42 | #include "terrain_opengl.h" | ||
159 | 43 | 42 | ||
160 | 44 | using Widelands::BaseImmovable; | 43 | using Widelands::BaseImmovable; |
161 | 45 | using Widelands::Coords; | 44 | using Widelands::Coords; |
162 | @@ -214,8 +213,10 @@ | |||
163 | 214 | f_vert.tx += TRIANGLE_WIDTH / 2; | 213 | f_vert.tx += TRIANGLE_WIDTH / 2; |
164 | 215 | r_vert.tx += TRIANGLE_WIDTH / 2; | 214 | r_vert.tx += TRIANGLE_WIDTH / 2; |
165 | 216 | } else { | 215 | } else { |
168 | 217 | bl_vert.tx -= TRIANGLE_WIDTH / 2; | 216 | f_vert.tx += TRIANGLE_WIDTH; |
169 | 218 | br_vert.tx -= TRIANGLE_WIDTH / 2; | 217 | r_vert.tx += TRIANGLE_WIDTH; |
170 | 218 | bl_vert.tx += TRIANGLE_WIDTH / 2; | ||
171 | 219 | br_vert.tx += TRIANGLE_WIDTH / 2; | ||
172 | 219 | } | 220 | } |
173 | 220 | 221 | ||
174 | 221 | draw_field // Render ground | 222 | draw_field // Render ground |
175 | @@ -986,16 +987,16 @@ | |||
176 | 986 | * into the bitmap. | 987 | * into the bitmap. |
177 | 987 | * | 988 | * |
178 | 988 | * Vertices: | 989 | * Vertices: |
183 | 989 | * - f_vert vertice of the field | 990 | * - f_vert vertex of the field |
184 | 990 | * - r_vert vertice right of the field | 991 | * - r_vert vertex right of the field |
185 | 991 | * - bl_vert vertice bottom left of the field | 992 | * - bl_vert vertex bottom left of the field |
186 | 992 | * - br_vert vertice bottom right of the field | 993 | * - br_vert vertex bottom right of the field |
187 | 993 | * | 994 | * |
188 | 994 | * Textures: | 995 | * Textures: |
189 | 995 | * - f_r_texture Terrain of the triangle right of the field | 996 | * - f_r_texture Terrain of the triangle right of the field |
190 | 996 | * - f_d_texture Terrain of the triangle under of the field | 997 | * - f_d_texture Terrain of the triangle under of the field |
193 | 997 | * - tr_d_texture Terrain of the triangle to of the right triangle ?? | 998 | * - tr_d_texture Terrain of the triangle top of the right triangle ?? |
194 | 998 | * - l_r_texture Terrain of the triangle left if the down triangle ?? | 999 | * - l_r_texture Terrain of the triangle left of the down triangle ?? |
195 | 999 | * | 1000 | * |
196 | 1000 | * (tr_d) | 1001 | * (tr_d) |
197 | 1001 | * | 1002 | * |
198 | @@ -1018,43 +1019,7 @@ | |||
199 | 1018 | Texture const & f_d_texture, | 1019 | Texture const & f_d_texture, |
200 | 1019 | Texture const & f_r_texture) | 1020 | Texture const & f_r_texture) |
201 | 1020 | { | 1021 | { |
239 | 1021 | upcast(SurfaceSDL, sdlsurf, m_surface.get()); | 1022 | |
203 | 1022 | if (sdlsurf) | ||
204 | 1023 | { | ||
205 | 1024 | sdlsurf->set_subwin(subwin); | ||
206 | 1025 | switch (sdlsurf->format().BytesPerPixel) { | ||
207 | 1026 | case 2: | ||
208 | 1027 | draw_field_int<Uint16> | ||
209 | 1028 | (*sdlsurf, | ||
210 | 1029 | f_vert, r_vert, bl_vert, br_vert, | ||
211 | 1030 | roads, | ||
212 | 1031 | tr_d_texture, l_r_texture, f_d_texture, f_r_texture); | ||
213 | 1032 | break; | ||
214 | 1033 | case 4: | ||
215 | 1034 | draw_field_int<Uint32> | ||
216 | 1035 | (*sdlsurf, | ||
217 | 1036 | f_vert, r_vert, bl_vert, br_vert, | ||
218 | 1037 | roads, | ||
219 | 1038 | tr_d_texture, l_r_texture, f_d_texture, f_r_texture); | ||
220 | 1039 | break; | ||
221 | 1040 | default: | ||
222 | 1041 | assert(false); | ||
223 | 1042 | } | ||
224 | 1043 | sdlsurf->unset_subwin(); | ||
225 | 1044 | } | ||
226 | 1045 | #ifdef USE_OPENGL | ||
227 | 1046 | else | ||
228 | 1047 | { | ||
229 | 1048 | // Draw triangle right (bottom) of the field | ||
230 | 1049 | draw_field_opengl | ||
231 | 1050 | (subwin, f_vert, br_vert, r_vert, f_r_texture); | ||
232 | 1051 | // Draw triangle bottom of the field | ||
233 | 1052 | draw_field_opengl | ||
234 | 1053 | (subwin, f_vert, bl_vert, br_vert, f_d_texture); | ||
235 | 1054 | // Draw the roads | ||
236 | 1055 | draw_roads_opengl(subwin, roads, f_vert, r_vert, bl_vert, br_vert); | ||
237 | 1056 | } | ||
238 | 1057 | #endif | ||
240 | 1058 | } | 1023 | } |
241 | 1059 | 1024 | ||
242 | 1060 | /* | 1025 | /* |
243 | @@ -1376,35 +1341,3 @@ | |||
244 | 1376 | 1341 | ||
245 | 1377 | m_surface->blit(Point(rc.x, rc.y), picture, rc2); | 1342 | m_surface->blit(Point(rc.x, rc.y), picture, rc2); |
246 | 1378 | } | 1343 | } |
247 | 1379 | |||
248 | 1380 | void GameView::rendermap_init() | ||
249 | 1381 | { | ||
250 | 1382 | #ifdef USE_OPENGL | ||
251 | 1383 | if (g_opengl) { | ||
252 | 1384 | glMatrixMode(GL_TEXTURE); | ||
253 | 1385 | glLoadIdentity(); | ||
254 | 1386 | glScalef | ||
255 | 1387 | (1.0f / static_cast<GLfloat>(TEXTURE_WIDTH), | ||
256 | 1388 | 1.0f / static_cast<GLfloat>(TEXTURE_HEIGHT), 1); | ||
257 | 1389 | glDisable(GL_BLEND); | ||
258 | 1390 | |||
259 | 1391 | // Use scissor test to clip the window. This takes coordinates in screen | ||
260 | 1392 | // coordinates (y goes from bottom to top) | ||
261 | 1393 | glScissor | ||
262 | 1394 | (m_rect.x, g_gr->get_yres() - m_rect.y - m_rect.h, | ||
263 | 1395 | m_rect.w, m_rect.h); | ||
264 | 1396 | glEnable(GL_SCISSOR_TEST); | ||
265 | 1397 | } | ||
266 | 1398 | #endif | ||
267 | 1399 | } | ||
268 | 1400 | |||
269 | 1401 | void GameView::rendermap_deint() | ||
270 | 1402 | { | ||
271 | 1403 | #ifdef USE_OPENGL | ||
272 | 1404 | if (g_opengl) { | ||
273 | 1405 | glDisable(GL_SCISSOR_TEST); | ||
274 | 1406 | glMatrixMode(GL_TEXTURE); | ||
275 | 1407 | glLoadIdentity(); | ||
276 | 1408 | } | ||
277 | 1409 | #endif | ||
278 | 1410 | } | ||
279 | 1411 | 1344 | ||
280 | === modified file 'src/graphic/render/gameview.h' | |||
281 | --- src/graphic/render/gameview.h 2012-01-09 21:10:43 +0000 | |||
282 | +++ src/graphic/render/gameview.h 2012-02-20 16:00:42 +0000 | |||
283 | @@ -1,5 +1,5 @@ | |||
284 | 1 | /* | 1 | /* |
286 | 2 | * Copyright (C) 2010-2011 by the Widelands Development Team | 2 | * Copyright (C) 2010-2012 by the Widelands Development Team |
287 | 3 | * | 3 | * |
288 | 4 | * This program is free software; you can redistribute it and/or | 4 | * This program is free software; you can redistribute it and/or |
289 | 5 | * modify it under the terms of the GNU General Public License | 5 | * modify it under the terms of the GNU General Public License |
290 | @@ -46,7 +46,7 @@ | |||
291 | 46 | public: | 46 | public: |
292 | 47 | GameView(RenderTarget & rt): | 47 | GameView(RenderTarget & rt): |
293 | 48 | RenderTarget(rt) {} | 48 | RenderTarget(rt) {} |
295 | 49 | ~GameView() {} | 49 | virtual ~GameView() {} |
296 | 50 | 50 | ||
297 | 51 | /** | 51 | /** |
298 | 52 | * Renders the map from a player's point of view into the current drawing | 52 | * Renders the map from a player's point of view into the current drawing |
299 | @@ -80,12 +80,12 @@ | |||
300 | 80 | Point viewpoint, | 80 | Point viewpoint, |
301 | 81 | uint32_t flags); | 81 | uint32_t flags); |
302 | 82 | 82 | ||
304 | 83 | private: | 83 | protected: |
305 | 84 | /** | 84 | /** |
306 | 85 | * Helper function to draw two terrain triangles. This is called from the | 85 | * Helper function to draw two terrain triangles. This is called from the |
307 | 86 | * rendermap() functions. | 86 | * rendermap() functions. |
308 | 87 | */ | 87 | */ |
310 | 88 | void draw_field | 88 | virtual void draw_field |
311 | 89 | (Rect & subwin, | 89 | (Rect & subwin, |
312 | 90 | Vertex const & f_vert, | 90 | Vertex const & f_vert, |
313 | 91 | Vertex const & r_vert, | 91 | Vertex const & r_vert, |
314 | @@ -109,12 +109,12 @@ | |||
315 | 109 | /** | 109 | /** |
316 | 110 | * This is called before the view of the game is rendered. | 110 | * This is called before the view of the game is rendered. |
317 | 111 | */ | 111 | */ |
319 | 112 | void rendermap_init(); | 112 | virtual void rendermap_init() {} |
320 | 113 | 113 | ||
321 | 114 | /** | 114 | /** |
322 | 115 | * This is called after the view of the game is rendered. | 115 | * This is called after the view of the game is rendered. |
323 | 116 | */ | 116 | */ |
325 | 117 | void rendermap_deint(); | 117 | virtual void rendermap_deint() {} |
326 | 118 | }; | 118 | }; |
327 | 119 | 119 | ||
328 | 120 | #endif //WIDELANDS_GAMEVIEW_H | 120 | #endif //WIDELANDS_GAMEVIEW_H |
329 | 121 | 121 | ||
330 | === added file 'src/graphic/render/gameview_opengl.cc' | |||
331 | --- src/graphic/render/gameview_opengl.cc 1970-01-01 00:00:00 +0000 | |||
332 | +++ src/graphic/render/gameview_opengl.cc 2012-02-20 16:00:42 +0000 | |||
333 | @@ -0,0 +1,101 @@ | |||
334 | 1 | /* | ||
335 | 2 | * Copyright (C) 2011-2012 by the Widelands Development Team | ||
336 | 3 | * | ||
337 | 4 | * This program is free software; you can redistribute it and/or | ||
338 | 5 | * modify it under the terms of the GNU General Public License | ||
339 | 6 | * as published by the Free Software Foundation; either version 2 | ||
340 | 7 | * of the License, or (at your option) any later version. | ||
341 | 8 | * | ||
342 | 9 | * This program is distributed in the hope that it will be useful, | ||
343 | 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
344 | 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
345 | 12 | * GNU General Public License for more details. | ||
346 | 13 | * | ||
347 | 14 | * You should have received a copy of the GNU General Public License | ||
348 | 15 | * along with this program; if not, write to the Free Software | ||
349 | 16 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
350 | 17 | * | ||
351 | 18 | */ | ||
352 | 19 | |||
353 | 20 | |||
354 | 21 | #include "gameview_opengl.h" | ||
355 | 22 | |||
356 | 23 | #include "constants.h" | ||
357 | 24 | #include "economy/road.h" | ||
358 | 25 | #include "graphic/graphic.h" | ||
359 | 26 | #include "graphic/texture.h" | ||
360 | 27 | |||
361 | 28 | #include "terrain_opengl.h" | ||
362 | 29 | |||
363 | 30 | using namespace Widelands; | ||
364 | 31 | |||
365 | 32 | /** | ||
366 | 33 | * Draw ground textures and roads for the given parallelogram (two triangles) | ||
367 | 34 | * into the bitmap. | ||
368 | 35 | * | ||
369 | 36 | * Vertices: | ||
370 | 37 | * - f_vert vertex of the field | ||
371 | 38 | * - r_vert vertex right of the field | ||
372 | 39 | * - bl_vert vertex bottom left of the field | ||
373 | 40 | * - br_vert vertex bottom right of the field | ||
374 | 41 | * | ||
375 | 42 | * Textures: | ||
376 | 43 | * - f_r_texture Terrain of the triangle right of the field | ||
377 | 44 | * - f_d_texture Terrain of the triangle under of the field | ||
378 | 45 | * - tr_d_texture Terrain of the triangle top of the right triangle ?? | ||
379 | 46 | * - l_r_texture Terrain of the triangle left of the down triangle ?? | ||
380 | 47 | * | ||
381 | 48 | * (tr_d) | ||
382 | 49 | * | ||
383 | 50 | * (f) *------* (r) | ||
384 | 51 | * / \ r / | ||
385 | 52 | * (l_r) / \ / | ||
386 | 53 | * / d \/ | ||
387 | 54 | * (bl) *------* (br) | ||
388 | 55 | */ | ||
389 | 56 | void GameViewOpenGL::draw_field | ||
390 | 57 | (Rect & subwin, | ||
391 | 58 | Vertex const & f_vert, | ||
392 | 59 | Vertex const & r_vert, | ||
393 | 60 | Vertex const & bl_vert, | ||
394 | 61 | Vertex const & br_vert, | ||
395 | 62 | uint8_t roads, | ||
396 | 63 | Texture const & tr_d_texture, | ||
397 | 64 | Texture const & l_r_texture, | ||
398 | 65 | Texture const & f_d_texture, | ||
399 | 66 | Texture const & f_r_texture) | ||
400 | 67 | { | ||
401 | 68 | // Draw triangle right (bottom) of the field | ||
402 | 69 | draw_field_opengl | ||
403 | 70 | (subwin, f_vert, br_vert, r_vert, f_r_texture, f_d_texture, tr_d_texture); | ||
404 | 71 | // Draw triangle bottom of the field | ||
405 | 72 | draw_field_opengl | ||
406 | 73 | (subwin, f_vert, bl_vert, br_vert, f_d_texture, l_r_texture, f_d_texture); | ||
407 | 74 | |||
408 | 75 | // Draw the roads | ||
409 | 76 | draw_roads_opengl(subwin, roads, f_vert, r_vert, bl_vert, br_vert); | ||
410 | 77 | } | ||
411 | 78 | |||
412 | 79 | void GameViewOpenGL::rendermap_init() | ||
413 | 80 | { | ||
414 | 81 | glMatrixMode(GL_TEXTURE); | ||
415 | 82 | glLoadIdentity(); | ||
416 | 83 | glScalef | ||
417 | 84 | (1.0f / static_cast<GLfloat>(TEXTURE_WIDTH), | ||
418 | 85 | 1.0f / static_cast<GLfloat>(TEXTURE_HEIGHT), 1); | ||
419 | 86 | glDisable(GL_BLEND); | ||
420 | 87 | |||
421 | 88 | // Use scissor test to clip the window. This takes coordinates in screen | ||
422 | 89 | // coordinates (y goes from bottom to top) | ||
423 | 90 | glScissor | ||
424 | 91 | (m_rect.x, g_gr->get_yres() - m_rect.y - m_rect.h, | ||
425 | 92 | m_rect.w, m_rect.h); | ||
426 | 93 | glEnable(GL_SCISSOR_TEST); | ||
427 | 94 | } | ||
428 | 95 | |||
429 | 96 | void GameViewOpenGL::rendermap_deint() | ||
430 | 97 | { | ||
431 | 98 | glDisable(GL_SCISSOR_TEST); | ||
432 | 99 | glMatrixMode(GL_TEXTURE); | ||
433 | 100 | glLoadIdentity(); | ||
434 | 101 | } | ||
435 | 0 | 102 | ||
436 | === added file 'src/graphic/render/gameview_opengl.h' | |||
437 | --- src/graphic/render/gameview_opengl.h 1970-01-01 00:00:00 +0000 | |||
438 | +++ src/graphic/render/gameview_opengl.h 2012-02-20 16:00:42 +0000 | |||
439 | @@ -0,0 +1,54 @@ | |||
440 | 1 | /* | ||
441 | 2 | * Copyright (C) 2011 by the Widelands Development Team | ||
442 | 3 | * | ||
443 | 4 | * This program is free software; you can redistribute it and/or | ||
444 | 5 | * modify it under the terms of the GNU General Public License | ||
445 | 6 | * as published by the Free Software Foundation; either version 2 | ||
446 | 7 | * of the License, or (at your option) any later version. | ||
447 | 8 | * | ||
448 | 9 | * This program is distributed in the hope that it will be useful, | ||
449 | 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
450 | 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
451 | 12 | * GNU General Public License for more details. | ||
452 | 13 | * | ||
453 | 14 | * You should have received a copy of the GNU General Public License | ||
454 | 15 | * along with this program; if not, write to the Free Software | ||
455 | 16 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
456 | 17 | * | ||
457 | 18 | */ | ||
458 | 19 | |||
459 | 20 | #ifndef GAMEVIEW_OPENGL_H_ | ||
460 | 21 | #define GAMEVIEW_OPENGL_H_ | ||
461 | 22 | |||
462 | 23 | #include "gameview.h" | ||
463 | 24 | |||
464 | 25 | class GameViewOpenGL : public GameView | ||
465 | 26 | { | ||
466 | 27 | public: | ||
467 | 28 | GameViewOpenGL(RenderTarget & rt): | ||
468 | 29 | GameView(rt) {} | ||
469 | 30 | ~GameViewOpenGL() {} | ||
470 | 31 | |||
471 | 32 | protected: | ||
472 | 33 | /** | ||
473 | 34 | * Helper function to draw two terrain triangles. This is called from the | ||
474 | 35 | * rendermap() functions. | ||
475 | 36 | */ | ||
476 | 37 | void draw_field | ||
477 | 38 | (Rect & subwin, | ||
478 | 39 | Vertex const & f_vert, | ||
479 | 40 | Vertex const & r_vert, | ||
480 | 41 | Vertex const & bl_vert, | ||
481 | 42 | Vertex const & br_vert, | ||
482 | 43 | uint8_t roads, | ||
483 | 44 | Texture const & tr_d_texture, | ||
484 | 45 | Texture const & l_r_texture, | ||
485 | 46 | Texture const & f_d_texture, | ||
486 | 47 | Texture const & f_r_texture); | ||
487 | 48 | |||
488 | 49 | void rendermap_init(); | ||
489 | 50 | void rendermap_deint(); | ||
490 | 51 | }; | ||
491 | 52 | |||
492 | 53 | |||
493 | 54 | #endif /* GAMEVIEW_OPENGL_H_ */ | ||
494 | 0 | 55 | ||
495 | === added file 'src/graphic/render/gameview_sdl.cc' | |||
496 | --- src/graphic/render/gameview_sdl.cc 1970-01-01 00:00:00 +0000 | |||
497 | +++ src/graphic/render/gameview_sdl.cc 2012-02-20 16:00:42 +0000 | |||
498 | @@ -0,0 +1,105 @@ | |||
499 | 1 | /* | ||
500 | 2 | * Copyright (C) 2011-2012 by the Widelands Development Team | ||
501 | 3 | * | ||
502 | 4 | * This program is free software; you can redistribute it and/or | ||
503 | 5 | * modify it under the terms of the GNU General Public License | ||
504 | 6 | * as published by the Free Software Foundation; either version 2 | ||
505 | 7 | * of the License, or (at your option) any later version. | ||
506 | 8 | * | ||
507 | 9 | * This program is distributed in the hope that it will be useful, | ||
508 | 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
509 | 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
510 | 12 | * GNU General Public License for more details. | ||
511 | 13 | * | ||
512 | 14 | * You should have received a copy of the GNU General Public License | ||
513 | 15 | * along with this program; if not, write to the Free Software | ||
514 | 16 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
515 | 17 | * | ||
516 | 18 | */ | ||
517 | 19 | |||
518 | 20 | #include "gameview_sdl.h" | ||
519 | 21 | |||
520 | 22 | #include "upcast.h" | ||
521 | 23 | |||
522 | 24 | #include "economy/road.h" | ||
523 | 25 | #include "economy/flag.h" | ||
524 | 26 | |||
525 | 27 | #include "wui/minimap.h" | ||
526 | 28 | #include "wui/mapviewpixelconstants.h" | ||
527 | 29 | |||
528 | 30 | #include "logic/field.h" | ||
529 | 31 | #include "logic/map.h" | ||
530 | 32 | #include "logic/player.h" | ||
531 | 33 | |||
532 | 34 | #include "graphic/graphic.h" | ||
533 | 35 | #include "graphic/rendertarget.h" | ||
534 | 36 | #include "graphic/surface.h" | ||
535 | 37 | #include "surface_sdl.h" | ||
536 | 38 | #include "graphic/texture.h" | ||
537 | 39 | |||
538 | 40 | #include "wui/overlay_manager.h" | ||
539 | 41 | |||
540 | 42 | #include "terrain_sdl.h" | ||
541 | 43 | |||
542 | 44 | |||
543 | 45 | /** | ||
544 | 46 | * Draw ground textures and roads for the given parallelogram (two triangles) | ||
545 | 47 | * into the bitmap. | ||
546 | 48 | * | ||
547 | 49 | * Vertices: | ||
548 | 50 | * - f_vert vertex of the field | ||
549 | 51 | * - r_vert vertex right of the field | ||
550 | 52 | * - bl_vert vertex bottom left of the field | ||
551 | 53 | * - br_vert vertex bottom right of the field | ||
552 | 54 | * | ||
553 | 55 | * Textures: | ||
554 | 56 | * - f_r_texture Terrain of the triangle right of the field | ||
555 | 57 | * - f_d_texture Terrain of the triangle under of the field | ||
556 | 58 | * - tr_d_texture Terrain of the triangle top of the right triangle ?? | ||
557 | 59 | * - l_r_texture Terrain of the triangle left of the down triangle ?? | ||
558 | 60 | * | ||
559 | 61 | * (tr_d) | ||
560 | 62 | * | ||
561 | 63 | * (f) *------* (r) | ||
562 | 64 | * / \ r / | ||
563 | 65 | * (l_r) / \ / | ||
564 | 66 | * / d \/ | ||
565 | 67 | * (bl) *------* (br) | ||
566 | 68 | */ | ||
567 | 69 | void GameViewSDL::draw_field | ||
568 | 70 | (Rect & subwin, | ||
569 | 71 | Vertex const & f_vert, | ||
570 | 72 | Vertex const & r_vert, | ||
571 | 73 | Vertex const & bl_vert, | ||
572 | 74 | Vertex const & br_vert, | ||
573 | 75 | uint8_t roads, | ||
574 | 76 | Texture const & tr_d_texture, | ||
575 | 77 | Texture const & l_r_texture, | ||
576 | 78 | Texture const & f_d_texture, | ||
577 | 79 | Texture const & f_r_texture) | ||
578 | 80 | { | ||
579 | 81 | upcast(SurfaceSDL, sdlsurf, m_surface.get()); | ||
580 | 82 | if (sdlsurf) | ||
581 | 83 | { | ||
582 | 84 | sdlsurf->set_subwin(subwin); | ||
583 | 85 | switch (sdlsurf->format().BytesPerPixel) { | ||
584 | 86 | case 2: | ||
585 | 87 | draw_field_int<Uint16> | ||
586 | 88 | (*sdlsurf, | ||
587 | 89 | f_vert, r_vert, bl_vert, br_vert, | ||
588 | 90 | roads, | ||
589 | 91 | tr_d_texture, l_r_texture, f_d_texture, f_r_texture); | ||
590 | 92 | break; | ||
591 | 93 | case 4: | ||
592 | 94 | draw_field_int<Uint32> | ||
593 | 95 | (*sdlsurf, | ||
594 | 96 | f_vert, r_vert, bl_vert, br_vert, | ||
595 | 97 | roads, | ||
596 | 98 | tr_d_texture, l_r_texture, f_d_texture, f_r_texture); | ||
597 | 99 | break; | ||
598 | 100 | default: | ||
599 | 101 | assert(false); | ||
600 | 102 | } | ||
601 | 103 | sdlsurf->unset_subwin(); | ||
602 | 104 | } | ||
603 | 105 | } | ||
604 | 0 | 106 | ||
605 | === added file 'src/graphic/render/gameview_sdl.h' | |||
606 | --- src/graphic/render/gameview_sdl.h 1970-01-01 00:00:00 +0000 | |||
607 | +++ src/graphic/render/gameview_sdl.h 2012-02-20 16:00:42 +0000 | |||
608 | @@ -0,0 +1,50 @@ | |||
609 | 1 | /* | ||
610 | 2 | * Copyright (C) 2011-2012 by the Widelands Development Team | ||
611 | 3 | * | ||
612 | 4 | * This program is free software; you can redistribute it and/or | ||
613 | 5 | * modify it under the terms of the GNU General Public License | ||
614 | 6 | * as published by the Free Software Foundation; either version 2 | ||
615 | 7 | * of the License, or (at your option) any later version. | ||
616 | 8 | * | ||
617 | 9 | * This program is distributed in the hope that it will be useful, | ||
618 | 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
619 | 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
620 | 12 | * GNU General Public License for more details. | ||
621 | 13 | * | ||
622 | 14 | * You should have received a copy of the GNU General Public License | ||
623 | 15 | * along with this program; if not, write to the Free Software | ||
624 | 16 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
625 | 17 | * | ||
626 | 18 | */ | ||
627 | 19 | |||
628 | 20 | #ifndef GAMEVIEW_SDL_H_ | ||
629 | 21 | #define GAMEVIEW_SDL_H_ | ||
630 | 22 | |||
631 | 23 | #include "gameview.h" | ||
632 | 24 | |||
633 | 25 | class GameViewSDL : public GameView | ||
634 | 26 | { | ||
635 | 27 | public: | ||
636 | 28 | GameViewSDL(RenderTarget & rt): | ||
637 | 29 | GameView(rt) {} | ||
638 | 30 | ~GameViewSDL() {} | ||
639 | 31 | |||
640 | 32 | protected: | ||
641 | 33 | /** | ||
642 | 34 | * Helper function to draw two terrain triangles. This is called from the | ||
643 | 35 | * rendermap() functions. | ||
644 | 36 | */ | ||
645 | 37 | void draw_field | ||
646 | 38 | (Rect & subwin, | ||
647 | 39 | Vertex const & f_vert, | ||
648 | 40 | Vertex const & r_vert, | ||
649 | 41 | Vertex const & bl_vert, | ||
650 | 42 | Vertex const & br_vert, | ||
651 | 43 | uint8_t roads, | ||
652 | 44 | Texture const & tr_d_texture, | ||
653 | 45 | Texture const & l_r_texture, | ||
654 | 46 | Texture const & f_d_texture, | ||
655 | 47 | Texture const & f_r_texture); | ||
656 | 48 | }; | ||
657 | 49 | |||
658 | 50 | #endif /* GAMEVIEW_SDL_H_ */ | ||
659 | 0 | 51 | ||
660 | === modified file 'src/graphic/render/terrain_opengl.h' | |||
661 | --- src/graphic/render/terrain_opengl.h 2011-11-30 21:38:37 +0000 | |||
662 | +++ src/graphic/render/terrain_opengl.h 2012-02-20 16:00:42 +0000 | |||
663 | @@ -1,5 +1,5 @@ | |||
664 | 1 | /* | 1 | /* |
666 | 2 | * Copyright (C) 2010 by the Widelands Development Team | 2 | * Copyright (C) 2010-2012 by the Widelands Development Team |
667 | 3 | * | 3 | * |
668 | 4 | * This program is free software; you can redistribute it and/or | 4 | * This program is free software; you can redistribute it and/or |
669 | 5 | * modify it under the terms of the GNU General Public License | 5 | * modify it under the terms of the GNU General Public License |
670 | @@ -18,6 +18,8 @@ | |||
671 | 18 | */ | 18 | */ |
672 | 19 | 19 | ||
673 | 20 | #ifdef USE_OPENGL | 20 | #ifdef USE_OPENGL |
674 | 21 | #ifndef TERRAIN_OPENGL_H | ||
675 | 22 | #define TERRAIN_OPENGL_H | ||
676 | 21 | 23 | ||
677 | 22 | #include "gl_picture_texture.h" | 24 | #include "gl_picture_texture.h" |
678 | 23 | #include "vertex.h" | 25 | #include "vertex.h" |
679 | @@ -28,13 +30,13 @@ | |||
680 | 28 | Vertex const & p1, | 30 | Vertex const & p1, |
681 | 29 | Vertex const & p2, | 31 | Vertex const & p2, |
682 | 30 | Vertex const & p3, | 32 | Vertex const & p3, |
684 | 31 | Texture const & texture) | 33 | Texture const & texture, |
685 | 34 | Texture const & left_texture, | ||
686 | 35 | Texture const & top_texture) | ||
687 | 32 | { | 36 | { |
688 | 33 | if (p1.b <= -128 and p2.b <= -128 and p3.b <= -128) | 37 | if (p1.b <= -128 and p2.b <= -128 and p3.b <= -128) |
689 | 34 | return; | 38 | return; |
690 | 35 | 39 | ||
691 | 36 | glBindTexture(GL_TEXTURE_2D, texture.getTexture()); | ||
692 | 37 | |||
693 | 38 | Vertex t1(p1), t2(p2), t3(p3); | 40 | Vertex t1(p1), t2(p2), t3(p3); |
694 | 39 | 41 | ||
695 | 40 | t1.x = p1.x + subwin.x; | 42 | t1.x = p1.x + subwin.x; |
696 | @@ -49,39 +51,147 @@ | |||
697 | 49 | if (t1.y < subwin.y and t2.y < subwin.y and t3.y < subwin.y) | 51 | if (t1.y < subwin.y and t2.y < subwin.y and t3.y < subwin.y) |
698 | 50 | return; | 52 | return; |
699 | 51 | 53 | ||
710 | 52 | { | 54 | int const subxr = subwin.x + subwin.w; |
711 | 53 | int const subxr = subwin.x + subwin.w; | 55 | if (t1.x > subxr and t2.x > subxr and t3.x > subxr) |
712 | 54 | if (t1.x > subxr and t2.x > subxr and t3.x > subxr) | 56 | return; |
713 | 55 | return; | 57 | |
714 | 56 | } | 58 | int const subyd = subwin.y + subwin.h; |
715 | 57 | { | 59 | if (t1.y > subyd and t2.y > subyd and t3.y > subyd) |
716 | 58 | int const subyd = subwin.y + subwin.h; | 60 | return; |
717 | 59 | if (t1.y > subyd and t2.y > subyd and t3.y > subyd) | 61 | |
718 | 60 | return; | 62 | glEnable(GL_BLEND); |
719 | 61 | } | 63 | |
720 | 64 | // load current texture | ||
721 | 65 | glActiveTexture(GL_TEXTURE0); | ||
722 | 66 | glEnable(GL_TEXTURE_2D); | ||
723 | 67 | glBindTexture(GL_TEXTURE_2D, texture.getTexture()); | ||
724 | 68 | glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE); | ||
725 | 69 | |||
726 | 70 | if ((&top_texture != &texture) and not (p1.b == -128 and p3.b == -128)) { | ||
727 | 71 | // load top texture | ||
728 | 72 | glActiveTexture(GL_TEXTURE1); | ||
729 | 73 | glEnable(GL_TEXTURE_2D); | ||
730 | 74 | glBindTexture(GL_TEXTURE_2D, top_texture.getTexture()); | ||
731 | 75 | glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE); | ||
732 | 76 | glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB, GL_REPLACE); | ||
733 | 77 | glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE0_RGB, GL_PREVIOUS); | ||
734 | 78 | glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND0_RGB, GL_SRC_COLOR); | ||
735 | 79 | |||
736 | 80 | GLuint edge = dynamic_cast<GLPictureTexture const &> | ||
737 | 81 | (*g_gr->get_edge_texture()).get_gl_texture(); | ||
738 | 82 | |||
739 | 83 | // combine current and top texture | ||
740 | 84 | glActiveTexture(GL_TEXTURE2); | ||
741 | 85 | glEnable(GL_TEXTURE_2D); | ||
742 | 86 | glBindTexture(GL_TEXTURE_2D, edge); | ||
743 | 87 | glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE); | ||
744 | 88 | glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB, GL_INTERPOLATE); | ||
745 | 89 | glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE0_RGB, GL_PREVIOUS); | ||
746 | 90 | glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE1_RGB, GL_TEXTURE1); | ||
747 | 91 | glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE2_RGB, GL_TEXTURE); | ||
748 | 92 | glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND0_RGB, GL_SRC_COLOR); | ||
749 | 93 | glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND1_RGB, GL_SRC_COLOR); | ||
750 | 94 | glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND2_RGB, GL_SRC_COLOR); | ||
751 | 95 | } | ||
752 | 96 | |||
753 | 97 | if ((&left_texture != &texture) and not (p1.b == -128 and p2.b == -128)) { | ||
754 | 98 | // load left texture | ||
755 | 99 | glActiveTexture(GL_TEXTURE3); | ||
756 | 100 | glEnable(GL_TEXTURE_2D); | ||
757 | 101 | glBindTexture(GL_TEXTURE_2D, left_texture.getTexture()); | ||
758 | 102 | glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE); | ||
759 | 103 | glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB, GL_REPLACE); | ||
760 | 104 | glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE0_RGB, GL_PREVIOUS); | ||
761 | 105 | glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND0_RGB, GL_SRC_COLOR); | ||
762 | 106 | |||
763 | 107 | GLuint edge = dynamic_cast<GLPictureTexture const &> | ||
764 | 108 | (*g_gr->get_edge_texture()).get_gl_texture(); | ||
765 | 109 | |||
766 | 110 | // combine current and left texture | ||
767 | 111 | glActiveTexture(GL_TEXTURE4); | ||
768 | 112 | glEnable(GL_TEXTURE_2D); | ||
769 | 113 | glBindTexture(GL_TEXTURE_2D, edge); | ||
770 | 114 | glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); | ||
771 | 115 | glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); | ||
772 | 116 | glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE); | ||
773 | 117 | glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB, GL_INTERPOLATE); | ||
774 | 118 | glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE0_RGB, GL_PREVIOUS); | ||
775 | 119 | glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE1_RGB, GL_TEXTURE3); | ||
776 | 120 | glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE2_RGB, GL_TEXTURE); | ||
777 | 121 | glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND0_RGB, GL_SRC_COLOR); | ||
778 | 122 | glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND1_RGB, GL_SRC_COLOR); | ||
779 | 123 | glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND2_RGB, GL_SRC_COLOR); | ||
780 | 124 | } | ||
781 | 125 | |||
782 | 126 | // Fade effect for fog of war | ||
783 | 127 | glActiveTexture(GL_TEXTURE5); | ||
784 | 128 | glEnable(GL_TEXTURE_2D); | ||
785 | 129 | // texture does not matter but one has to be bound | ||
786 | 130 | glBindTexture(GL_TEXTURE_2D, texture.getTexture()); | ||
787 | 131 | glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE); | ||
788 | 132 | glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB, GL_MODULATE); | ||
789 | 133 | glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE0_RGB, GL_PREVIOUS); | ||
790 | 134 | glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND0_RGB, GL_SRC_COLOR); | ||
791 | 135 | glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE1_RGB, GL_PRIMARY_COLOR); | ||
792 | 136 | glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND1_RGB, GL_SRC_COLOR); | ||
793 | 62 | 137 | ||
794 | 63 | glBegin(GL_TRIANGLES); { | 138 | glBegin(GL_TRIANGLES); { |
795 | 64 | { | 139 | { |
796 | 65 | GLfloat const brightness = (150.0 + p1.b) / 150.0; | 140 | GLfloat const brightness = (150.0 + p1.b) / 150.0; |
797 | 66 | glColor3f(brightness, brightness, brightness); | 141 | glColor3f(brightness, brightness, brightness); |
798 | 67 | } | 142 | } |
800 | 68 | glTexCoord2i(t1.tx, t1.ty); | 143 | glMultiTexCoord2i(GL_TEXTURE0, t1.tx, t1.ty); |
801 | 144 | glMultiTexCoord2f(GL_TEXTURE1, t1.tx / TEXTURE_WIDTH, t1.ty / TEXTURE_WIDTH); | ||
802 | 145 | glMultiTexCoord2f(GL_TEXTURE2, 0, 0); | ||
803 | 146 | glMultiTexCoord2f(GL_TEXTURE3, t1.tx / TEXTURE_WIDTH, t1.ty / TEXTURE_WIDTH); | ||
804 | 147 | glMultiTexCoord2f(GL_TEXTURE4, 1, 0); | ||
805 | 148 | glMultiTexCoord2f(GL_TEXTURE5, t1.tx / TEXTURE_WIDTH, t1.ty / TEXTURE_WIDTH); | ||
806 | 69 | glVertex2f(t1.x, t1.y); | 149 | glVertex2f(t1.x, t1.y); |
807 | 70 | 150 | ||
808 | 71 | { | 151 | { |
809 | 72 | GLfloat const brightness = (150.0 + p2.b) / 150.0; | 152 | GLfloat const brightness = (150.0 + p2.b) / 150.0; |
810 | 73 | glColor3f(brightness, brightness, brightness); | 153 | glColor3f(brightness, brightness, brightness); |
811 | 74 | } | 154 | } |
813 | 75 | glTexCoord2i(t2.tx, t2.ty); | 155 | glMultiTexCoord2i(GL_TEXTURE0, t2.tx, t2.ty); |
814 | 156 | glMultiTexCoord2f(GL_TEXTURE1, t2.tx / TEXTURE_WIDTH, t2.ty / TEXTURE_WIDTH); | ||
815 | 157 | glMultiTexCoord2f(GL_TEXTURE2, 0.5, 1); | ||
816 | 158 | glMultiTexCoord2f(GL_TEXTURE3, t2.tx / TEXTURE_WIDTH, t2.ty / TEXTURE_WIDTH); | ||
817 | 159 | glMultiTexCoord2f(GL_TEXTURE4, 0, 0); | ||
818 | 160 | glMultiTexCoord2f(GL_TEXTURE5, t2.tx / TEXTURE_WIDTH, t2.ty / TEXTURE_WIDTH); | ||
819 | 76 | glVertex2f(t2.x, t2.y); | 161 | glVertex2f(t2.x, t2.y); |
820 | 77 | 162 | ||
821 | 78 | { | 163 | { |
822 | 79 | GLfloat const brightness = (150.0 + p3.b) / 150.0; | 164 | GLfloat const brightness = (150.0 + p3.b) / 150.0; |
823 | 80 | glColor3f(brightness, brightness, brightness); | 165 | glColor3f(brightness, brightness, brightness); |
824 | 81 | } | 166 | } |
826 | 82 | glTexCoord2i(t3.tx, t3.ty); | 167 | glMultiTexCoord2i(GL_TEXTURE0, t3.tx, t3.ty); |
827 | 168 | glMultiTexCoord2f(GL_TEXTURE1, t3.tx / TEXTURE_WIDTH, t3.ty / TEXTURE_WIDTH); | ||
828 | 169 | glMultiTexCoord2f(GL_TEXTURE2, 1, 0); | ||
829 | 170 | glMultiTexCoord2f(GL_TEXTURE3, t3.tx / TEXTURE_WIDTH, t3.ty / TEXTURE_WIDTH); | ||
830 | 171 | glMultiTexCoord2f(GL_TEXTURE4, 0.5, 1); | ||
831 | 172 | glMultiTexCoord2f(GL_TEXTURE5, t3.tx / TEXTURE_WIDTH, t3.ty / TEXTURE_WIDTH); | ||
832 | 83 | glVertex2f(t3.x, t3.y); | 173 | glVertex2f(t3.x, t3.y); |
833 | 84 | } glEnd(); | 174 | } glEnd(); |
834 | 175 | |||
835 | 176 | // Cleanup OpenGL | ||
836 | 177 | glActiveTexture(GL_TEXTURE5); | ||
837 | 178 | glDisable(GL_TEXTURE_2D); | ||
838 | 179 | glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE); | ||
839 | 180 | glActiveTexture(GL_TEXTURE4); | ||
840 | 181 | glDisable(GL_TEXTURE_2D); | ||
841 | 182 | glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE); | ||
842 | 183 | glActiveTexture(GL_TEXTURE3); | ||
843 | 184 | glDisable(GL_TEXTURE_2D); | ||
844 | 185 | glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE); | ||
845 | 186 | glActiveTexture(GL_TEXTURE2); | ||
846 | 187 | glDisable(GL_TEXTURE_2D); | ||
847 | 188 | glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE); | ||
848 | 189 | glActiveTexture(GL_TEXTURE1); | ||
849 | 190 | glDisable(GL_TEXTURE_2D); | ||
850 | 191 | glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE); | ||
851 | 192 | glActiveTexture(GL_TEXTURE0); | ||
852 | 193 | glEnable(GL_TEXTURE_2D); | ||
853 | 194 | glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); | ||
854 | 85 | } | 195 | } |
855 | 86 | 196 | ||
856 | 87 | #define horiz_road_opengl(tex, start, end) \ | 197 | #define horiz_road_opengl(tex, start, end) \ |
857 | @@ -93,7 +203,7 @@ | |||
858 | 93 | glVertex2f(subwin.x + end.x, subwin.y + end.y - 2); \ | 203 | glVertex2f(subwin.x + end.x, subwin.y + end.y - 2); \ |
859 | 94 | glTexCoord2i(TEXTURE_WIDTH, 4); \ | 204 | glTexCoord2i(TEXTURE_WIDTH, 4); \ |
860 | 95 | glVertex2f(subwin.x + end.x, subwin.y + end.y + 2); \ | 205 | glVertex2f(subwin.x + end.x, subwin.y + end.y + 2); \ |
862 | 96 | glTexCoord2i(TEXTURE_WIDTH, 4); \ | 206 | glTexCoord2i(0, 4); \ |
863 | 97 | glVertex2f(subwin.x + start.x, subwin.y + start.y + 2); \ | 207 | glVertex2f(subwin.x + start.x, subwin.y + start.y + 2); \ |
864 | 98 | } glEnd(); \ | 208 | } glEnd(); \ |
865 | 99 | 209 | ||
866 | @@ -106,7 +216,7 @@ | |||
867 | 106 | glVertex2f(subwin.x + start.x + 3, subwin.y + start.y); \ | 216 | glVertex2f(subwin.x + start.x + 3, subwin.y + start.y); \ |
868 | 107 | glTexCoord2i(TEXTURE_WIDTH, TEXTURE_HEIGHT); \ | 217 | glTexCoord2i(TEXTURE_WIDTH, TEXTURE_HEIGHT); \ |
869 | 108 | glVertex2f(subwin.x + end.x + 3, subwin.y + end.y); \ | 218 | glVertex2f(subwin.x + end.x + 3, subwin.y + end.y); \ |
871 | 109 | glTexCoord2i(TEXTURE_WIDTH - 6, TEXTURE_HEIGHT); \ | 219 | glTexCoord2i(TEXTURE_WIDTH - 6, TEXTURE_HEIGHT); \ |
872 | 110 | glVertex2f(subwin.x + end.x - 3, subwin.y + end.y); \ | 220 | glVertex2f(subwin.x + end.x - 3, subwin.y + end.y); \ |
873 | 111 | } glEnd(); \ | 221 | } glEnd(); \ |
874 | 112 | 222 | ||
875 | @@ -174,3 +284,4 @@ | |||
876 | 174 | } | 284 | } |
877 | 175 | 285 | ||
878 | 176 | #endif | 286 | #endif |
879 | 287 | #endif | ||
880 | 177 | 288 | ||
881 | === modified file 'src/graphic/texture.cc' | |||
882 | --- src/graphic/texture.cc 2011-11-30 21:38:37 +0000 | |||
883 | +++ src/graphic/texture.cc 2012-02-20 16:00:42 +0000 | |||
884 | @@ -1,5 +1,5 @@ | |||
885 | 1 | /* | 1 | /* |
887 | 2 | * Copyright (C) 2002-2004, 2006, 2010 by the Widelands Development Team | 2 | * Copyright (C) 2002-2004, 2006, 2010, 2012 by the Widelands Development Team |
888 | 3 | * | 3 | * |
889 | 4 | * This program is free software; you can redistribute it and/or | 4 | * This program is free software; you can redistribute it and/or |
890 | 5 | * modify it under the terms of the GNU General Public License | 5 | * modify it under the terms of the GNU General Public License |
891 | @@ -106,16 +106,38 @@ | |||
892 | 106 | boost::shared_ptr<GLPictureTexture> surface(new GLPictureTexture(surf)); | 106 | boost::shared_ptr<GLPictureTexture> surface(new GLPictureTexture(surf)); |
893 | 107 | m_glFrames.push_back(surface); | 107 | m_glFrames.push_back(surface); |
894 | 108 | 108 | ||
898 | 109 | surface->lock(IPixelAccess::Lock_Normal); | 109 | // calculate shades on the first frame |
899 | 110 | m_mmap_color = surface->get_pixel(0, 0); | 110 | if (!m_nrframes) { |
900 | 111 | surface->unlock(IPixelAccess::Unlock_NoChange); | 111 | surface->lock(IPixelAccess::Lock_Normal); |
901 | 112 | uint32_t mmap_color_base = surface->get_pixel(0, 0); | ||
902 | 113 | surface->unlock(IPixelAccess::Unlock_NoChange); | ||
903 | 114 | |||
904 | 115 | int32_t i, shade, r, g, b, a; | ||
905 | 116 | for (i = -128; i < 128; i++) { | ||
906 | 117 | shade = 128 + i; | ||
907 | 118 | |||
908 | 119 | a = (mmap_color_base & 0xff000000) >> 24; | ||
909 | 120 | b = (mmap_color_base & 0x00ff0000) >> 16; | ||
910 | 121 | g = (mmap_color_base & 0x0000ff00) >> 8; | ||
911 | 122 | r = (mmap_color_base & 0x000000ff); | ||
912 | 123 | |||
913 | 124 | b = (b * shade) >> 7; | ||
914 | 125 | g = (g * shade) >> 7; | ||
915 | 126 | r = (r * shade) >> 7; | ||
916 | 127 | |||
917 | 128 | if (b > 255) b = 255; | ||
918 | 129 | if (g > 255) g = 255; | ||
919 | 130 | if (r > 255) r = 255; | ||
920 | 131 | |||
921 | 132 | m_mmap_color[shade] = (a << 24) | (b << 16) | (g << 8) | r; | ||
922 | 133 | } | ||
923 | 134 | } | ||
924 | 112 | 135 | ||
925 | 113 | ++m_nrframes; | 136 | ++m_nrframes; |
926 | 114 | continue; | 137 | continue; |
927 | 115 | } | 138 | } |
928 | 116 | #endif | 139 | #endif |
929 | 117 | 140 | ||
930 | 118 | |||
931 | 119 | // Determine color map if it's the first frame | 141 | // Determine color map if it's the first frame |
932 | 120 | if (!m_nrframes) { | 142 | if (!m_nrframes) { |
933 | 121 | if (surf->format->BitsPerPixel == 8) | 143 | if (surf->format->BitsPerPixel == 8) |
934 | @@ -187,8 +209,11 @@ | |||
935 | 187 | * Return the basic terrain colour to be used in the minimap. | 209 | * Return the basic terrain colour to be used in the minimap. |
936 | 188 | */ | 210 | */ |
937 | 189 | Uint32 Texture::get_minimap_color(const char shade) { | 211 | Uint32 Texture::get_minimap_color(const char shade) { |
938 | 212 | assert(shade >= -128); | ||
939 | 213 | assert(shade <= 127); | ||
940 | 214 | |||
941 | 190 | if (not m_pixels) | 215 | if (not m_pixels) |
943 | 191 | return m_mmap_color; | 216 | return m_mmap_color[128 + shade]; |
944 | 192 | 217 | ||
945 | 193 | uint8_t clr = m_pixels[0]; // just use the top-left pixel | 218 | uint8_t clr = m_pixels[0]; // just use the top-left pixel |
946 | 194 | uint32_t table = static_cast<uint8_t>(shade); | 219 | uint32_t table = static_cast<uint8_t>(shade); |
947 | 195 | 220 | ||
948 | === modified file 'src/graphic/texture.h' | |||
949 | --- src/graphic/texture.h 2012-01-09 21:10:43 +0000 | |||
950 | +++ src/graphic/texture.h 2012-02-20 16:00:42 +0000 | |||
951 | @@ -1,5 +1,5 @@ | |||
952 | 1 | /* | 1 | /* |
954 | 2 | * Copyright (C) 2002-2004, 2006, 2008-2010 by the Widelands Development Team | 2 | * Copyright (C) 2002-2004, 2006, 2008-2010, 2012 by the Widelands Development Team |
955 | 3 | * | 3 | * |
956 | 4 | * This program is free software; you can redistribute it and/or | 4 | * This program is free software; you can redistribute it and/or |
957 | 5 | * modify it under the terms of the GNU General Public License | 5 | * modify it under the terms of the GNU General Public License |
958 | @@ -71,7 +71,7 @@ | |||
959 | 71 | private: | 71 | private: |
960 | 72 | Colormap * m_colormap; | 72 | Colormap * m_colormap; |
961 | 73 | uint8_t * m_pixels; | 73 | uint8_t * m_pixels; |
963 | 74 | uint32_t m_mmap_color; | 74 | uint32_t m_mmap_color[256]; |
964 | 75 | uint8_t * m_curframe; | 75 | uint8_t * m_curframe; |
965 | 76 | int32_t m_frame_num; | 76 | int32_t m_frame_num; |
966 | 77 | char * m_texture_picture; | 77 | char * m_texture_picture; |
967 | 78 | 78 | ||
968 | === modified file 'src/ui_fsmenu/options.cc' | |||
969 | --- src/ui_fsmenu/options.cc 2012-01-21 13:09:23 +0000 | |||
970 | +++ src/ui_fsmenu/options.cc 2012-02-20 16:00:42 +0000 | |||
971 | @@ -1,5 +1,5 @@ | |||
972 | 1 | /* | 1 | /* |
974 | 2 | * Copyright (C) 2002-2004, 2006-2010 by Widelands Development Team | 2 | * Copyright (C) 2002-2004, 2006-2010, 2012 by Widelands Development Team |
975 | 3 | * | 3 | * |
976 | 4 | * This program is free software; you can redistribute it and/or | 4 | * This program is free software; you can redistribute it and/or |
977 | 5 | * modify it under the terms of the GNU General Public License | 5 | * modify it under the terms of the GNU General Public License |
978 | @@ -468,7 +468,7 @@ | |||
979 | 468 | m_label_opengl | 468 | m_label_opengl |
980 | 469 | (this, | 469 | (this, |
981 | 470 | get_w() * 1313 / 10000, get_h() * 8330 / 10000, | 470 | get_w() * 1313 / 10000, get_h() * 8330 / 10000, |
983 | 471 | _("OpenGL rendering *Highly experimental!*"), UI::Align_VCenter), | 471 | _("OpenGL rendering"), UI::Align_VCenter), |
984 | 472 | m_transparent_chat (this, Point(get_w() * 19 / 200, get_h() * 8645 / 10000)), | 472 | m_transparent_chat (this, Point(get_w() * 19 / 200, get_h() * 8645 / 10000)), |
985 | 473 | m_label_transparent_chat | 473 | m_label_transparent_chat |
986 | 474 | (this, | 474 | (this, |
987 | @@ -658,7 +658,7 @@ | |||
988 | 658 | opt.remove_syncstreams = m_opt_section.get_bool | 658 | opt.remove_syncstreams = m_opt_section.get_bool |
989 | 659 | ("remove_syncstreams", true); | 659 | ("remove_syncstreams", true); |
990 | 660 | opt.opengl = m_opt_section.get_bool | 660 | opt.opengl = m_opt_section.get_bool |
992 | 661 | ("opengl", false); | 661 | ("opengl", true); |
993 | 662 | opt.transparent_chat = m_opt_section.get_bool | 662 | opt.transparent_chat = m_opt_section.get_bool |
994 | 663 | ("transparent_chat", true); | 663 | ("transparent_chat", true); |
995 | 664 | return opt; | 664 | return opt; |
996 | 665 | 665 | ||
997 | === modified file 'src/wlapplication.cc' | |||
998 | --- src/wlapplication.cc 2012-02-07 12:14:30 +0000 | |||
999 | +++ src/wlapplication.cc 2012-02-20 16:00:42 +0000 | |||
1000 | @@ -264,7 +264,7 @@ | |||
1001 | 264 | m_should_die (false), | 264 | m_should_die (false), |
1002 | 265 | m_gfx_w(0), m_gfx_h(0), | 265 | m_gfx_w(0), m_gfx_h(0), |
1003 | 266 | m_gfx_fullscreen (false), | 266 | m_gfx_fullscreen (false), |
1005 | 267 | m_gfx_opengl (false), | 267 | m_gfx_opengl (true), |
1006 | 268 | m_default_datadirs (true), | 268 | m_default_datadirs (true), |
1007 | 269 | m_homedir(FileSystem::GetHomedir() + "/.widelands"), | 269 | m_homedir(FileSystem::GetHomedir() + "/.widelands"), |
1008 | 270 | m_redirected_stdio(false) | 270 | m_redirected_stdio(false) |
1009 | @@ -512,6 +512,10 @@ | |||
1010 | 512 | g_sound_handler.change_music(); | 512 | g_sound_handler.change_music(); |
1011 | 513 | 513 | ||
1012 | 514 | break; | 514 | break; |
1013 | 515 | case SDL_VIDEOEXPOSE: | ||
1014 | 516 | //log ("SDL Video Window expose event: %i\n", ev.expose.type); | ||
1015 | 517 | g_gr->update_fullscreen(); | ||
1016 | 518 | break; | ||
1017 | 515 | } | 519 | } |
1018 | 516 | } | 520 | } |
1019 | 517 | } | 521 | } |
1020 | @@ -807,7 +811,7 @@ | |||
1021 | 807 | m_gfx_fullscreen = s.get_bool("fullscreen", false); | 811 | m_gfx_fullscreen = s.get_bool("fullscreen", false); |
1022 | 808 | 812 | ||
1023 | 809 | #if USE_OPENGL | 813 | #if USE_OPENGL |
1025 | 810 | m_gfx_opengl = s.get_bool("opengl", false); | 814 | m_gfx_opengl = s.get_bool("opengl", true); |
1026 | 811 | #endif | 815 | #endif |
1027 | 812 | 816 | ||
1028 | 813 | // KLUDGE! | 817 | // KLUDGE! |
1029 | @@ -1352,8 +1356,7 @@ | |||
1030 | 1352 | << | 1356 | << |
1031 | 1353 | _ | 1357 | _ |
1032 | 1354 | (" --opengl=[0|1]\n" | 1358 | (" --opengl=[0|1]\n" |
1035 | 1355 | " Enables opengl rendering\n" | 1359 | " Enables OpenGL rendering\n") |
1034 | 1356 | " *EXPERIMENTAL*\n") | ||
1036 | 1357 | #endif | 1360 | #endif |
1037 | 1358 | << | 1361 | << |
1038 | 1359 | _ | 1362 | _ |
1039 | 1360 | 1363 | ||
1040 | === modified file 'src/wui/mapview.cc' | |||
1041 | --- src/wui/mapview.cc 2011-11-30 21:38:37 +0000 | |||
1042 | +++ src/wui/mapview.cc 2012-02-20 16:00:42 +0000 | |||
1043 | @@ -31,6 +31,8 @@ | |||
1044 | 31 | #include "graphic/graphic.h" | 31 | #include "graphic/graphic.h" |
1045 | 32 | #include "graphic/rendertarget.h" | 32 | #include "graphic/rendertarget.h" |
1046 | 33 | #include "graphic/render/gameview.h" | 33 | #include "graphic/render/gameview.h" |
1047 | 34 | #include "graphic/render/gameview_opengl.h" | ||
1048 | 35 | #include "graphic/render/gameview_sdl.h" | ||
1049 | 34 | 36 | ||
1050 | 35 | #include "upcast.h" | 37 | #include "upcast.h" |
1051 | 36 | 38 | ||
1052 | @@ -93,12 +95,17 @@ | |||
1053 | 93 | 95 | ||
1054 | 94 | egbase.map().overlay_manager().load_graphics(); | 96 | egbase.map().overlay_manager().load_graphics(); |
1055 | 95 | 97 | ||
1057 | 96 | GameView gameview(dst); | 98 | GameView * gameview; |
1058 | 99 | if (g_opengl) { | ||
1059 | 100 | gameview = new GameViewOpenGL(dst); | ||
1060 | 101 | } else { | ||
1061 | 102 | gameview = new GameViewSDL(dst); | ||
1062 | 103 | } | ||
1063 | 97 | 104 | ||
1064 | 98 | if (upcast(Interactive_Player const, interactive_player, &intbase())) | 105 | if (upcast(Interactive_Player const, interactive_player, &intbase())) |
1066 | 99 | gameview.rendermap(egbase, interactive_player->player(), m_viewpoint); | 106 | gameview->rendermap(egbase, interactive_player->player(), m_viewpoint); |
1067 | 100 | else | 107 | else |
1069 | 101 | gameview.rendermap(egbase, m_viewpoint); | 108 | gameview->rendermap(egbase, m_viewpoint); |
1070 | 102 | 109 | ||
1071 | 103 | m_complete_redraw_needed = false; | 110 | m_complete_redraw_needed = false; |
1072 | 104 | if (char const * const text = tooltip()) | 111 | if (char const * const text = tooltip()) |
1073 | 105 | 112 | ||
1074 | === added file 'worlds/blackland/pics/edge.png' | |||
1075 | 106 | Binary files worlds/blackland/pics/edge.png 1970-01-01 00:00:00 +0000 and worlds/blackland/pics/edge.png 2012-02-20 16:00:42 +0000 differ | 113 | Binary files worlds/blackland/pics/edge.png 1970-01-01 00:00:00 +0000 and worlds/blackland/pics/edge.png 2012-02-20 16:00:42 +0000 differ |
1076 | === modified file 'worlds/blackland/pics/roadt_busy.png' | |||
1077 | 107 | Binary files worlds/blackland/pics/roadt_busy.png 2011-08-21 14:24:10 +0000 and worlds/blackland/pics/roadt_busy.png 2012-02-20 16:00:42 +0000 differ | 114 | Binary files worlds/blackland/pics/roadt_busy.png 2011-08-21 14:24:10 +0000 and worlds/blackland/pics/roadt_busy.png 2012-02-20 16:00:42 +0000 differ |
1078 | === modified file 'worlds/blackland/pics/roadt_normal.png' | |||
1079 | 108 | Binary files worlds/blackland/pics/roadt_normal.png 2011-08-21 14:24:10 +0000 and worlds/blackland/pics/roadt_normal.png 2012-02-20 16:00:42 +0000 differ | 115 | Binary files worlds/blackland/pics/roadt_normal.png 2011-08-21 14:24:10 +0000 and worlds/blackland/pics/roadt_normal.png 2012-02-20 16:00:42 +0000 differ |
1080 | === added file 'worlds/desert/pics/edge.png' | |||
1081 | 109 | Binary files worlds/desert/pics/edge.png 1970-01-01 00:00:00 +0000 and worlds/desert/pics/edge.png 2012-02-20 16:00:42 +0000 differ | 116 | Binary files worlds/desert/pics/edge.png 1970-01-01 00:00:00 +0000 and worlds/desert/pics/edge.png 2012-02-20 16:00:42 +0000 differ |
1082 | === modified file 'worlds/desert/pics/roadt_busy.png' | |||
1083 | 110 | Binary files worlds/desert/pics/roadt_busy.png 2011-08-21 14:24:10 +0000 and worlds/desert/pics/roadt_busy.png 2012-02-20 16:00:42 +0000 differ | 117 | Binary files worlds/desert/pics/roadt_busy.png 2011-08-21 14:24:10 +0000 and worlds/desert/pics/roadt_busy.png 2012-02-20 16:00:42 +0000 differ |
1084 | === modified file 'worlds/desert/pics/roadt_normal.png' | |||
1085 | 111 | Binary files worlds/desert/pics/roadt_normal.png 2011-08-21 14:24:10 +0000 and worlds/desert/pics/roadt_normal.png 2012-02-20 16:00:42 +0000 differ | 118 | Binary files worlds/desert/pics/roadt_normal.png 2011-08-21 14:24:10 +0000 and worlds/desert/pics/roadt_normal.png 2012-02-20 16:00:42 +0000 differ |
1086 | === added file 'worlds/greenland/pics/edge.png' | |||
1087 | 112 | Binary files worlds/greenland/pics/edge.png 1970-01-01 00:00:00 +0000 and worlds/greenland/pics/edge.png 2012-02-20 16:00:42 +0000 differ | 119 | Binary files worlds/greenland/pics/edge.png 1970-01-01 00:00:00 +0000 and worlds/greenland/pics/edge.png 2012-02-20 16:00:42 +0000 differ |
1088 | === modified file 'worlds/greenland/pics/roadt_busy.png' | |||
1089 | 113 | Binary files worlds/greenland/pics/roadt_busy.png 2011-10-03 15:11:25 +0000 and worlds/greenland/pics/roadt_busy.png 2012-02-20 16:00:42 +0000 differ | 120 | Binary files worlds/greenland/pics/roadt_busy.png 2011-10-03 15:11:25 +0000 and worlds/greenland/pics/roadt_busy.png 2012-02-20 16:00:42 +0000 differ |
1090 | === modified file 'worlds/greenland/pics/roadt_normal.png' | |||
1091 | 114 | Binary files worlds/greenland/pics/roadt_normal.png 2011-10-03 15:11:25 +0000 and worlds/greenland/pics/roadt_normal.png 2012-02-20 16:00:42 +0000 differ | 121 | Binary files worlds/greenland/pics/roadt_normal.png 2011-10-03 15:11:25 +0000 and worlds/greenland/pics/roadt_normal.png 2012-02-20 16:00:42 +0000 differ |
1092 | === modified file 'worlds/greenland/terrainconf' | |||
1093 | --- worlds/greenland/terrainconf 2012-01-04 18:52:20 +0000 | |||
1094 | +++ worlds/greenland/terrainconf 2012-02-20 16:00:42 +0000 | |||
1095 | @@ -80,4 +80,3 @@ | |||
1096 | 80 | [bergwiese] | 80 | [bergwiese] |
1097 | 81 | name="Mountain meadow" | 81 | name="Mountain meadow" |
1098 | 82 | is=green | 82 | is=green |
1099 | 83 | |||
1100 | 84 | 83 | ||
1101 | === added file 'worlds/winterland/pics/edge.png' | |||
1102 | 85 | Binary files worlds/winterland/pics/edge.png 1970-01-01 00:00:00 +0000 and worlds/winterland/pics/edge.png 2012-02-20 16:00:42 +0000 differ | 84 | Binary files worlds/winterland/pics/edge.png 1970-01-01 00:00:00 +0000 and worlds/winterland/pics/edge.png 2012-02-20 16:00:42 +0000 differ |
1103 | === modified file 'worlds/winterland/pics/roadt_busy.png' | |||
1104 | 86 | Binary files worlds/winterland/pics/roadt_busy.png 2011-08-21 14:24:10 +0000 and worlds/winterland/pics/roadt_busy.png 2012-02-20 16:00:42 +0000 differ | 85 | Binary files worlds/winterland/pics/roadt_busy.png 2011-08-21 14:24:10 +0000 and worlds/winterland/pics/roadt_busy.png 2012-02-20 16:00:42 +0000 differ |
1105 | === modified file 'worlds/winterland/pics/roadt_normal.png' | |||
1106 | 87 | Binary files worlds/winterland/pics/roadt_normal.png 2011-08-21 14:24:10 +0000 and worlds/winterland/pics/roadt_normal.png 2012-02-20 16:00:42 +0000 differ | 86 | Binary files worlds/winterland/pics/roadt_normal.png 2011-08-21 14:24:10 +0000 and worlds/winterland/pics/roadt_normal.png 2012-02-20 16:00:42 +0000 differ |