Sign in to follow this  
Ipito

Problem displaying model in OpenGL

Recommended Posts

I'm working my way through some OpenGL tutorials, and am having some problems getting the model to display. The following fragment works: void display() { // display callback, clear frame buffer and z buffer first glClearColor(0.0, 0.0, 0.0, 1.0); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT ); // // Set up projection here // glMatrixMode(GL_PROJECTION); glLoadIdentity(); glOrtho( -2.0, 2.0, -2, 2.0, -100.0, 100.0 ); // // set modelview transform // glMatrixMode(GL_MODELVIEW); glLoadIdentity(); glScalef(0.5, 0.5, 0.5); drawModel(); glFlush(); glutSwapBuffers(); } This code displays the desired model at 1/2 size. However, when I replace the glScalef with the code below: void display() { // display callback, clear frame buffer and z buffer first glClearColor(0.0, 0.0, 0.0, 1.0); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT ); // // Set up projection here // glMatrixMode(GL_PROJECTION); glLoadIdentity(); glOrtho( -2.0, 2.0, -2, 2.0, -100.0, 100.0 ); // // set modelview transform // glMatrixMode(GL_MODELVIEW); glLoadIdentity(); float scalingMatrix[16]; memset(scalingMatrix, 0, sizeof(float) * 16); scalingMatrix[0] = 0.5; scalingMatrix[5] = 0.5; scalingMatrix[10] = 0.5; glLoadMatrixf(scalingMatrix); drawModel(); glFlush(); glutSwapBuffers(); } it doesn't display anything at all. I'm quite new to OpenGL, so I'm not sure if there is a basic step that I've missed or done wrong, any advice would be apprciated. Thanks

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this