Click here to Skip to main content
Click here to Skip to main content
Add your own
alternative version

Texture Atlas Maker

, 1 Apr 2012
A utility to create texture atlases for 2D OpenGL games
AtlasExample_iphone_project.zip
AtlasExample
.DS_Store
__MACOSX
AtlasExample
._.DS_Store
AtlasExample
.DS_Store
AtlasExample
._.DS_Store
AtlasAppDelegate.mm
AtlasExample-Info.plist
AtlasExample-Prefix.pch
._AtlasExample-Prefix.pch
EAGLView.mm
en.lproj
InfoPlist.strings
en.lproj
._InfoPlist.strings
MainWindow.xib
ImagePNG.mm
._ImagePNG.mm
images0.tga
main.m
._main.m
Shaders
Shader.fsh
Shaders
._Shader.fsh
Shader.vsh
._Shader.vsh
AtlasExample.xcodeproj
project.pbxproj
project.xcworkspace
contents.xcworkspacedata
xcuserdata
lefty.xcuserdatad
UserInterfaceState.xcuserstate
xcuserdata
lefty.xcuserdatad
xcdebugger
Breakpoints.xcbkptlist
xcschemes
AtlasExample.xcscheme
xcschememanagement.plist
AtlasExampleTests
AtlasExampleTests-Info.plist
AtlasExampleTests-Prefix.pch
AtlasExampleTests
._AtlasExampleTests-Prefix.pch
AtlasExampleTests.m
._AtlasExampleTests.m
en.lproj
InfoPlist.strings
en.lproj
._InfoPlist.strings
AtlasExample_iPhone_project_2.1.zip
.DS_Store
._.DS_Store
.DS_Store
._.DS_Store
AtlasAppDelegate.mm
AtlasExample-Info.plist
AtlasExample-Prefix.pch
._AtlasExample-Prefix.pch
EAGLView.mm
InfoPlist.strings
._InfoPlist.strings
MainWindow.xib
ImagePNG.mm
._ImagePNG.mm
imagesNelly0.tga
main.m
._main.m
Shader.fsh
._Shader.fsh
Shader.vsh
._Shader.vsh
project.pbxproj
contents.xcworkspacedata
UserInterfaceState.xcuserstate
Breakpoints.xcbkptlist
AtlasExample.xcscheme
xcschememanagement.plist
AtlasExampleTests-Info.plist
AtlasExampleTests-Prefix.pch
._AtlasExampleTests-Prefix.pch
AtlasExampleTests.m
._AtlasExampleTests.m
InfoPlist.strings
._InfoPlist.strings
AtlasMaker.zip
AtlasMaker
.classpath
.project
bin
icon.png
images
icon.png
output.png
settings.png
output.png
settings.png
src
AtlasMaker_jar.zip
AtlasMaker_jar_2.0.zip
AtlasMaker_jar_2.1.zip
AtlasMaker_jar_2.2.1.zip
AtlasMaker_jar_2.2.zip
AtlasMaker_source.2.2.1.zip
.classpath
.project
.settings
org.eclipse.jdt.core.prefs
atlasMaker.properties
icon.png
icon.png
settings.png
settings.png
AtlasMaker_source.zip
.classpath
.project
icon.png
icon.png
output.png
settings.png
output.png
settings.png
AtlasMaker_source_2.0.zip
.classpath
.project
atlasMaker.properties
icon.png
icon.png
settings.png
settings.png
AtlasMaker_source_2.1.zip
.classpath
.project
org.eclipse.jdt.core.prefs
atlasMaker.properties
icon.png
icon.png
settings.png
settings.png
AtlasMaker_source_2.2.zip
.classpath
.project
org.eclipse.jdt.core.prefs
icon.png
icon.png
settings.png
settings.png
#ifndef _PVRHEADER_H_INCLUDED_
#define _PVRHEADER_H_INCLUDED_

const int PVR_HEADER_SIZE = 13*4;

const unsigned int PVRTEX_MIPMAP		= (1<<8);		// has mip map levels
const unsigned int PVRTEX_TWIDDLE		= (1<<9);		// is twiddled
const unsigned int PVRTEX_BUMPMAP		= (1<<10);		// has normals encoded for a bump map
const unsigned int PVRTEX_TILING		= (1<<11);		// is bordered for tiled pvr
const unsigned int PVRTEX_CUBEMAP		= (1<<12);		// is a cubemap/skybox
const unsigned int PVRTEX_FALSEMIPCOL	= (1<<13);		//
const unsigned int PVRTEX_VOLUME		= (1<<14);
const unsigned int PVRTEX_PIXELTYPE		= 0xff;			// pixel type is always in the last 16bits of the flags
const unsigned int PVRTEX_IDENTIFIER	= 0x21525650;	// the pvr identifier is the characters 'P','V','R'

const unsigned int PVRTEX_V1_HEADER_SIZE = 44;			// old header size was 44 for identification purposes

const unsigned int PVRTC2_MIN_TEXWIDTH		= 16;
const unsigned int PVRTC2_MIN_TEXHEIGHT		= 8;
const unsigned int PVRTC4_MIN_TEXWIDTH		= 8;
const unsigned int PVRTC4_MIN_TEXHEIGHT		= 8;
const unsigned int ETC_MIN_TEXWIDTH			= 4;
const unsigned int ETC_MIN_TEXHEIGHT		= 4;
const unsigned int DXT_MIN_TEXWIDTH			= 4;
const unsigned int DXT_MIN_TEXHEIGHT		= 4;

/*
	GL_IMG_texture_compression_pvrtc
*/
/* Tokens */
#define GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG			0x8C00
#define GL_COMPRESSED_RGB_PVRTC_2BPPV1_IMG			0x8C01
#define GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG			0x8C02
#define GL_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG			0x8C03

	enum PixelType
	{
		MGLPT_ARGB_4444 = 0x00,
		MGLPT_ARGB_1555,
		MGLPT_RGB_565,
		MGLPT_RGB_555,
		MGLPT_RGB_888,
		MGLPT_ARGB_8888,
		MGLPT_ARGB_8332,
		MGLPT_I_8,
		MGLPT_AI_88,
		MGLPT_1_BPP,
		MGLPT_VY1UY0,
		MGLPT_Y1VY0U,
		MGLPT_PVRTC2,
		MGLPT_PVRTC4,
		MGLPT_PVRTC2_2,
		MGLPT_PVRTC2_4,

		OGL_RGBA_4444= 0x10,
		OGL_RGBA_5551,
		OGL_RGBA_8888,
		OGL_RGB_565,
		OGL_RGB_555,
		OGL_RGB_888,
		OGL_I_8,
		OGL_AI_88,
		OGL_PVRTC2,
		OGL_PVRTC4,

		// OGL_BGRA_8888 extension
		OGL_BGRA_8888,

		// max cap for iterating
		END_OF_PIXEL_TYPES,

		MGLPT_NOTYPE = 0xff

	};



class PVRHeader
{
public:
	PVRHeader();
	~PVRHeader();
	FILE* LoadHeader(const string& fileName);
	int m_headerSize;			/*!< size of the structure */
	int m_height;				/*!< height of surface to be created */
	int m_width;				/*!< width of input surface */
	int m_mipMapCount;			/*!< number of mip-map levels requested */
	int m_pfFlags;				/*!< pixel format flags */
	int m_textureDataSize;		/*!< Total size in bytes */
	int m_bitCount;			/*!< number of bits per pixel  */
	int m_rBitMask;			/*!< mask for red bit */
	int m_gBitMask;			/*!< mask for green bits */
	int m_bBitMask;			/*!< mask for blue bits */
	int m_alphaBitMask;		/*!< mask for alpha channel */
	int m_pvr;					/*!< magic number identifying pvr file */
	int m_numSurfs;			/*!< the number of surfaces present in the pvr */
};





#endif // _PVRHEADER_H_INCLUDED_

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The BSD License

About the Author

ed welch
Software Developer Astronautz
Spain Spain
After working in the software industry for many years, I've started my own games company that specialises in strategy games for mobile platforms.

| Advertise | Privacy | Mobile
Web01 | 2.8.140721.1 | Last Updated 1 Apr 2012
Article Copyright 2012 by ed welch
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid