This commit is contained in:
Tyler McGurrin 2024-11-21 19:53:58 -05:00
parent ab2148b12e
commit 0a7d6dae0d
3 changed files with 32 additions and 6 deletions

View File

@ -7,10 +7,10 @@ SRC_DIR=src
all: main all: main
main: always main: always
$(CC) -g $(SRC_DIR)/main.c -o $(BUILD_DIR)/main $(CC) -g $(SRC_DIR)/main.c -o $(BUILD_DIR)/main -lglut -lGL -lGLU -lXi -lXmu
chmod +x $(BUILD_DIR)/main chmod +x $(BUILD_DIR)/main
always: always:
mkdir -p $(BUILD_DIR) mkdir -p $(BUILD_DIR)
clean: clean:
rm -rf $(BUILD_DIR) rm -rf $(BUILD_DIR)

Binary file not shown.

View File

@ -6,16 +6,42 @@
//include files //include files
#include <stdio.h> #include <stdio.h>
#include <stdint.h> #include <stdint.h>
#include <GL/gl.h> #include <GL/glu.h>
#include <GL/glut.h> #include <GL/glut.h>
//Definitions and Vars //Definitions and Vars
#define true 1; #define true 1;
#define false 0; #define false 0;
void ColourInit() {
glClearColor(0,0,0,1);
glColor3f(0,1,0);
}
int main() void Draw()
{ {
glutInit; glClear(GL_COLOR_BUFFER_BIT);
glBegin(GL_LINE_LOOP); //use GL_POLYGON for solid object, GL_LINE_LOOP for wireframe and GL_POINTS for points
glVertex2f(-0.5,0.5);
glVertex2f(0.5,0.5);
glVertex2f(0.5,-0.5);
glVertex2f(-0.5,-0.5);
glEnd();
glFlush();
}
int main(int argC, char *argV[])
{
glutInit(&argC,argV);
//glutInitWindowPosition(0,0); //Readd this later (TM)
glutInitWindowSize(800,600);
glutInitDisplayMode(GLUT_RGB | GLUT_SINGLE);
glutCreateWindow("OpenGL Test");
ColourInit();
glutDisplayFunc(Draw);
glutMainLoop();
return true; return true;
} }