2d box
This commit is contained in:
parent
ab2148b12e
commit
0a7d6dae0d
4
Makefile
4
Makefile
@ -7,10 +7,10 @@ SRC_DIR=src
|
||||
all: main
|
||||
|
||||
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
|
||||
always:
|
||||
mkdir -p $(BUILD_DIR)
|
||||
|
||||
clean:
|
||||
rm -rf $(BUILD_DIR)
|
||||
rm -rf $(BUILD_DIR)
|
||||
|
||||
BIN
build/main
BIN
build/main
Binary file not shown.
34
src/main.c
34
src/main.c
@ -6,16 +6,42 @@
|
||||
//include files
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
#include <GL/gl.h>
|
||||
#include <GL/glu.h>
|
||||
#include <GL/glut.h>
|
||||
|
||||
//Definitions and Vars
|
||||
#define true 1;
|
||||
#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;
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user