X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=scene.c;h=9e434eb35cf6ee26eb00921f7fdbaa4b9f30f0b1;hb=8a3b27cf7fd3d88a2882449eb0ea8b2c21c7bfae;hp=c546975575f95eeaded7137d644d5d0da4bb476c;hpb=1974078227af3b4da18ff6813f9cf5ed231d9205;p=atyndall%2Fcits2231.git diff --git a/scene.c b/scene.c index c546975..9e434eb 100644 --- a/scene.c +++ b/scene.c @@ -1,9 +1,7 @@ -// compile this program using: -// gcc -O3 -Wall -std=c99 -o scene scene.c bitmap.c -lglut -// Or, with cygwin: (-mno-cygwin is only so the executable runs from windows) -// gcc -mno-cygwin -O3 -Wall -std=c99 -o scene scene.c bitmap.c -lglut32 -lglu32 -lopengl32 -// Or, use make via the supplied Makefile: (For cygwin, install the package for make) -// make +/** + * CITS2231 Graphics Scene Editor + * @author Ashley Tyndall (20915779) + */ #include #include @@ -460,13 +458,44 @@ void makeMenu() { glutAttachMenu(GLUT_RIGHT_BUTTON); } +/** + * Called when window is resized + * @param width New width + * @param height New height + */ +void windowReshape(int width, int height) { + glViewport(0, 0, (GLsizei)width, (GLsizei)height); + printf("Width: %d, height: %d\n", width, height); + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + gluPerspective( 60 * ((GLfloat)width/(GLfloat)height), (GLfloat)width/(GLfloat)height, 0.1, 1000.0); + glMatrixMode(GL_MODELVIEW); + +} + +/** + * Called when mouse event occurs + * @param btn Mouse button + * @param state State of mouse button + * @param x Mouse x position + * @param y Mouse y position + */ +void mouse(int btn, int state, int x, int y) { + +} + /** * Display function */ void display() { - // You probably want to change both of the following. - glClear(GL_COLOR_BUFFER_BIT); - glFlush(); + glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); + glLoadIdentity(); + + glTranslatef(0.0f,0.0f,-10.0f); // Move into the Screen 10.0 + + glutSolidTeapot(1); + + glutSwapBuffers(); } /** @@ -488,12 +517,23 @@ int main(int argc, char **argv) { for(int i=0; i