projects
/
supertux.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
*include stdio.h in a couple files for MinGW GCC 4.4.0
[supertux.git]
/
src
/
video
/
gl_renderer.cpp
diff --git
a/src/video/gl_renderer.cpp
b/src/video/gl_renderer.cpp
index
13522fb
..
1d062c4
100644
(file)
--- a/
src/video/gl_renderer.cpp
+++ b/
src/video/gl_renderer.cpp
@@
-151,8
+151,7
@@
Renderer::Renderer()
if(texture_manager != 0)
texture_manager->save_textures();
if(texture_manager != 0)
texture_manager->save_textures();
-#ifndef GP2X
- //FIXME: This is not supported on the GP2X
+#ifdef SDL_GL_SWAP_CONTROL
if(config->try_vsync) {
/* we want vsync for smooth scrolling */
SDL_GL_SetAttribute(SDL_GL_SWAP_CONTROL, 1);
if(config->try_vsync) {
/* we want vsync for smooth scrolling */
SDL_GL_SetAttribute(SDL_GL_SWAP_CONTROL, 1);
@@
-264,7
+263,7
@@
Renderer::draw_surface_part(const DrawingRequest& request)
uv_bottom,
0.0,
request.alpha,
uv_bottom,
0.0,
request.alpha,
-
Color(1.0, 1.0, 1.0)
,
+
request.color
,
Blend(),
request.drawing_effect);
}
Blend(),
request.drawing_effect);
}
@@
-312,6
+311,11
@@
Renderer::draw_filled_rect(const DrawingRequest& request)
const FillRectRequest* fillrectrequest
= (FillRectRequest*) request.request_data;
const FillRectRequest* fillrectrequest
= (FillRectRequest*) request.request_data;
+ glDisable(GL_TEXTURE_2D);
+ glColor4f(fillrectrequest->color.red, fillrectrequest->color.green,
+ fillrectrequest->color.blue, fillrectrequest->color.alpha);
+ glDisableClientState(GL_TEXTURE_COORD_ARRAY);
+
if (fillrectrequest->radius != 0.0f)
{
// draw round rect
if (fillrectrequest->radius != 0.0f)
{
// draw round rect
@@
-327,33
+331,37
@@
Renderer::draw_filled_rect(const DrawingRequest& request)
request.pos.x + fillrectrequest->size.x - radius,
request.pos.y + fillrectrequest->size.y - radius);
request.pos.x + fillrectrequest->size.x - radius,
request.pos.y + fillrectrequest->size.y - radius);
- glDisable(GL_TEXTURE_2D);
- glColor4f(fillrectrequest->color.red, fillrectrequest->color.green,
- fillrectrequest->color.blue, fillrectrequest->color.alpha);
-
int n = 8;
int n = 8;
- //FIXME: This doesn't work with OpenGL ES
- glBegin(GL_QUAD_STRIP);
+ int p = 0;
+ float vertices[(n+1) * 4 * 2];
+
for(int i = 0; i <= n; ++i)
{
float x = sinf(i * (M_PI/2) / n) * radius;
float y = cosf(i * (M_PI/2) / n) * radius;
for(int i = 0; i <= n; ++i)
{
float x = sinf(i * (M_PI/2) / n) * radius;
float y = cosf(i * (M_PI/2) / n) * radius;
- glVertex2f(irect.get_left() - x, irect.get_top() - y);
- glVertex2f(irect.get_right() + x, irect.get_top() - y);
+ vertices[p++] = irect.get_left() - x;
+ vertices[p++] = irect.get_top() - y;
+
+ vertices[p++] = irect.get_right() + x;
+ vertices[p++] = irect.get_top() - y;
}
}
+
for(int i = 0; i <= n; ++i)
{
float x = cosf(i * (M_PI/2) / n) * radius;
float y = sinf(i * (M_PI/2) / n) * radius;
for(int i = 0; i <= n; ++i)
{
float x = cosf(i * (M_PI/2) / n) * radius;
float y = sinf(i * (M_PI/2) / n) * radius;
- glVertex2f(irect.get_left() - x, irect.get_bottom() + y);
- glVertex2f(irect.get_right() + x, irect.get_bottom() + y);
+ vertices[p++] = irect.get_left() - x;
+ vertices[p++] = irect.get_bottom() + y;
+
+ vertices[p++] = irect.get_right() + x;
+ vertices[p++] = irect.get_bottom() + y;
}
}
- glEnd();
- gl
Enable(GL_TEXTURE_2D
);
- gl
Color4f(1, 1, 1, 1
);
+
+ gl
VertexPointer(2, GL_FLOAT, 0, vertices
);
+ gl
DrawArrays(GL_TRIANGLE_STRIP, 0, sizeof(vertices)/sizeof(float)/2
);
}
else
{
}
else
{
@@
-362,11
+370,6
@@
Renderer::draw_filled_rect(const DrawingRequest& request)
float w = fillrectrequest->size.x;
float h = fillrectrequest->size.y;
float w = fillrectrequest->size.x;
float h = fillrectrequest->size.y;
- glDisable(GL_TEXTURE_2D);
- glColor4f(fillrectrequest->color.red, fillrectrequest->color.green,
- fillrectrequest->color.blue, fillrectrequest->color.alpha);
- glDisableClientState(GL_TEXTURE_COORD_ARRAY);
-
float vertices[] = {
x, y,
x+w, y,
float vertices[] = {
x, y,
x+w, y,
@@
-376,11
+379,11
@@
Renderer::draw_filled_rect(const DrawingRequest& request)
glVertexPointer(2, GL_FLOAT, 0, vertices);
glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
glVertexPointer(2, GL_FLOAT, 0, vertices);
glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
-
- glEnableClientState(GL_TEXTURE_COORD_ARRAY);
- glEnable(GL_TEXTURE_2D);
- glColor4f(1, 1, 1, 1);
}
}
+
+ glEnableClientState(GL_TEXTURE_COORD_ARRAY);
+ glEnable(GL_TEXTURE_2D);
+ glColor4f(1, 1, 1, 1);
}
void
}
void