   Sprites not shown on screen
  Hello, I have recently been attempting to program a simple game, on Mac OS X ,Xcode,(and not going to use wine for windows.h), and GLUT. I have also tried to implement a map loading system. The problem is, that the sprites that I have coded that are being loaded and drawn by the function that controls the map drawing, are not showing on screen. Might this just be a logic error in my programming? Here's the code:main.cpp:#include <GLUT/GLUT.h>#include <iostream>//#include <stdio.h>//#include <curses.h>#include "map.h"using namespace std;//Defines#define TEX_INTERNALGL_RGBA4#define TEX_FORMATGL_RGBA#define TEX_TYPEGL_UNSIGNED_SHORT_4_4_4_4void gfxInit(){glClearColor(0,0,0,0);gluOrtho2D(0,800,600,0);}void gfxDisplay(){int xPos, yPos;unsigned short *map;xPos = 100; yPos = 100;glClear(GL_COLOR_BUFFER_BIT);sprSet(charSprite,16,16);gfxDrawSprite(charSprite,xPos,yPos);map = loadMap("/Users/user/Documents/glut-test/map.txt");drawMap(map);glFlush();glutPostRedisplay();}int main(int argc, char ** argv){glutInit(&argc,argv);glutInitWindowSize(800,600);glutInitWindowPosition(10,50);glutInitDisplayMode(GLUT_SINGLE|GLUT_RGB);glutCreateWindow("GLUT Test");gfxInit();glutDisplayFunc(gfxDisplay);glutMainLoop();return EXIT_SUCCESS;}sprites.h:#include <iostream>#include <GLUT/glut.h>using namespace std;//Defines#define TEX_INTERNALGL_RGBA4#define TEX_FORMATGL_RGBA#define TEX_TYPEGL_UNSIGNED_SHORT_4_4_4_4//Colors (RGBA) Defines#define R 0xf30f#define W 0xffff#define X 0x0000#define G 0x5c6c#define B 0x111fint sprSet_var_xSize;int sprSet_var_ySize;void sprSet(GLvoid *tex, int xSize, int ySize){glTexImage2D(GL_TEXTURE_2D,0,TEX_INTERNAL,xSize,ySize,0,TEX_FORMAT,TEX_TYPE,tex);sprSet_var_xSize = xSize;sprSet_var_ySize = ySize;}void gfxDrawSprite(GLvoid *spr, int xPos, int yPos){int xSize = sprSet_var_xSize;int ySize = sprSet_var_ySize;glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_NEAREST);glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_NEAREST);glEnable(GL_TEXTURE_2D);glBegin(GL_QUADS);glTexCoord2f(0,0); glVertex2f(xPos,yPos);glTexCoord2f(1,0); glVertex2f(xPos+xSize,yPos);glTexCoord2f(1,1); glVertex2f(xPos+xSize,yPos+ySize);glTexCoord2f(0,1); glVertex2f(xPos,yPos+xSize);glEnd();glDisable(GL_TEXTURE_2D);}//Hardcoded sprites, using X,W,R,G,B// X = Black, W=White, R=Red, G=Green, B=Blueunsigned short charSprite[(16*16)] = {X,X,X,X,X,X,X,W,W,X,X,X,X,X,X,X,X,X,X,X,X,X,R,R,R,R,X,X,X,X,X,X,X,X,X,X,X,G,G,G,G,G,G,X,X,X,X,X,X,X,X,X,B,B,B,B,B,B,B,B,X,X,X,X,X,X,X,W,W,W,W,W,W,W,W,W,W,X,X,X,X,X,R,R,R,R,R,R,R,R,R,R,R,R,X,X,X,G,G,G,G,G,G,G,G,G,G,G,G,G,G,X,B,B,B,B,B,B,B,B,B,B,B,B,B,B,B,B,W,W,W,W,W,W,W,W,W,W,W,W,W,W,W,W,X,R,R,R,R,R,R,R,R,R,R,R,R,R,R,X,X,X,G,G,G,G,G,G,G,G,G,G,G,G,X,X,X,X,X,B,B,B,B,B,B,B,B,B,B,X,X,X,X,X,X,X,W,W,W,W,W,W,W,W,X,X,X,X,X,X,X,X,X,R,R,R,R,R,R,X,X,X,X,X,X,X,X,X,X,X,G,G,G,G,X,X,X,X,X,X,X,X,X,X,X,X,X,B,B,X,X,X,X,X,X,X,};unsigned short wallBlockSprite[(16*16)] = {R,R,R,R,R,R,R,R,R,R,R,R,R,R,R,R,R,W,W,W,W,W,W,W,W,W,W,W,W,W,W,R,R,W,W,W,W,W,W,W,W,W,W,W,W,W,W,R,R,W,W,W,W,W,W,W,W,W,W,W,W,W,W,R,R,W,W,W,W,W,W,W,W,W,W,W,W,W,W,R,R,W,W,W,W,W,W,W,W,W,W,W,W,W,W,R,R,W,W,W,W,W,W,W,W,W,W,W,W,W,W,R,R,W,W,W,W,W,W,W,W,W,W,W,W,W,W,R,R,W,W,W,W,W,W,W,W,W,W,W,W,W,W,R,R,W,W,W,W,W,W,W,W,W,W,W,W,W,W,R,R,W,W,W,W,W,W,W,W,W,W,W,W,W,W,R,R,W,W,W,W,W,W,W,W,W,W,W,W,W,W,R,R,W,W,W,W,W,W,W,W,W,W,W,W,W,W,R,R,W,W,W,W,W,W,W,W,W,W,W,W,W,W,R,R,W,W,W,W,W,W,W,W,W,W,W,W,W,W,W,R,W,W,W,W,W,W,W,W,W,W,W,W,W,W,W,};map.h:#include <iostream>#include <fstream>#include "sprites.h"#include <GLUT/glut.h>#include <math.h>using namespace std;unsigned short *loadMap(char *filename){ifstream inFile;unsigned short mapVar[256]; // A 16x16 map has 256 tiles (16^2)inFile.open(filename);if(!inFile){cerr << "Could not load file '%s'",filename;exit(1);}for(int count = 0; count < 256; count++){inFile >> mapVar[count];}inFile.close();return mapVar;}void drawMap(unsigned short *map){unsigned short mapvar;for(int count = 0; count < 16; count++){ //yfor(int count2 = 0; count2 < 16; count2++){ //xmapvar = map[((count*16)+count2)];if(mapvar == 'x'){ //ascii 'x'sprSet(wallBlockSprite,16,16);gfxDrawSprite(wallBlockSprite,((count2+1)*16), ((count+1)*16));cerr << "Sprite is x" << endl;}else{cerr << mapvar << endl;}}}}map.txt:xxxxxxxxxxxxxxxxxzzzzzzzzzzzzzzxxzzzzzzzzzzzzzzxxzzzzzzzzzzzzzzxxzzzzzzzzzzzzzzxxzzzzzzzzzzzzzzxxzzzzzzzzzzzzzzxxzzzzzzzzzzzzzzxxzzzzzzzzzzzzzzxxzzzzzzzzzzzzzzxxzzzzzzzzzzzzzzxxzzzzzzzzzzzzzzxxzzzzzzzzzzzzzzxxzzzzzzzzzzzzzzxxzzzzzzzzzzzzzzxxxxxxxxxxxxxxxxxWhat this should be doing is drawing the wallBlockSprite around the screen, and drawing the character sprite at 100,100. However, what this ends up doing is drawing the character sprite (at 100,100), and not drawing the wallBlockSprites around the edges, 16x16. All the files are in the same directory. If anyone could help me with this, I would appreciate it.   