From 9faf641bbc50aa8092a2770e96b5015091591b0c Mon Sep 17 00:00:00 2001 From: Kyle K Date: Thu, 7 Oct 2010 22:49:38 -0500 Subject: misc corrections --- glut/pyramid.c | 2 ++ sdl/pyramid.c | 10 ++++++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/glut/pyramid.c b/glut/pyramid.c index c7a7f45..9249b26 100644 --- a/glut/pyramid.c +++ b/glut/pyramid.c @@ -58,6 +58,8 @@ static void SetupRC() /* load texture */ glPixelStorei(GL_UNPACK_ALIGNMENT, 1); pBytes = gltLoadTGA("stone.tga", &iWidth, &iHeight, &iComponents, &eFormat); + if (!pBytes) + fprintf(stderr, "gltLoadTGA: failed to load texture!\n"); /* load texture image */ glTexImage2D(GL_TEXTURE_2D, 0, iComponents, iWidth, iHeight, 0, eFormat, diff --git a/sdl/pyramid.c b/sdl/pyramid.c index a8cb41b..c9859a8 100644 --- a/sdl/pyramid.c +++ b/sdl/pyramid.c @@ -1,4 +1,7 @@ /* pyramid.c + * + * notes: since lighting is enabled, we need to specify normals for + * each polygon face so the OpenGL can calculate e.g. how light reflects * */ @@ -74,6 +77,8 @@ static void SetupRC() /* load texture */ glPixelStorei(GL_UNPACK_ALIGNMENT, 1); pBytes = gltLoadTGA("stone.tga", &iWidth, &iHeight, &iComponents, &eFormat); + if (!pBytes) + fprintf(stderr, "gltLoadTGA: failed to load texture!\n"); /* load texture image */ glTexImage2D(GL_TEXTURE_2D, 0, iComponents, iWidth, iHeight, 0, eFormat, @@ -152,8 +157,8 @@ void processEvents() } } - /* XXX below code has the be below of the above */ - /* check for keys that are being constantly pressed */ + /* XXX below code has to be placed here */ + /* check for keys that are being constantly held */ if (keys_held[SDLK_w] || keys_held[SDLK_s] || keys_held[SDLK_a] || keys_held[SDLK_d]) { flag = !flag; @@ -170,6 +175,7 @@ static void draw_ground(void) GLfloat y = -0.4f; GLfloat iLine; + glLineWidth(1.0f); glBegin(GL_LINES); for (iLine = -fExtent; iLine <= fExtent; iLine += fStep) { -- cgit v1.2.3