Skip to content

Commit

Permalink
Corrected bugs...
Browse files Browse the repository at this point in the history
Set default raylib to use OpenGL 1.1 (compatibility issues on ATI cards)
  • Loading branch information
raysan5 committed Jul 23, 2014
1 parent ecb3c47 commit 56a7979
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 15 deletions.
Binary file modified release/win32-mingw/lib/libraylib.a
Binary file not shown.
2 changes: 1 addition & 1 deletion src/audio.c
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,7 @@ void PlaySound(Sound sound)
{
alSourcePlay(sound.source); // Play the sound

TraceLog(INFO, "Playing sound");
//TraceLog(INFO, "Playing sound");

// Find the current position of the sound being played
// NOTE: Only work when the entire file is in a single buffer
Expand Down
2 changes: 1 addition & 1 deletion src/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -882,7 +882,7 @@ static void LogoAnimation()

DrawRectangle(windowWidth/2 - 112, windowHeight/2 - 112, 224, 224, Fade(RAYWHITE, alpha));

DrawText(raylib, 356, 273, 50, Fade(BLACK, alpha));
DrawText(raylib, windowWidth/2 - 44, windowHeight/2 + 48, 50, Fade(BLACK, alpha));
}

EndDrawing();
Expand Down
2 changes: 1 addition & 1 deletion src/rlgl.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@

// Select desired OpenGL version
//#define USE_OPENGL_11
#define USE_OPENGL_33
//#define USE_OPENGL_33
//#define USE_OPENGL_ES2

//----------------------------------------------------------------------------------
Expand Down
28 changes: 17 additions & 11 deletions src/shapes.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@

#include "rlgl.h" // raylib OpenGL abstraction layer to OpenGL 1.1, 3.3+ or ES2

// Security check in case no USE_OPENGL_* defined
#if !defined(USE_OPENGL_11) && !defined(USE_OPENGL_33) && !defined(USE_OPENGL_ES2)
#define USE_OPENGL_11
#endif

//----------------------------------------------------------------------------------
// Defines and Macros
//----------------------------------------------------------------------------------
Expand Down Expand Up @@ -180,7 +185,7 @@ 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)
{
/*
#ifdef USE_OPENGL_11
rlBegin(RL_TRIANGLES);
rlColor4ub(color.r, color.g, color.b, color.a);

Expand All @@ -192,10 +197,10 @@ void DrawRectangleV(Vector2 position, Vector2 size, Color color)
rlVertex2i(position.x + size.x, position.y + size.y);
rlVertex2i(position.x + size.x, position.y);
rlEnd();
*/
#endif

#if defined(USE_OPENGL_33) || defined(USE_OPENGL_ES2)
// NOTE: This shape uses QUADS to avoid drawing order issues (view rlglDraw)

rlEnableTexture(1); // Default white texture

rlBegin(RL_QUADS);
Expand All @@ -216,24 +221,25 @@ void DrawRectangleV(Vector2 position, Vector2 size, Color color)
rlEnd();

rlDisableTexture();
#endif
}

// Draw rectangle outline
void DrawRectangleLines(int posX, int posY, int width, int height, Color color)
{
rlBegin(RL_LINES);
rlColor4ub(color.r, color.g, color.b, color.a);
rlVertex2i(posX, posY);
rlVertex2i(posX + width - 1, posY);
rlVertex2i(posX + 1, posY + 1);
rlVertex2i(posX + width, posY + 1);

rlVertex2i(posX + width - 1, posY);
rlVertex2i(posX + width - 1, posY + height - 1);
rlVertex2i(posX + width, posY + 1);
rlVertex2i(posX + width, posY + height);

rlVertex2i(posX + width - 1, posY + height - 1);
rlVertex2i(posX, posY + height - 1);
rlVertex2i(posX + width, posY + height);
rlVertex2i(posX + 1, posY + height);

rlVertex2i(posX, posY + height - 1);
rlVertex2i(posX, posY);
rlVertex2i(posX + 1, posY + height);
rlVertex2i(posX + 1, posY + 1);
rlEnd();
}

Expand Down
7 changes: 6 additions & 1 deletion src/textures.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@

#include "rlgl.h" // raylib OpenGL abstraction layer to OpenGL 1.1, 3.3+ or ES2

// Security check in case no USE_OPENGL_* defined
#if !defined(USE_OPENGL_11) && !defined(USE_OPENGL_33) && !defined(USE_OPENGL_ES2)
#define USE_OPENGL_11
#endif

//----------------------------------------------------------------------------------
// Defines and Macros
//----------------------------------------------------------------------------------
Expand Down Expand Up @@ -297,7 +302,7 @@ Texture2D LoadTexture(const char *fileName)
}
else
{
#ifdef USE_OPENGL_33
#if defined(USE_OPENGL_33) || defined(USE_OPENGL_ES2)
texture.id = rlglLoadCompressedTexture(image.data, image.width, image.height, image.mipmaps, image.compFormat);
#endif
}
Expand Down

0 comments on commit 56a7979

Please sign in to comment.