Okay i see, but nothing happends when I change the Z value, all my tiles have z = 1.0f and my ship have a z = -1.0f but the tiles are "closer" to the camera and ship doesn't show.
And also when i enable Depth-test and clear the depth-buffer-bit the transparent blending stops.
Initialize()
for(int y = 0; y < tm_dim.y; y++)
{
for(int x = 0; x < tm_dim.x; x++)
{
u32 i = x + (tm_dim.x * y);
int rx = CJ_RandIRange(7, 9, CJ_RAND_INCLUDE);
int ry = CJ_RandIRange(8, 10, CJ_RAND_INCLUDE);
game->tilemap[i].pos = v3f(0.0f + (tp.x * x), 0.0f + (tp.y * y), 1.0f);
game->tilemap[i].size = v3f(tp.x, tp.y, 0.0f);
game->tilemap[i].col = v4f(1.0f, 1.0f, 1.0f, 1.0f);
game->tilemap[i].tcoord_p = game->texture_map[0][i];//v2f(rx * tp.x, 1.0f - (ry * tp.y));
game->tilemap[i].tcoord_sz = v2f(1.0f * tp.x, 1.0f * tp.y);
}
}
game->ship.sprite = Push(game, SPRITE, 1);
game->ship.sprite->pos = v3f(0.5f, 0.5f, -1.0f);
game->ship.sprite->size = v3f(0.1f, 0.15f, 0.0f);
game->ship.sprite->col = v4f(1.0f, 1.0f, 1.0f, 1.0f);
game->ship.sprite->tcoord_p = v2f(5.0f * tp.x, 1.0f - (2.0f * tp.y));
game->ship.sprite->tcoord_sz = v2f(1.0f * tp.x, 1.0f * tp.y);
game->ship.hitpoints = 10;
Updating the vbo
void UpdateVBO_SPRITE(CJ_VBO *vbo, GAME_HANDLER *game)
{
CJ_VTX_SPRITE *pVertex = (CJ_VTX_SPRITE*)vbo->base;
SPRITE *spr = (SPRITE*)game->sprite_batch.data;
// Updating the data that's sent to the VBO
for(u32 i = 0; i < game->sprite_batch.count; i++)
{
//V2f pos = spr[i].pos;
V3f pos = spr[i].pos;
V3f size = spr[i].size;
V4f col = spr[i].col;
V2f tCoord_p = spr[i].tcoord_p;
V2f tCoord_sz = spr[i].tcoord_sz;
pVertex[(i * 4) + 0].pos = v3f(pos.x, pos.y, pos.z);
pVertex[(i * 4) + 1].pos = v3f(pos.x, pos.y + size.y, pos.z);
pVertex[(i * 4) + 2].pos = v3f(pos.x + size.x, pos.y + size.y, pos.z);
pVertex[(i * 4) + 3].pos = v3f(pos.x + size.x, pos.y, pos.z);
pVertex[(i * 4) + 0].col = col;
pVertex[(i * 4) + 1].col = col;
pVertex[(i * 4) + 2].col = col;
pVertex[(i * 4) + 3].col = col;
pVertex[(i * 4) + 0].tCoord = v2f(tCoord_p.x, tCoord_p.y);
pVertex[(i * 4) + 1].tCoord = v2f(tCoord_p.x, tCoord_p.y + tCoord_sz.y);
pVertex[(i * 4) + 2].tCoord = v2f(tCoord_p.x + tCoord_sz.x, tCoord_p.y + tCoord_sz.y);
pVertex[(i * 4) + 3].tCoord = v2f(tCoord_p.x + tCoord_sz.y, tCoord_p.y);
}
}