====================================== AD GL Glyph Creator v. 1.0.0.4 Copyright ®2003-2004, Davide Angeli davideangeli@estelnet.it AD GL Glyph Creator v 1.0.0.3 is Free software and come absolutely with no warranty. ====================================== 1. WHAT IS THIS? 2. Requirements. 3. WHAT'S NEW (UPDATES & CHANGES). 4. KNOWN PROBLEMS AND ISSUES. 5. ADG File Structure. 1. WHAT IS THIS? ------------- The program was originally inspired by Brad Fish's glFont2 (see http://students.cs.byu.edu/~bfish/) and was required me by my brother Paolo. For anyone who is interested the program is developed with Delphi. This program allows to create files suitable to contain the graphical images (Glyphs) used in a GUI environment. The images stored are the resources that usually are used as icons and gadgets to improve the beautiness and the UI. The program allows to create ADG file format that can store a series of images in RGBA pixel format. All the contained images are stored in larger image that is suitable for OpenGL texture creation. The size of the large image that stores the other images is predefined and must be a rectangle with power of 2 dimensions. The dimensions of the texture are choosen when the new ADG file is created. The contained images must have all the same size. These sizes should be 16x16, or 32x32 or 64x64. The size of the contained images must be specified when a new ADG file is created. The number of images that can be stored depends from the images size and the overall texture size. So if the ADF file can contain a texture of 256 x 128 pixel, it can store 128 16x16 images or 32 32x32 images or 8 64x64 images. The images can be imported in the ADG file exlusively form BMP image format. The pixel in the lower left corner of the BMP image determines the color used for transparency. All the pixels in the image with this color are set with the alpha value of 0.0, so they will be transparent when rendered using OpenGL routines. This tecnique is called color key. Each image is processed separately, so each image can have a different color in the lower left corner to determine the color key. The resulting ADG file format is the standard format used by the CELUI library developed by Paolo Angeli (see http://members.xoom.virgilio.it/pangeli70). 2. REQUIREMENTS ------------ The program is tested to run on Windows 2000 and Windows XP. Probably it will run well under windows 9x and ME too. The program creates itself its own ini file to save the preferences so it is sufficient to copy the executable file in the desired folder. No specific installation is required nor any file extension association is provided. 3. KNOWN PROBLEMS AND ISSUES ------------------------- It is advisable to render the single images with a scale factor <= 1.0. Larger scale factor causes visual artifacts on the borders. The best results are obtained with large images (32x32 or 64x64) rendered with a scale factor 0.5 of 0.25. OpenGL operates texture interpolation that gives to the image a pleasant smoothness. With 16x16 images the 1.0 scale factor is recommended. 4. WHAT'S NEW (UPDATES & CHANGES) ------------------------------ Version 1.0.0.4 (23-01-2001): - Minor ahestetic corrections for first publishing. Version 1.0.0.3 (31-12-2003): - Improved layout & correct some little bugs. - Optimized the structure of the file : now the program allow to insert only glyphs of the initial specified size so in the file ADG every glyph must have the same size. - Add Export to BM. - Add "Cut" in the clipboard. - Add "Insert" new from clipboard . - Add "Move After". - Add "Move Before". - Improved "Delete" now it's possible to delete every glyph : aftere delete the program compacts automatically the other glyphs. Version 1.0.0.2 (30-12-2003): - Add support Copy/Paste inside the program and also to get/put data from/to external image editors like Paintbrush, MS Paint, Photoshop etc.. Version 1.0.0.1 (28-12-2003): - Implemented drag & drop to drag BMP files directly from Windows to the texture - Fix some bugs in load/saving file and managing the MDI Childs windows - Saved now the byte for transparency value ($00 means transparent, $FF means no transparent) - Add capabilty to delete/replace glyphs (only the last drawn can be deleted) Version 1.0.0.0 (26-12-2003): - First version implements the capability to create/load/save ADG files 5. ADG FILE STRUCTURE ------------------ This code was excerpted from the CELUI library developed by Paolo Angeli. The first 128 bytes are the header of the file and are described by the following data structure. // uiADGLGraphicsHeader // //! Header of the Angeli Davide GL Graphics file format //-------------------------------------------------------------- struct uiADGLGraphicsHeader { char fileID[5]; //!< Bytes 001-005 "ADGGL" uiByte fileVer; //!< Bytes 006-006 File version char name[50]; //!< Bytes 007-056 Description. uiByte filler1[14]; //!< Bytes 057-070 .. not used uiWord texWidth; //!< Bytes 071-072 Texture Width in pixels uiWord texHeight; //!< Bytes 073-074 Texture Height in pixels uiWord imagesNum; //!< Bytes 075-076 Number of images stored uiWord imagesSiz; //!< Bytes 077-078 Image size (16, 32 or 64). uiByte filler2[50]; //!< Bytes 079-128 .. not used }; After the header there is the images map that is an array of the following data structures that contain the boundary data for each image. // uiADGLGraphicsImage // //! Image description for the Angeli Davide GL Graphics file format //---------------------------------------------------------------------- struct uiADGLGraphicsImage { uiWord code; //!< Code of the image. uiWord left; //!< Left position of the character in pixels. uiWord top; //!< Top position of the character in pixels. }; After the images map an array of texWidth x texHeight x 4(RGBA) bytes represents the raw OpenGL texture. It is possible to allocate dynamically the memory required by this array and declare it as: char* imgData = new char[texHeight * texWidth * 4]; To create the texture it is possible to use the following routines: int texHandle; glGenTextures(1, (GLuint*) &texHandle); glBindTexture(GL_TEXTURE_2D, texHandle); // Set texture parameters glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); // Generate the texture glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, fTexWidth, fTexHeight, 0, GL_RGBA, GL_UNSIGNED_BYTE, (void *)imgData);