fixed display problem with gluPerspective() (aspect ratio doing integer division)
git-svn-id: svn://anubis/misc/sierpinski-gtk@249 bd8a9e45-a331-0410-811e-c64571078777
This commit is contained in:
parent
6ab808e73a
commit
78734bad16
@ -65,22 +65,14 @@ bool SierpinskiDA::draw()
|
||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
glLoadIdentity();
|
||||
gluPerspective(60, get_width()/get_height(), 0.01, 1000.0);
|
||||
gluPerspective(60, get_width()/(double)get_height(), 0.01, 1000.0);
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
glLoadIdentity();
|
||||
gluLookAt(0, -2, 0,
|
||||
0, 0, 0,
|
||||
gluLookAt(0, -3, 1,
|
||||
0, 0, 0.7,
|
||||
0, 0, 1);
|
||||
|
||||
glCallList(m_dl);
|
||||
glBegin(GL_QUADS);
|
||||
glColor3f(1, 1, 1);
|
||||
glNormal3f(0, -1, 0);
|
||||
glVertex3f(1, 0, 1);
|
||||
glVertex3f(-1, 0, 1);
|
||||
glVertex3f(-1, 0, -1);
|
||||
glVertex3f(1, 0, -1);
|
||||
glEnd();
|
||||
|
||||
if (get_gl_window()->is_double_buffered())
|
||||
get_gl_window()->swap_buffers();
|
||||
|
@ -34,7 +34,7 @@ int main(int argc, char * argv[])
|
||||
}
|
||||
|
||||
Gtk::Window mw;
|
||||
mw.set_default_size(400, 500);
|
||||
mw.set_default_size(400, 420);
|
||||
|
||||
Gtk::VBox vbox;
|
||||
SierpinskiDA da(glconfig);
|
||||
@ -43,4 +43,6 @@ int main(int argc, char * argv[])
|
||||
mw.show_all();
|
||||
|
||||
Gtk::Main::run(mw);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user