Well the z-buffering should work by default (unless it's disabled somewhere else) try calling
Code:
glEnable (GL_DEAPTH_TEST);
before rendering the sprites and test if it helps. One thing to note thought, the blending might cause problems if you enable deapth testing, a sprite that is rendered before another sprite cant blend with the following one (this is a limitation of OpenGL and DirectX and has nothing to do with Phoenix). If you only has one color transparency you can avoid this by calling
Code:
glAphaFunct(GL_GREATER, 0.1);
glEnable(GL_ALPHA_TEST);
and this will skip all transparent pixels further up in the opengl pipeline.
The reason behind the sprite layers (wich was a new adition to the 1.0 release, the betas had one texture per sprite) is simply a speed matter, you can render 10x times the sprites by batching sprites into a larger spriteset instead of needing to rebind the texture for each sprite.
And for a hint on how to render one image per sprite:
Code:
//------------------------------------------------------------------------------
procedure TMyAnimatedSprite.Render;
var Image: TPHXImage; // Move to private decleration
begin
Image:= ImageList.Find('MyImage'); // move to constructor
glPushAtrib(GL_TEXTURE_BIT); // Save the binded texture
Image.Bind;
glPushMatrix();
glTranslatef(WorldPosition.X, WorldPosition.Y, WorldPosition.Z);
glCallList(Image.DisplayList + PatternIndex + 1);
glPopMatrix();
glPopAttrib();
end;
Bookmarks