From f49335bf37f6b810ef48f90b323d37efc1a0d760 Mon Sep 17 00:00:00 2001 From: josh Date: Sun, 3 Jun 2007 03:35:41 +0000 Subject: [PATCH] stl: fixed when the display list was being generated git-svn-id: svn://anubis/misc/stl@8 bd8a9e45-a331-0410-811e-c64571078777 --- stl-viewer.c | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/stl-viewer.c b/stl-viewer.c index 9fe0cc6..0df8572 100644 --- a/stl-viewer.c +++ b/stl-viewer.c @@ -41,7 +41,7 @@ void reshape(GLsizei w, GLsizei h) gluPerspective(60.0, 1.0*(GLfloat)w/(GLfloat)h, 1.0, 10000.0); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); - glTranslatef(0.0, 0.0, -30); + glTranslatef(0.0, 0.0, -3); } int main(int argc, char *argv[]) @@ -58,7 +58,6 @@ int main(int argc, char *argv[]) fprintf(stderr, "Error loading '%s'\n", argv[1]); return -2; } - stldl = buildDL(); if (SDL_Init(SDL_INIT_VIDEO)) { @@ -77,6 +76,7 @@ int main(int argc, char *argv[]) } SDL_WM_SetCaption(argv[0], argv[0]); + stldl = buildDL(); init(); reshape(WIDTH, HEIGHT); display(); @@ -89,6 +89,16 @@ int main(int argc, char *argv[]) { if (event.key.keysym.sym == SDLK_ESCAPE) break; + else if + } + else if (event.type == SDL_MOUSEDOWN) + { + } + else if (event.type == SDL_MOUSEUP) + { + } + else if (event.type == SDL_MOUSEMOTION) + { } } @@ -106,6 +116,7 @@ GLuint buildDL(void) GLuint dl = glGenLists(1); glNewList(dl, GL_COMPILE); glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, default_color); + glBegin(GL_TRIANGLES); for (i = 0; i < n_faces; i++) { #if 0 @@ -122,14 +133,18 @@ GLuint buildDL(void) default_color); #endif stl_get_face_normal(stl, i, normal); - printf("normal: %f, %f, %f\n", - normal[0], - normal[1], - normal[2]); +// printf("normal: %f, %f, %f\n", +// normal[0], normal[1], normal[2]); glNormal3fv(normal); int j; for (j = 0; j < 3; j++) + { +// printf("vertex: %f, %f, %f\n", +// stl_face(stl, i).vertices[j][0], +// stl_face(stl, i).vertices[j][1], +// stl_face(stl, i).vertices[j][2]); glVertex3fv(stl_face(stl, i).vertices[j]); + } } glEnd(); glEndList();