View Full Version : billboard textures: tiling problems in isometric lib

06-13-2002, 03:33 PM
I'm writing an isometric tile lib, and the problem I'm having is that the tiles, when placed right next to each other, don't show a smooth, continuous image. Instead, they appear as separate tiles. When I ran my app full screen in 640x480, I was able to see that on the edges of the tiles (I'm using just 1 tile for the whole map for testing purposes), it looked like some kind of blending had occurred. So I'm guessing my problem is in my texture mapping. Here's how the texture mapping gets set up:

(btw, I've toyed with _min_filter and _max_filter, using pretty much every single GL_... option, not much variance)

glGenTextures(1, &tex_id); glBindTexture(GL_TEXTURE_2D, tex_id);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, _min_filter);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, _max_filter);
gluBuild2DMipmaps(GL_TEXTURE_2D, GL_RGBA, tile_width, tile_height, GL_RGBA, GL_UNSIGNED_BYTE, gfx_data);

//create the display list
glNewList(dl, GL_COMPILE);
glTranslatef(tile_width/2, 0, 0);
glBindTexture(GL_TEXTURE_2D, tex_id);
glTexCoord2i(0, 0); glVertex2i(0, 0);
glTexCoord2i(1, 0); glVertex2i(tile_width, 0);
glTexCoord2i(1, 1); glVertex2i(tile_width, tile_height);
glTexCoord2i(0, 1); glVertex2i(0, tile_height);

As for why I'm using mipmapping...it's cause whenever I don't, I just get a solid white rectangle. When I don't use mipmapping, I use this function instead of the gluBuild2DMipMaps function:

glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, tile_width, tile_height, 0, GL_RGBA, GL_UNSIGNED_BYTE, gfx_data);

Oh ya, and I'm using alpha value of 0 for transparency, 255 for opaque and a blend function of glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);

I'm guessing that one or more of the following is my culprit:

1. Mipmapping is bad
2. Alpha blending is somehow screwing things up
3. I'm not using the correct GL_ value for minification/magnification
4. I'm just totally screwing up the texture mapping

I'd really appreciate anyone's thoughts, this is realllly bugging me.