![]() |
|
This thread is locked; no one can reply to it.
![]() ![]() |
1
2
|
How can I load png files with Allegro? |
Tibor Fober
Member #9,791
May 2008
|
Hello. What should I do to load png? Greetz, |
Erin Maus
Member #7,537
July 2006
![]() |
Link with this: alleg.lib loadpng.lib <zlib> <libpng> (where zlib/libpng are the correct names; I don't know what they are, since I don't use LoadPNG with MSVC). --- |
Tibor Fober
Member #9,791
May 2008
|
my problem is... i havent got a data named loadpng.lib only have zdll.lib and libpng.lib.... where do i get support for MSVC... i only find linux and unix support... Best Regards, |
Erin Maus
Member #7,537
July 2006
![]() |
For MSVC, try and directly add the LoadPNG files (all the C source files and header files) to your project and see what happens (linking with libpng and zlib, too). --- |
Tibor Fober
Member #9,791
May 2008
|
Here see the code: #include <WinAllegro.h> int main(int argc, char **argv) return 0; and I link to alleg.lib, zdll.lib, and libpng.lib here is the error message only for register_png_file_type() 1>main.obj : error LNK2001: Nicht aufgelöstes externes Symbol "_register_png_file_type". nicht aufgelöste externe verweise = unresolved extern symbol... so he cant find the function... but if i write the function in msvc he find the function... ah and I found out that register_png_file() is only declared not defined... where is the definition of register_png_file() usually? Tibo |
Peter Wang
Member #23
April 2000
|
regpng.c
|
Tibor Fober
Member #9,791
May 2008
|
and if i include regpng.c he said: I dont know... do loadpng really work?.... |
Edgar Reynaldo
Major Reynaldo
May 2007
![]() |
Are you sure that all the loadpng files are being compiled? It sounds like the .o files haven't been made or they are not being linked against. My Website! | EAGLE GUI Library Demos | My Deviant Art Gallery | Spiraloid Preview | A4 FontMaker | Skyline! (Missile Defense) Eagle and Allegro 5 binaries | Older Allegro 4 and 5 binaries | Allegro 5 compile guide |
Tibor Fober
Member #9,791
May 2008
|
whats a .o file? I found a libpng-bcc.lib data and i linked to it.. but my compiler said this data is damaged or not valid... Tibo |
Edgar Reynaldo
Major Reynaldo
May 2007
![]() |
A .o file is code that has been compiled but not linked. My Website! | EAGLE GUI Library Demos | My Deviant Art Gallery | Spiraloid Preview | A4 FontMaker | Skyline! (Missile Defense) Eagle and Allegro 5 binaries | Older Allegro 4 and 5 binaries | Allegro 5 compile guide |
Tibor Fober
Member #9,791
May 2008
|
does nobody know the problem? |
Timorg
Member #2,028
March 2002
|
I made a wrapper that used gd to load images, at the moment its licensed under gpl, but I am in the process of getting the next release together and moving it to either lgpl or the gd licence so it can be used more easily in peoples projects. It has project files for msvc 2005 and not so great instructions for v6, it allows you to also load gif and jpegs. ____________________________________________________________________________________________ |
Milan Mimica
Member #3,877
September 2003
![]() |
Quote:
I downloaded libpng from here These are probably not for MSVC.
-- |
Edgar Reynaldo
Major Reynaldo
May 2007
![]() |
Are you planning to use the win32 API in your program? #include <WinAllegro.h> #include "loadpng.h" #include <png.h> #include <zlib.h> If you want to use the win32 API with Allegro you need to include winalleg.h after allegro.h , which I don't see there and you've also misspelled 'winalleg.h' as WinAllegro.h. Quote: and if i include regpng.c he said: So you've added all of loadpng's source files to your project right? My Website! | EAGLE GUI Library Demos | My Deviant Art Gallery | Spiraloid Preview | A4 FontMaker | Skyline! (Missile Defense) Eagle and Allegro 5 binaries | Older Allegro 4 and 5 binaries | Allegro 5 compile guide |
Tibor Fober
Member #9,791
May 2008
|
I'd make WinAllegro.h on my self... without WinAllegro allegro doesnt work with MSVC. Allegro havent got much support for windows... thats very bad. I'm not a windows fan but the IDE is very good... Yes i added all loadpng sources. regpng savepng and so on... To Milan Mimica: |
Vanneto
Member #8,643
May 2007
|
Quote: I'd make WinAllegro.h on my self... without WinAllegro allegro doesnt work with MSVC. Allegro havent got much support for windows... thats very bad. I'm not a windows fan but the IDE is very good...
Hehe, that made my day. Anyway, why make it yourself? Can't you read? #include "WinAllegro.h" // WRONG! Even if you make it yourself... #include <winalleg.h> // Correct.
In capitalist America bank robs you. |
Milan Mimica
Member #3,877
September 2003
![]() |
Quote: So there arent any loadpng libpng files for MSVC? Compile them yourself. A C programmer should be used to compile things.
-- |
Edgar Reynaldo
Major Reynaldo
May 2007
![]() |
Quote: Allegro havent got much support for windows... That's really not true. Check the manual. From Allegro manual - Windows Specifics Quote: A Windows program that uses the Allegro library is only required to include one or more header files from the include/allegro tree, or allegro.h; however, if it also needs to directly call non portable Win32 API functions, it must include the Windows-specific header file winalleg.h after the Allegro headers, and before any Win32 API header file. By default winalleg.h includes the main Win32 C API header file windows.h. If instead you want to use the C++ interface to the Win32 API (a.k.a. the Microsoft Foundation Classes), define the preprocessor symbol ALLEGRO_AND_MFC before including any Allegro header so that afxwin.h will be included. Note that, in this latter case, the Allegro debugging macros ASSERT() and TRACE() are renamed AL_ASSERT() and AL_TRACE() respectively. So if you want to use the Win32 API , include allegro.h and then winalleg.h. #include <allegro.h> #include <winalleg.h> As far as the unresolved external symbol errors you've been getting , I think it's from linking in the wrong order. You need to have linked against zlib and libpng for any png functions to work and for 'register_png_file_type' to work you should need to link against allegro and the loadpng object files. So I'm guessing that the correct order to link in is : zlib , libpng , and then allegro. My Website! | EAGLE GUI Library Demos | My Deviant Art Gallery | Spiraloid Preview | A4 FontMaker | Skyline! (Missile Defense) Eagle and Allegro 5 binaries | Older Allegro 4 and 5 binaries | Allegro 5 compile guide |
Tibor Fober
Member #9,791
May 2008
|
what should i compile? the regpng loadpng savepng sources? And winalleg including doesnt work right. I tried everything but without this code allegro doesnt work by me. Hey guys... its working now.... thank you soo much for help. I dont know what was my fault but after i installed all allegro and libpng zlib again it works fine. Greetz, |
Edgar Reynaldo
Major Reynaldo
May 2007
![]() |
So that's the only code in your "WinAllegro.h" file? Quote: what should i compile? the regpng loadpng savepng sources? Yes , along with the other source files in your project and then link them all together. My Website! | EAGLE GUI Library Demos | My Deviant Art Gallery | Spiraloid Preview | A4 FontMaker | Skyline! (Missile Defense) Eagle and Allegro 5 binaries | Older Allegro 4 and 5 binaries | Allegro 5 compile guide |
Tibor Fober
Member #9,791
May 2008
|
ya without the WinAllegro.h allegro doesnt work^^ I only have to include loadpng.h Edit: Omfg sry next problem. Why does transparency doesnt work? Greetz, |
Evert
Member #794
November 2000
![]() |
Quote:
Without my code allegro doesnt work... This is blatently not true. Post whatever error message you get and we'll tell you how to fix it, or point you in the right direction. Quote: Why does transparency doesnt work?
Clarify "doesn't work". |
Tibor Fober
Member #9,791
May 2008
|
I'm dumb! brother I have 2 gfx in my project folder both are the same images only the format isnt the same. One is .bmp and the other is .png if I draw them both using draw_sprite the bmp is transparent but the png isnt transparent.... Here is the error code without WinAllegro.h and with allegro.h 1>d:\lib\allegro v4.2.2\include\allegro\internal\alconfig.h(397) : warning C4312: 'Typumwandlung': Konvertierung von 'unsigned int' in größeren Typ 'unsigned char *' have fun^^. Konvertierung von 'unsigned int' in größeren Typ 'unsigned int * = Thanks for help. |
Matthew Leverton
Supreme Loser
January 1999
![]() |
Those are warnings, not errors, and can be disabled by unselecting the "Detect 64-bit compatibility problems" in the settings. |
Evert
Member #794
November 2000
![]() |
Quote:
One is .bmp and the other is .png if I draw them both using draw_sprite the bmp is transparent but the png isnt transparent....
One way or the other, it is your fault, because both are Allegro BITMAPs after they've been loaded. At that time, the on-disk format is no longer relevant. Quote: Here is the error code I see no errors, just warnings. |
|
1
2
|