diff options
| author | Ray <raysan5@gmail.com> | 2016-03-16 19:10:19 +0100 |
|---|---|---|
| committer | Ray <raysan5@gmail.com> | 2016-03-16 19:10:19 +0100 |
| commit | 95c1bf954423f00a4fb8c6dc72820c2174d62dfa (patch) | |
| tree | d0cf0bf88dfc4ff800408c117f9b9aaebdfe64c2 /src | |
| parent | db4585b3e23cd3c5aa87da21aedc36fd8be21739 (diff) | |
| download | raylib-95c1bf954423f00a4fb8c6dc72820c2174d62dfa.tar.gz raylib-95c1bf954423f00a4fb8c6dc72820c2174d62dfa.zip | |
Removed previous change that introduced a bug
Diffstat (limited to 'src')
| -rw-r--r-- | src/shapes.c | 45 |
1 files changed, 36 insertions, 9 deletions
diff --git a/src/shapes.c b/src/shapes.c index 46095d11..7e3b5634 100644 --- a/src/shapes.c +++ b/src/shapes.c @@ -180,17 +180,44 @@ void DrawRectangleGradient(int posX, int posY, int width, int height, Color colo // Draw a color-filled rectangle (Vector version) void DrawRectangleV(Vector2 position, Vector2 size, Color color) { - rlBegin(RL_TRIANGLES); - rlColor4ub(color.r, color.g, color.b, color.a); + if (rlGetVersion() == OPENGL_11) + { + rlBegin(RL_TRIANGLES); + rlColor4ub(color.r, color.g, color.b, color.a); - rlVertex2i(position.x, position.y); - rlVertex2i(position.x, position.y + size.y); - rlVertex2i(position.x + size.x, position.y + size.y); + rlVertex2i(position.x, position.y); + rlVertex2i(position.x, position.y + size.y); + rlVertex2i(position.x + size.x, position.y + size.y); - rlVertex2i(position.x, position.y); - rlVertex2i(position.x + size.x, position.y + size.y); - rlVertex2i(position.x + size.x, position.y); - rlEnd(); + rlVertex2i(position.x, position.y); + rlVertex2i(position.x + size.x, position.y + size.y); + rlVertex2i(position.x + size.x, position.y); + rlEnd(); + } + else if ((rlGetVersion() == OPENGL_33) || (rlGetVersion() == OPENGL_ES_20)) + { + // NOTE: This shape uses QUADS to avoid drawing order issues (view rlglDraw) + rlEnableTexture(whiteTexture); // Default white texture + + rlBegin(RL_QUADS); + rlColor4ub(color.r, color.g, color.b, color.a); + rlNormal3f(0.0f, 0.0f, 1.0f); + + rlTexCoord2f(0.0f, 0.0f); + rlVertex2f(position.x, position.y); + + rlTexCoord2f(0.0f, 1.0f); + rlVertex2f(position.x, position.y + size.y); + + rlTexCoord2f(1.0f, 1.0f); + rlVertex2f(position.x + size.x, position.y + size.y); + + rlTexCoord2f(1.0f, 0.0f); + rlVertex2f(position.x + size.x, position.y); + rlEnd(); + + rlDisableTexture(); + } } // Draw rectangle outline |
