{"assets":[],"author_link":"author\/pov\/","author_name":"PoV","cat":"MiniLD","categories":["MiniLD"],"comments":[],"epoch":1220679300,"event":"LD12","likes":0,"metadata":{"p_key":"76286","p_author":"PoV","p_authorkey":"0","p_urlkey":"284049","p_title":"Swimming in a texture pool","p_cat":"MiniLD","p_event":"LD12","p_time":"1220679300","p_likes":"0","p_comments":"0","p_status":"WAYBACK","us_key":null,"us_name":null,"us_username":null,"event_start":"1218153600","event_key":"89","event_name":"LD12"},"source_url":"2008\/09\/06\/swimming-in-a-texture-pool\/","text":"<p>I have a seemingly endless list of libraries and tools I want, and a few I need to finish up my current project.  So I\u2019ll be starting with something I need.  If all goes according to plan, I\u2019ll get to start another one tomorrow.<\/p>\n<p>So I need a Texture Pool.  In other words, I want a nice way to say \u201chey, load blah.png\u201d, and it\u2019ll use it\u2019s brains to know that I already loaded \u201cblah.png\u201d, and return me the same copy.  Pretty straight forward stuff.<\/p>\n<p>This Texture Pool is a piece I\u2019m adding to my graphics library.  Said library is designed to wrap multiple graphics API\u2019s.  Currently it wraps OpenGL (1.5) and OpenGL ES (1.1), but it also has a slightly out of date software renderer too (lacking texture support, but does geometry and transformations).<\/p>\n<p>The Texture Pool itself I\u2019d like to eventually support several formats.  Currently it supports a hybrid format of mine, LZMA\u2019d Power VR (PVR) files.  The way it\u2019s structured, it\u2019s easy enough for me to support ZLIB, BZIP, or RAW PVR files as well, I just don\u2019t currently.  And while I don\u2019t yet support them, I have stubs in place for PNG and DDS files.<\/p>\n<p>I have some other wild goals for the Texture Pool down the line.  Right now, one of my main target platforms requires square power-of-two textures.  So I\u2019d like to build a tool for combining multiple smaller images in to a single texture atlas.  I\u2019d also like a way to automatically fatten up a PNG image file, yet still somehow remember the original dimensions.  This slicing information I\u2019d like to be known by the Texture Pool, so I can draw centered or aligned texture elements with just a call, instead of having to build geometry or remember dimensions.<\/p>\n<p>My solution to both is a custom file format, vaguely like an archive format.  As an added bonus, I want it to be able to support storing multiple images in the same file.  But the important point is to create this \u201cmany to one\u201d relationship, where I have a single texture and some way to say it contains many elements.  I\u2019m leaning towards throwing together a text based format and tool to generate a sliced file, so I can start using this right away.<\/p>\n<p>Alas, that\u2019s a tomorrow issue.<\/p>\n<p>Today, we\u2019re building a Texture Pool.  After some breakfast, we\u2019ll do it.<\/p>\n<p>Tags: <a href=\"http:\/\/ludumdare.com\/compo\/tag\/pool\/\" rel=\"tag\">Pool<\/a>, <a href=\"http:\/\/ludumdare.com\/compo\/tag\/texture\/\" rel=\"tag\">Texture<\/a><\/p>","time":"September 6th, 2008 5:35 am","title":"Swimming in a texture pool"}