Results 1 to 8 of 8

Thread: SDL_Image

                  
   
  1. #1
    DCEmu Newbie
    Join Date
    Jul 2006
    Posts
    17
    Rep Power
    0

    Default SDL_Image

    Okay, im working on sdl programming for the DC. I want to use SDL_Image so I can do more than just display BMP's with SDL_LoadBMP. The first thing that I noticed is that the lib is included in the Dreamcast Dev Environment R3 but the "SDL_Image.h" is not. What I did was I used a header file that I download for computer programming. Anyway it compiled correctly once I used that but when it got to displaying a .png image on the TV screen(serial upload) it only showed up black. I think it may be because I used a header file that was for programming for the computer. chui compiled the lib in the latest R3 Dev Environment. Has anybody else tried to use SDL_Image?

  2. #2
    DCEmu Newbie
    Join Date
    Jul 2006
    Posts
    17
    Rep Power
    0

    Default

    I found it in the making the lib section but I still get a black screen .

  3. #3
    DCEmu Coder GPF's Avatar
    Join Date
    Apr 2004
    Location
    Texas
    Age
    52
    Posts
    796
    Rep Power
    78

    Default

    look in /usr/local/dc/kos1.3/kos-ports/SDL_image-1.2.4/

    or the similiar directory structure for R3 should be where the header file exists. add
    Code:
    -I$(KOS_PORTS)/SDL_image-1.2.4
    to you CFLAGS in your makefile/project settings etc.

    how are you trying to load the file?

    from /pc /cd /rd ? sounds like the file isn't being found.

    Troy(GPF)

  4. #4
    DCEmu Newbie
    Join Date
    Jul 2006
    Posts
    17
    Rep Power
    0

    Default

    Yea, that is what I meant about finding "it". I should be more descriptive. Anyway I am uploading through the serial port of the Dreamcast. So yea, im doing it through the PC. Here is my makefile:

    [Makefile]
    TARGET = testpng.elf
    OBJS = charpng.o gfx.o
    all: rm-elf $(TARGET)

    include $(KOS_BASE)/Makefile.rules

    KOS_CFLAGS += -o3 -fstrict-aliasing -fomit-frame-pointer -ffunction-sections
    clean:
    -rm -f $(TARGET) $(OBJS) romdisk.*

    rm-elf:
    -rm -f $(TARGET) romdisk.*

    $(TARGET): $(OBJS) romdisk.o
    $(KOS_CC) $(KOS_CFLAGS) $(KOS_LDFLAGS) -o $(TARGET) $(KOS_START) \
    $(OBJS) romdisk.o $(OBJEXTRA) -L$(KOS_BASE)/lib -lSDL -lSDL_image -lpng -ljpeg -lSDL_mixer -lSDL -loggvorbisplay -ltremor -lkallisti -lk++ -lz -lm -lc -lk++ $(KOS_LIBS)

    romdisk.img:
    $(KOS_GENROMFS) -f romdisk.img -d romdisk -v

    romdisk.o: romdisk.img
    $(KOS_BASE)/utils/bin2o/bin2o romdisk.img romdisk romdisk.o

    run: $(TARGET)
    $(KOS_LOADER) $(TARGET)
    [/Makefile]

    So because I have -ISDL_image in the (KOS_BASE) section do I need to add it again?

    As you can see the title of the lib for me is just "libSDL_image.a" not including the 1.2.4 stuff. I have recompiled the lib 3 times using the .c files I get with R3 and the .c files I get from chui's site(Which turns out to have the name including 1.2.4, I just renamed it to SDL_image). I think for the most part they are both the same just the name of the libs are different. Thanks for the help GPF I really appreciate it. :thumbup:

  5. #5
    The Long Claw of the Law BlueCrab's Avatar
    Join Date
    Apr 2004
    Age
    37
    Posts
    1,215
    Rep Power
    50

    Default

    Quote Originally Posted by BB Hood View Post
    KOS_CFLAGS += -o3 -fstrict-aliasing -fomit-frame-pointer -ffunction-sections
    Optimize level 3 isn't a good idea on the Dreamcast in general. In general you should stick with the KOS default optimization flags, since they're the only ones that KOS and related things have been really tested with. I know in the past even -O2 caused problems on the sh-elf port of gcc, so I wouldn't doubt that changing optimization flags might have affected your code (then again, it might not, there might be some other problem).

    $(TARGET): $(OBJS) romdisk.o
    $(KOS_CC) $(KOS_CFLAGS) $(KOS_LDFLAGS) -o $(TARGET) $(KOS_START) \
    $(OBJS) romdisk.o $(OBJEXTRA) -L$(KOS_BASE)/lib -lSDL -lSDL_image -lpng -ljpeg -lSDL_mixer -lSDL -loggvorbisplay -ltremor -lkallisti -lk++ -lz -lm -lc -lk++ $(KOS_LIBS)
    Wow.... that is a jumbled mess of libraries you're linking in there..... I'd reorder it like this, if I were you:
    Code:
    -lSDL_image -lSDL_mixer -lSDL -lpng -ljpeg -ltremor -lz -lm -lk++ $(KOS_LIBS)
    That SHOULD cover everything, without extra junk going into the linker ($(KOS_LIBS) includes -lkallisti and -lc by default, also, linking -loggvorbisplay and -ltremor both is probably a bad idea.... they're supposed to do the same thing).

    Hope that helps...
    Sylverant PSO Server
    http://crabemu.sourceforge.net/
    irc.freenode.net #dreamcastdev #dcemuuk #yabause #ljsdcdev

  6. #6
    DCEmu Newbie
    Join Date
    Jul 2006
    Posts
    17
    Rep Power
    0

    Default

    Thanks BlueCrab!

    I am new to compiling using "Makefile" and cygwin and I think the Makefile I am using is a template or something. How would I stick with the KOS default optimization flags?

    Got to work now so I will try what you game me later and get back to you. Thanks again.

  7. #7
    The Long Claw of the Law BlueCrab's Avatar
    Join Date
    Apr 2004
    Age
    37
    Posts
    1,215
    Rep Power
    50

    Default

    If you get rid of the line that starts with KOS_CFLAGS, you'll restore the default flags for compilation.
    Sylverant PSO Server
    http://crabemu.sourceforge.net/
    irc.freenode.net #dreamcastdev #dcemuuk #yabause #ljsdcdev

  8. #8
    DCEmu Newbie
    Join Date
    Jul 2006
    Posts
    17
    Rep Power
    0

    Default

    I changed the makefile by removing the CFLAGS and changing the LIBS according to what you posted and it compiled fine but I still get a black screen. The only thing that shows up is the mouse cursor on the top left corner of the screen.

    I will get it to work....someday.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •