Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-4041-

easy image format to write loader for?

Name: Anonymous 2007-01-08 23:52

I've been going through some image format possibilities for my game and I can't decide on a commonly-used image format for my game's data.

Targa is a tried-and-true format but it has a lot of different standard-supported options of storing pixels such that I'd have to write like 8 or 9 functions to load and translate all the different ways a .TGA file's image can be stored.  Not fun.

.jpg and .png are a pain in the butt, even more mathematically annoying with their use of compression and all.  .gif is just not an option.

Buh buh buh... are there no super-simple image formats out there whose header specifications just look like this:

int width
int height
and then an array of guaranteed 24-bit {a,r,g,b} quadruples

Name: Anonymous 2007-01-09 0:11

BMP?

Name: Anonymous 2007-01-09 0:30

y not just use openil and be done with it? :/

Name: Anonymous 2007-01-09 8:04

>>1
Use libpng

Name: Anonymous 2007-01-09 8:22

imlib

Name: Anonymous 2007-01-09 9:44

convert and store your image data in .txt files.

Name: Anonymous 2007-01-09 9:47

Name: Anonymous 2007-01-09 12:13

>>4

Name: Anonymous 2007-01-09 15:09

Quit reinventing the wheel and use a library

Name: Anonymous 2007-01-09 18:22

SVG!

Name: Anonymous 2007-01-09 19:22

Use XML lol

<row>
    <pixel>
        <red>45</red>
        <green>178</green>
        <blue>225</blue>
    </pixel>
    <pixel>
...



(lol @ XML fags)

Name: Anonymous 2007-01-09 19:26

<pixel red="45" green="178" blue="225" /> would be better I think...

(lol @ failure at XML)

Name: Anonymous 2007-01-09 19:27

>>9

Do this. There is absolutely no reason to create a less efficient implementation of an algorithm unless you're just doing it for educational purposes.

Name: Anonymous 2007-01-09 20:04

<?xml version="1.0"?>
<image:data xmlns:image="http://www.w3.org/1999/XMLImage"; xml:lang="en">
    <image:pixel positionx="1" positiony="1">
        <image:red><![CDATA[255]]></image:red>
        <image:blue><![CDATA[0]]></image:red>
        <image:green><![CDATA[0]]></image:red>
        <image:alpha><![CDATA[127]]></image:red>
    </image:pixel>
</image:data>

Name: Anonymous 2007-01-09 21:02

Always use libraries, writing your own image or model loader is a waste of time.

Name: Anonymous 2007-01-10 2:43

Actualy i would recommend to the person who posted this to come up with his own image format. Then you can CHOOSE what your format is going to be. This allows your solution to grow with the needs and requirements for your application.

After you have defined your own data structure for images, you can then build a converter application that will convert the images into your format, that is then loaded by your application.

The same goes with your 3D models. Most implimentations i've witnessed are very poor object orientated programing concepts. More or less like flat files on crack. Do yourself and the people in your team a favour and write you own model class, texture classes. This will give you confidence in your defined standards and not sombody elses format.

Be very carefull but, it seems like your caught in the mindset to catch up with everyone by supporting each and every image format that has been created by man. Don't do this! You will get frustrated, with all the idiocicrency with other people solution to the problem. Sit down and enjoy yourself writing the way you would do it, because utlimatly the consumer doesn't give a shit about what you do, you may as well have fun well building the application and learning.

Find the depencices and elimate them, follow that moto and within 6 months you will be shipping a quality product that your competition will be asking "how? did he do it?".

Name: Anonymous 2007-01-10 3:01

Easiest format? RAW. Keep the dimensions elsewhere.

An alternative is 24-bit BMP.

Otherwise use a library.

Name: Anonymous 2007-01-10 7:17

>>16
Nah. If he's putting together a game he's better off finishing first, instead of growing tired of the entire project just because he's spent a month writing a new image lib.

Keep your eyes on the target.

Name: Anonymous 2007-01-10 8:14

Use libpng, IJG's jpeg lib (yuck) or write your own TGA loader which is NOT that hard. The sources for my loader is about 9kb large and that supports pretty much every kind of TGA (which is also wrapped in a pretty class with some preparation for multithreading so you should be able to slim it down further).

Most data formats can re-use the same code. Loading uncompressed colormapped data is the same thing as loading uncompressed truecolor or greyscale data. The same thing applies for compressed formats SO you'll just need to write two decoder paths.

Name: Anonymous 2007-01-10 9:17

Geez, what is this, the 1990s? Use a freaking library. Problem solved.

Name: Anonymous 2007-01-11 7:53

>>18
Yes, but if you don't accept some aspects of game design are god damn awfully boring he will never finish. By doing image loading and unloading atleast he can self teach himself in the progress.

Using a library is all and great, even sound librarys. But by using them they force you to re-fracture you code to accept their layout of the library. It being OOP or procedual with some hacked sense of OOP, windows API comes to mind.

