Corrected bug with drawing order
We have three vertex buffers: lines, triangles and quads for textures. Drawing in a desired order could become a nighmare... noww it seems it works prety well...
This commit is contained in:
parent
0b03431c95
commit
ecb3c47704
4 changed files with 37 additions and 11 deletions
25
src/shapes.c
25
src/shapes.c
|
@ -180,6 +180,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)
|
||||
{
|
||||
/*
|
||||
rlBegin(RL_TRIANGLES);
|
||||
rlColor4ub(color.r, color.g, color.b, color.a);
|
||||
|
||||
|
@ -191,6 +192,30 @@ 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();
|
||||
*/
|
||||
|
||||
// NOTE: This shape uses QUADS to avoid drawing order issues (view rlglDraw)
|
||||
|
||||
rlEnableTexture(1); // Default white texture
|
||||
|
||||
rlBegin(RL_QUADS);
|
||||
rlColor4ub(color.r, color.g, color.b, color.a);
|
||||
rlNormal3f(0.0f, 0.0f, 1.0f); // Normal Pointing Towards Viewer
|
||||
|
||||
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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue