From 194e34e849975f23acfff5e8804f850cbc2c5793 Mon Sep 17 00:00:00 2001 From: Alexander Popov Date: Sat, 17 Oct 2015 15:03:57 +0300 Subject: [PATCH] fixes --- Makefile | 4 ++-- main.c | 9 ++++----- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/Makefile b/Makefile index 5aa9300..e6e7ede 100644 --- a/Makefile +++ b/Makefile @@ -1,10 +1,10 @@ CC=gcc +LDFLAGS= -lglfw -lGL OUT=run all: lodepng.o $(CC) -O2 -o $(OUT) \ - lodepng.o \ - main.c -lglfw -lGL -lGLU + main.c lodepng.o $(LDFLAGS) lodepng.o: $(CC) -c ./deps/lodepng/lodepng.c diff --git a/main.c b/main.c index 27f151d..b04d9bc 100644 --- a/main.c +++ b/main.c @@ -14,8 +14,6 @@ int main(int argc, char const *argv[]) if (!glfwInit()) return -1; - glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 1); - glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 4); glfwWindowHint(GLFW_RESIZABLE, GL_FALSE); window = glfwCreateWindow(400, 400, "Example Lodepng", NULL, NULL); @@ -38,7 +36,7 @@ int main(int argc, char const *argv[]) unsigned char *image; unsigned int width, height; - const char *filename = argc > 1 ? argv[1] : "textures/Nav.png"; + const char *filename = argc > 1 ? argv[1] : "textures/nav.png"; error = lodepng_decode32_file(&image, &width, &height, filename); if (error) @@ -56,17 +54,18 @@ int main(int argc, char const *argv[]) glLoadIdentity(); glOrtho(0, 400, 400, 0, -1, 1); glMatrixMode(GL_MODELVIEW); - glLoadIdentity(); glClearColor(1, 1, 1, 0); glClear(GL_COLOR_BUFFER_BIT); + glLoadIdentity(); + glBindTexture(GL_TEXTURE_2D, texture); glEnable(GL_TEXTURE_2D); glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_DECAL); glColor3ub(255, 235, 115); - glBegin(GL_QUADS); + glBegin(GL_POLYGON); glTexCoord2f(0, 0); glVertex2f(50, 50); glTexCoord2f(1, 0); glVertex2f(350, 50); glTexCoord2f(1, 1); glVertex2f(350, 350);