X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=scene.c;h=21b3933802ad8f51c70e79c27fdc50f8818014e9;hb=817524e0f062d8f652f4dd6efa375bb97a64f2af;hp=c546975575f95eeaded7137d644d5d0da4bb476c;hpb=1974078227af3b4da18ff6813f9cf5ed231d9205;p=atyndall%2Fcits2231.git diff --git a/scene.c b/scene.c index c546975..21b3933 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,43 @@ 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, 1, 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 +516,23 @@ int main(int argc, char **argv) { for(int i=0; i