camera position update
git-svn-id: svn://anubis/misc/sierpinski-gtk@253 bd8a9e45-a331-0410-811e-c64571078777
This commit is contained in:
parent
4ae50b97c8
commit
58ff70113a
@ -45,7 +45,7 @@ void SierpinskiDA::regenerate(int npts)
|
|||||||
glBegin(GL_POINTS);
|
glBegin(GL_POINTS);
|
||||||
|
|
||||||
double pt[3];
|
double pt[3];
|
||||||
double r = rand() / RAND_MAX;
|
double r = rand() / (double) RAND_MAX;
|
||||||
for (int i = 0; i < 3; i++)
|
for (int i = 0; i < 3; i++)
|
||||||
{
|
{
|
||||||
pt[i] = pts[0][i] + r * pts[1][i] - pts[0][i];
|
pt[i] = pts[0][i] + r * pts[1][i] - pts[0][i];
|
||||||
@ -89,8 +89,8 @@ bool SierpinskiDA::draw()
|
|||||||
gluPerspective(60, get_width()/(double)get_height(), 0.01, 1000.0);
|
gluPerspective(60, get_width()/(double)get_height(), 0.01, 1000.0);
|
||||||
glMatrixMode(GL_MODELVIEW);
|
glMatrixMode(GL_MODELVIEW);
|
||||||
glLoadIdentity();
|
glLoadIdentity();
|
||||||
gluLookAt(0, -3, 1,
|
gluLookAt(0, -3, 1.5,
|
||||||
0, 0, 0.7,
|
0, 0, 1,
|
||||||
0, 0, 1);
|
0, 0, 1);
|
||||||
|
|
||||||
glCallList(m_dl);
|
glCallList(m_dl);
|
||||||
@ -134,10 +134,13 @@ void SierpinskiDA::on_realize()
|
|||||||
|
|
||||||
glViewport(0, 0, get_width(), get_height());
|
glViewport(0, 0, get_width(), get_height());
|
||||||
m_dl = glGenLists(1);
|
m_dl = glGenLists(1);
|
||||||
// glEnable(GL_LIGHTING);
|
glEnable(GL_DEPTH_TEST);
|
||||||
// glEnable(GL_LIGHT0);
|
#if 0
|
||||||
// float color[] = {1, 1, 1, 1};
|
glEnable(GL_LIGHTING);
|
||||||
// glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, color);
|
glEnable(GL_LIGHT0);
|
||||||
|
float color[] = {1, 1, 1, 1};
|
||||||
|
glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, color);
|
||||||
|
#endif
|
||||||
glColor3f(1, 1, 1);
|
glColor3f(1, 1, 1);
|
||||||
|
|
||||||
gl_end();
|
gl_end();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user