I am trying to make a top view of a maze in a corner of the screen to let the player know where he is in the maze.
I though about updating each frame a global GLubyte array and associate it to a texture. I keep seeing a white rectangle instead of the map although (I have debugged it carefully) I am positively sure that the array contains the right RGB information.
this is the function that I call each frame:
void UpdateMap() {
// this gets the info from my data structure and updates the array “maskTex”
map->updateTextures();
int maskTexWidth = myWorld->getWidth() * MAP_CELL_SIZE;
int maskTexHeight = myWorld->getHeight() * MAP_CELL_SIZE;
glBindTexture(GL_TEXTURE_2D, mapMaskTex);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, maskTexWidth, maskTexHeight, 0, GL_RGB, GL_UNSIGNED_BYTE, maskTex);
}
What is wrong with this approach?
HELP!
F.
[This message has been edited by franz1999 (edited 04-17-2003).]
Originally posted by franz1999:
[b]I am trying to make a top view of a maze in a corner of the screen to let the player know where he is in the maze.
I though about updating each frame a global GLubyte array and associate it to a texture. I keep seeing a white rectangle instead of the map although (I have debugged it carefully) I am positively sure that the array contains the right RGB information.
this is the function that I call each frame:
void UpdateMap() {
// this gets the info from my data structure and updates the array “maskTex”
map->updateTextures();
int maskTexWidth = myWorld->getWidth() * MAP_CELL_SIZE;
int maskTexHeight = myWorld->getHeight() * MAP_CELL_SIZE;
glBindTexture(GL_TEXTURE_2D, mapMaskTex);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, maskTexWidth, maskTexHeight, 0, GL_RGB, GL_UNSIGNED_BYTE, maskTex);
}
What is wrong with this approach?
HELP!
F.
[This message has been edited by franz1999 (edited 04-17-2003).][/b]
Are your width and height a power of 2? If not, make them so. If so, call glGetError after glTexImage2D and see what error it gives you.
Originally posted by shinpaughp:
Are your width and height a power of 2? If not, make them so. If so, call glGetError after glTexImage2D and see what error it gives you.
I didn’t know that I HAD to make them power of 2… thanks!