I’ve completed another simple component which will be used in the development of my SDL.Net game. While loading and rendering textures is not exactly a complex task, especially with the advantages that .Net provides for the loading of image data, it is none-the-less an important aspect to any application that uses 3d rendering.
Heres a screenshot of the latest running.
Get the Source code : http://cc.borland.com/item.aspx?id=23959
The new file is TextureMap.pas, and it includes the following things. The singleton class TextureResource, which loads and manages textures in an instance of any Delphi.Net application. The function DrawTexturedQuad which will draw a quad on the screen with the given texture, and also draw it either masked or unmasked.
A quick overview of how the TextureResource class works. It has only two public functions: get() which retreives the singleton instance, and Texture(String) which retreives the OpenGl ID of the texture. TextureResource stored loaded textures into a hashtable to prevent loading any texture file twice. The first time Texture is called on an unloaded image the texture is loaded and cached. Texture will also generate a masked textured for any file by prepending the filename with MASK.
Take a look into the TextureMap.pas file if your interested. The specifics of loading the image data and generating the textures are fairly well explained in comments in the code.
Also youll notice that in the test code I have a file called GUICore.pas. This is some beta code for doing basic in game gui stuff like button, panels, and windows. Feel free to check out that code too, but its pretty rough and uncommented at this point.
I’ve got some more work to do on the basic GUI stuff, then perhaps Ill be able to get started on some actual game logic work.Posted by David Lock on March 29th, 2006 under Uncategorized |