2d box
This commit is contained in:
parent
ab2148b12e
commit
0a7d6dae0d
2
Makefile
2
Makefile
@ -7,7 +7,7 @@ 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)
|
||||||
|
|||||||
BIN
build/main
BIN
build/main
Binary file not shown.
32
src/main.c
32
src/main.c
@ -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;
|
||||||
}
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user