Skip to content

Fix example and add Makefile #27

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
example
example.*
23 changes: 23 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
CC ?= gcc
INSTALL ?= install
RM ?= rm
PREFIX ?= /usr/local

.PHONY: all
all: example

example: examples/simple.c
$(CC) $(CPPFLAGS) $(CFLAGS) -I. $< -o example -lglfw -lm

.PHONY: clean
clean:
$(RM) example

.PHONY: install
install: gltext.h
$(INSTALL) $< $(PREFIX)/include/

.PHONY: uninstall
uninstall: gltext.h
$(RM) $(PREFIX)/include/$<

7 changes: 4 additions & 3 deletions examples/simple.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,10 @@

#include <math.h>

#include <glad/glad.h> /* https://github.com/Dav1dde/glad */
#define GLAD_GL_IMPLEMENTATION
#include <glad/gl.h> /* https://github.com/Dav1dde/glad */
#define GLFW_INCLUDE_NONE
#include <GLFW/glfw3.h> /* https://github.com/glfw/glfw */

#define GLT_IMPLEMENTATION
#include "gltext.h" /* https://github.com/vallentin/glText */

Expand Down Expand Up @@ -52,7 +53,7 @@ int main(int argc, char *argv[])
glfwShowWindow(window);
glfwMakeContextCurrent(window);

if (!gladLoadGLLoader((GLADloadproc)glfwGetProcAddress))
if (!gladLoadGL((GLADloadfunc)glfwGetProcAddress))
{
fprintf(stderr, "Failed to load OpenGL functions and extensions\n");
glfwTerminate();
Expand Down