aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/gl.c5
-rw-r--r--src/graphics/rectangle.c2
-rw-r--r--src/graphics/sprite.c4
-rw-r--r--src/graphics/text.c4
4 files changed, 7 insertions, 8 deletions
diff --git a/src/gl.c b/src/gl.c
index a06f75a..45280f1 100644
--- a/src/gl.c
+++ b/src/gl.c
@@ -1,6 +1,6 @@
#include "../include/mgl/gl.h"
#include <dlfcn.h>
-/*#include <GL/gl.h>*/
+#include <GL/gl.h>
#include <stdio.h>
typedef struct {
@@ -48,9 +48,8 @@ int mgl_gl_load(mgl_gl *self) {
{ &self->glHint, "glHint" },
{ &self->glBegin, "glBegin" },
{ &self->glEnd, "glEnd" },
- { &self->glColor3f, "glColor3f" },
{ &self->glVertex3f, "glVertex3f" },
- { &self->glColor4f, "glColor4f" },
+ { &self->glColor4ub, "glColor4ub" },
{ &self->glTexCoord2f, "glTexCoord2f" },
{ &self->glOrtho, "glOrtho" },
{ &self->glMatrixMode, "glMatrixMode" },
diff --git a/src/graphics/rectangle.c b/src/graphics/rectangle.c
index 4f2e40b..c6b2126 100644
--- a/src/graphics/rectangle.c
+++ b/src/graphics/rectangle.c
@@ -2,7 +2,7 @@
#include "../../include/mgl/mgl.h"
void mgl_rectangle_draw(mgl_context *context, mgl_rectangle *rect) {
- context->gl.glColor4f(rect->color.r, rect->color.g, rect->color.b, rect->color.a);
+ context->gl.glColor4ub(rect->color.r, rect->color.g, rect->color.b, rect->color.a);
context->gl.glBegin(GL_QUADS);
context->gl.glVertex3f(rect->position.x, rect->position.y, 0.0f);
context->gl.glVertex3f(rect->position.x + rect->size.x, rect->position.y, 0.0f);
diff --git a/src/graphics/sprite.c b/src/graphics/sprite.c
index 2b290bb..7bc9db1 100644
--- a/src/graphics/sprite.c
+++ b/src/graphics/sprite.c
@@ -4,7 +4,7 @@
void mgl_sprite_init(mgl_sprite *self, mgl_texture *texture, float x, float y) {
self->texture = texture;
- self->color = (mgl_color){ 1.0f, 1.0f, 1.0f, 1.0f };
+ self->color = (mgl_color){ 255, 255, 255, 255 };
self->position = (mgl_vec2f){ x, y };
self->scale = (mgl_vec2f){ 1.0f, 1.0f };
}
@@ -19,7 +19,7 @@ void mgl_sprite_set_color(mgl_sprite *self, mgl_color color) {
/* TODO: Cache texture bind to not bind texture if its already bound and do not bind texture 0 */
void mgl_sprite_draw(mgl_context *context, mgl_sprite *sprite) {
- context->gl.glColor4f(sprite->color.r, sprite->color.g, sprite->color.b, sprite->color.a);
+ context->gl.glColor4ub(sprite->color.r, sprite->color.g, sprite->color.b, sprite->color.a);
context->gl.glBindTexture(GL_TEXTURE_2D, sprite->texture->id);
context->gl.glBegin(GL_QUADS);
context->gl.glTexCoord2f(0.0f, 0.0f);
diff --git a/src/graphics/text.c b/src/graphics/text.c
index 9afc204..0aa33cf 100644
--- a/src/graphics/text.c
+++ b/src/graphics/text.c
@@ -5,7 +5,7 @@
int mgl_text_init(mgl_text *self, mgl_font *font, const char *text, float x, float y) {
self->font = font;
self->text = text;
- self->color = (mgl_color){ 1.0f, 1.0f, 1.0f, 1.0f };
+ self->color = (mgl_color){ 255, 255, 255, 255 };
self->position = (mgl_vec2f){ x, y };
return 0;
}
@@ -44,7 +44,7 @@ void mgl_text_draw(mgl_context *context, mgl_text *text) {
mgl_vec2f position = text->position;
position.y += text->font->size;
- context->gl.glColor4f(text->color.r, text->color.g, text->color.b, text->color.a);
+ context->gl.glColor4ub(text->color.r, text->color.g, text->color.b, text->color.a);
context->gl.glBindTexture(GL_TEXTURE_2D, text->font->texture.id);
context->gl.glBegin(GL_QUADS);
while(*str) {