diff options
author | Kyle K <kylek389@gmail.com> | 2010-10-07 22:49:38 -0500 |
---|---|---|
committer | Kamil Kaminski <kamilkss@gmail.com> | 2010-10-07 22:49:38 -0500 |
commit | 9faf641bbc50aa8092a2770e96b5015091591b0c (patch) | |
tree | 80b37710113053cd2d3ce8b29e1d377ad465a886 | |
parent | 31b833b52d2d0047596a1d55cdd86e3427a36a6e (diff) | |
download | GLPyramid-9faf641bbc50aa8092a2770e96b5015091591b0c.tar.gz GLPyramid-9faf641bbc50aa8092a2770e96b5015091591b0c.tar.bz2 GLPyramid-9faf641bbc50aa8092a2770e96b5015091591b0c.zip |
misc corrections
-rw-r--r-- | glut/pyramid.c | 2 | ||||
-rw-r--r-- | 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,5 +1,8 @@ /* 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 + * */ #include <SDL/SDL.h> @@ -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) { |