forums.ps2dev.org Forum Index forums.ps2dev.org
Homebrew PS2, PSP & PS3 Development Discussions
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Display JPG tutorial?

 
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development
View previous topic :: View next topic  
Author Message
thomas_fogh



Joined: 20 Jul 2007
Posts: 21
Location: Denmark

PostPosted: Wed Jul 25, 2007 10:25 pm    Post subject: Display JPG tutorial? Reply with quote

Does anyone have a JPG tutorial?
Thanks!
BR, Thomas Fogh
Back to top
View user's profile Send private message
picobsd



Joined: 19 Apr 2007
Posts: 18

PostPosted: Thu Jul 26, 2007 2:48 pm    Post subject: Reply with quote

I have some sample code of using libjpeg to display jpeg file
Back to top
View user's profile Send private message
willow :--)



Joined: 13 Jan 2007
Posts: 126

PostPosted: Thu Jul 26, 2007 3:10 pm    Post subject: Reply with quote

I'm a beginner myself but so far here's what I understood :

Basically you load the jpeg in a memory structure, then you display it as a Texture on a 3D structure (like a sprite ?), then you send the 3d structure to the screen.

0) Search the forum, you'll find dozens of (almost working) sample codes for jpeg display

1) there is a good implementation of jpeg loading on luaplayer. Go to
http://svn.ps2dev.org/filedetails.php?repname=pspware&path=%2Ftrunk%2FLuaPlayer%2Fsrc%2Fgraphics.cpp&rev=0&sc=0
and look for Image* loadJpegImage(const char* filename) and
Image* loadJpegImageImpl
(you have to include "graphics.h" that defines the image structure).

2) Then you have to "blit" the image to the screen. for that, look at the "blit.c" sample in the sdk... You'll have to understand the basics of GU if you've never worked on 3D applications

3) You might have some problems between 16 bits (screen) and 24bits(jpeg)... I personnally solved that by changing the screen to 32 bits, but I guess it would be better to convert the image to 16bits...

(I am myself stuck with two problems currently:
- my image's height is bigger than screen's height
- I want to resize my image... I guess that's probably done by changing the cordinates of my vertices, but I don't know much about 3D....
Anyways scaling doesn't seem feasible with the default code provided by blit.c
)

If you don't understand the code that loads the jpeg, go to: http://www.jpegcameras.com/libjpeg/libjpeg-2.html. This is the jpeglib library explanation and to me it was easier to read this in parallel with code reading.
Back to top
View user's profile Send private message
thomas_fogh



Joined: 20 Jul 2007
Posts: 21
Location: Denmark

PostPosted: Thu Jul 26, 2007 5:44 pm    Post subject: Reply with quote

Thanks, I will take a look at blit.c (I don't want to use the luaplayer).
I tried searching the forum, but the most relevant I found had a broken link for the sources:
http://forums.ps2dev.org/viewtopic.php?t=6574
BR, Thomas Fogh
Back to top
View user's profile Send private message
willow :--)



Joined: 13 Jan 2007
Posts: 126

PostPosted: Thu Jul 26, 2007 6:48 pm    Post subject: Reply with quote

thomas_fogh wrote:
(I don't want to use the luaplayer).

Sorry, I wasn't clear enough. I meant that if you look at that code in LuaPlayer, you will understand how to do it yourself.
You actually both need the code to load the jpeg (that you can find in luaplayer's source code) AND the blitting functions from blit.c

as far as FileAssistant is concerned, google it, I'm pretty sure you'll find a link (but it's c++). or go to QJ.net, I got it there.
Back to top
View user's profile Send private message
thomas_fogh



Joined: 20 Jul 2007
Posts: 21
Location: Denmark

PostPosted: Thu Jul 26, 2007 7:16 pm    Post subject: Reply with quote

Oh, okay :) I'll look into it!
Thanks!
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development All times are GMT + 10 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group