Either way, you typicaly find taking a short cut in development cycles only reveals later that you've got to go back and fix the mistake.

its one thing to making progress its a completly different story about making actual progress! Accept the fact that things are difficult, enjoy what you do and focus on the goal and you will be successfull. But telling me you don't want to write a image class, just tells me you will never be successfull in game development.

Name: Anonymous 2007-01-11 11:57

Hmmm, 1990 Deja Vu.

Name: Anonymous 2007-01-11 12:09

>>21
And telling me that people who don't want to write image loaders won't be successful in game development, just tells me that you have no idea what you are talking about.

Name: sage 2007-01-11 19:02 (sage)

Yet another war: libraries vs. do it yourself.
It comes down to personal opinion, just like OS/language/hardware wars.
I do both. Start with a library to save time, then later write my own library to get more control.

Name: Anonymous 2007-01-11 19:19

I started using libraries when I decided I should get things done.

Name: Anonymous 2007-01-12 0:21

>>25
Same here.

I used to write my own graphics libraries... until I realised that I was always ending up with really nice graphics libraries, not the projects I wanted a graphics library for in the first place.

Name: Anonymous 2007-01-12 5:27

>>25

Me too. When I was in my early teens, I was obsessed with assembly language and trying to work out how to do everything on the lowest level. It wasn't a colossal waste of time as I learned many useful skills that helped me with reverse engineering years later, but I never got any projects finished.

Nowadays I do most of my work in SQL and VB.Net, and I am much more productive.

Name: Anonymous 2007-01-12 7:49

.bmp?

You get the fun of reading the header and the added bonus of having to flip the thing the right way up.

Name: Anonymous 2007-01-12 11:11

>>24

Not a war, just ignorance on the part of those who get caught up in the Not Invented Here syndrome. Don't get me wrong, I'm all for doing it for research. If it isn't for research/education then find a Good library that you can manipulate and save whatever project you're working on. The chances of someone looking at your source, none the less reading it and giving a shit about your style, is very small.

Name: Anonymous 2007-01-12 11:53

ppm ftw

Name: Anonymous 2007-01-12 14:40

>>26
What do you mean writing your own graphics libraries?  Were you writing graphics APIs or what?

Name: Anonymous 2007-01-12 14:57

>>28
TGA can flip _both_ horizonal and vertical. BMP wins at possibly inaccurate header values though.

Name: Anonymous 2007-01-12 15:31

Libraries here, libraries there, libraries libraries everywhere.

Free cookie goes out to the first person who can guess correctly why keeping library dependencies to a minimum is a good thing, both in terms of practicality in developing your project as well as in terms of maintaining it.

Name: Anonymous 2007-01-12 16:05

Free cookie goes out to the first person who can guess correctly why keeping library dependencies to a minimum is a good thing, both in terms of practicality in developing your project as well as in terms of maintaining it.
you mean besides the obvious security reasons and the fact that the library developer could change the way the library works and make your app not work with newer versions of the library (hello openssl)?

Name: Anonymous 2007-01-12 16:43

>>33
>>34

Oh do tell us why it is so important to reinvent the wheel every time we write something and to avoid these evil libraries that are obviously put out there to destroy our applications.

Library needed an overhaul that causes applications to no longer function with the newer version because of an exploit? upgrade your code, problem solved. It will only take a few lines because you implemented it wisely... right?

Name: Anonymous 2007-01-12 17:00

Library needed an overhaul that causes applications to no longer function with the newer version because of an exploit?
or some idiot just decided it would be fun to change des_* to DES_*...

upgrade your code, problem solved. It will only take a few lines because you implemented it wisely... right?
it's still a pain in the ass (and ugly as hell)...


#inlcude <openssl/des.h>
#ifdef HEADER_NEW_DES_H
#include <openssl/des_old.h>
#endif


or


#include <openssl/des.h>
#ifdef HEADER_NEW_DES_H
#define des_fcrypt DES_fcrypt
#endif

Name: Anonymous 2007-01-12 17:54

>>36
So stick it in a separate header file. Problem solved!

Or are you people seriously all running Windows, where you can only have one version of a dynamic library around?

Further, security issues are something that can be better found and solved by an army of volunteers, as in the case of libpng -- and your own reimplementation is sure to have a number of bugs and other shit like that. Seriously, this "as few dependencies as possible" stuff is really not very good at all, unless you've got infinite free time or absolutely no ambition.

Name: Anonymous 2010-12-06 10:03

Back to /b/, ``GNAA Faggot''

Name: Anonymous 2011-02-03 3:31

Name: SPANISCHE FLIEGED6 2011-05-31 3:32

Name: 西班牙蒼蝿水 2011-05-31 3:35

Name: Anonymous 2011-05-31 14:22

lol

Name: Sgt.Kabu묎螘kiman즒샗 2012-05-28 21:41

Bringing /prog/ back to its people
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy

Don't change these.
Name: Email:
Entire Thread Thread List