Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / Tier 2, Linux, Console app, can't load image files

Author
Message
Cybermind
Valued Member
21
Years of Service
User Offline
Joined: 28th Nov 2002
Location: Denmark
Posted: 25th Jul 2018 13:51
Hello (= I am writing a console app in tier 2 for Linux, but every time I try to load an image I get a segmentation error. Is there anything I can do so that my console app can load images? (I know I can't show them on screen, I just need to do stuff with them).

I hope someone can help, or at least clarify why I can't do this (=
13/0
Paul Johnston
TGC Developer
21
Years of Service
User Offline
Joined: 16th Nov 2002
Location: United Kingdom
Posted: 25th Jul 2018 14:02
When you load an image it tries to put it on an OpenGL texture, since OpenGL doesn't exist in the console version it will cause a crash. Unfortunately there isn't a way to load the image data without it attempting to use OpenGL. If the image is uncompressed you could use CreateMemblockFromFile, but PNG and JPEG files loaded in this way will still be compressed.
Cybermind
Valued Member
21
Years of Service
User Offline
Joined: 28th Nov 2002
Location: Denmark
Posted: 25th Jul 2018 15:20
Ok, thank you for your answer (= I need them as memblocks anyway, I will create an app that loads them and turn them into memblocks that are saved on disk (=
13/0
Bengismo
6
Years of Service
User Offline
Joined: 20th Nov 2017
Location: Yorkshire, England
Posted: 25th Jul 2018 16:04 Edited at: 25th Jul 2018 16:09
Since its teir 2 - You could use the FreeImage library (or DevIL instead). Both are cross platform c.

Ive used freeImage (its great) and its really easy to load any format of image you like then use a single function to convert to 32Bpp then simply open a file, save 3 ints (width,height,32) and then save the raw bitdata.

That then gives you a file that can be loaded straight into a memblock which can then be converted to an image.

Thats really easy, - if thats what your trying to do.... Im guessing your probably looking at doing a lot more than that though.


Its possible to use these libraries to load any image type you like into AppGameKit too straight from the library into a memblock without going via a saved file if you wanted to support more formats or some obfuscated game data/graphics that people cant steal.

Login to post a reply

Server time is: 2024-04-18 19:55:25
Your offset time is: 2024-04-18 19:55:25