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 

Image rendering

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



Joined: 01 Feb 2006
Posts: 55

PostPosted: Wed Apr 26, 2006 1:14 pm    Post subject: Image rendering Reply with quote

I need to load several images in sequence to imatate a movie.
All it does is crash

I currently load a picture in place for background, and then bliz it and flip it.

It does about 9 and then crashes.
Any ideas?

I need closer to 200 images to load, and yes i relize that is asking alot of lua, but how would i go about doing it, in a maner that will work
Back to top
View user's profile Send private message
RanDom_ErrOr



Joined: 15 Apr 2006
Posts: 13

PostPosted: Wed Apr 26, 2006 4:12 pm    Post subject: Reply with quote

wouldnt it be easier to make a .gif or a .avi and then render that as a texture onto a sprite that is the same size as the screen (or whatever size you need)

that way you can do things like dynamic resizing, layering, alpha transperiencies... etc... etc... etc...
Back to top
View user's profile Send private message
Danny769



Joined: 01 Feb 2006
Posts: 55

PostPosted: Wed Apr 26, 2006 8:57 pm    Post subject: Reply with quote

Do you have an example as for the code for avi?

And will it look like a vid?
Back to top
View user's profile Send private message
Giuliano



Joined: 13 Sep 2005
Posts: 78

PostPosted: Thu Apr 27, 2006 4:02 am    Post subject: Reply with quote

Why do you need to load 200 images and how big are they ? I can't think of a reason why you would need this, the best way is to load each as necessary (ie: if in a game env't then load necessary imgs for each level)
Back to top
View user's profile Send private message
imhotep



Joined: 13 Dec 2005
Posts: 41

PostPosted: Thu Apr 27, 2006 5:48 am    Post subject: Reply with quote

1. code please
2. use timers and load a new image when timer:time()>timelimit
3. don't load all images before the loop, the psp doesn't have that much resources
4. unassign the old picture when the new one is blitted
5. oldpic=""
Back to top
View user's profile Send private message
Danny769



Joined: 01 Feb 2006
Posts: 55

PostPosted: Thu Apr 27, 2006 11:18 am    Post subject: Reply with quote

How do i unasign a pic.

All i have been doing is loding a new on to replace it
Back to top
View user's profile Send private message
KawaGeo



Joined: 27 Aug 2005
Posts: 191
Location: Calif Mountains

PostPosted: Fri Apr 28, 2006 1:35 am    Post subject: Reply with quote

No need to unassign anything in Lua. Use the same variable name for a new value of *any* type. Lua has a built-in garbage collector to take care of cleaning up inside.
_________________
Geo Massar
Retired Engineer
Back to top
View user's profile Send private message Send e-mail
Altair



Joined: 20 May 2006
Posts: 76
Location: The Netherlands

PostPosted: Sat May 20, 2006 2:40 am    Post subject: Reply with quote

Yeah i was wondering how that works. It doesn't clean it up when you use another variable, right? Because if i do that and i don't empty the old var. myself, it crashes if i do that a couple of times.
Back to top
View user's profile Send private message
KawaGeo



Joined: 27 Aug 2005
Posts: 191
Location: Calif Mountains

PostPosted: Sat May 20, 2006 3:34 am    Post subject: Reply with quote

All global non-nil variables can be left untouched in the namespace. It has been advised to declare all variables as locals if possible since they can be garbage-collected sooner or later automatically.

All parameters in every Lua function are locals.
_________________
Geo Massar
Retired Engineer
Back to top
View user's profile Send private message Send e-mail
romero126



Joined: 24 Dec 2005
Posts: 200

PostPosted: Sat May 20, 2006 5:24 am    Post subject: Reply with quote

The crash sounds like a memory error, try freeing up images as you display them and dont load them all up at once. That could possibly be your biggest issue.
Back to top
View user's profile Send private message
Altair



Joined: 20 May 2006
Posts: 76
Location: The Netherlands

PostPosted: Sat May 20, 2006 7:24 am    Post subject: Reply with quote

romero126 wrote:
The crash sounds like a memory error, try freeing up images as you display them and dont load them all up at once. That could possibly be your biggest issue.


Yeah thats what i figured. I clear the images, but it crashes always (if it crashes) at the moment it loads four 1000x1000 images after eachother. However it doesn't crash alot anymore, since i clear the unused images. I guess i dont clear everything. I'll look for more stuff i can kick out of the memory.
Back to top
View user's profile Send private message
romero126



Joined: 24 Dec 2005
Posts: 200

PostPosted: Sun May 21, 2006 11:12 am    Post subject: Reply with quote

1000x1000px?

The limits on the PSP is only 480x272px size
Back to top
View user's profile Send private message
Altair



Joined: 20 May 2006
Posts: 76
Location: The Netherlands

PostPosted: Sun May 21, 2006 11:57 am    Post subject: Reply with quote

romero126 wrote:
1000x1000px?

The limits on the PSP is only 480x272px size


nope thats the resolution of the screen. I use 1000x1000 images but ofcourse can only blit part of it to the screen.
Back to top
View user's profile Send private message
KawaGeo



Joined: 27 Aug 2005
Posts: 191
Location: Calif Mountains

PostPosted: Sun May 21, 2006 12:50 pm    Post subject: Reply with quote

A single 1000x1000 image loaded would eat up about 4MB of VRAM, would it?

The VRAM is only 32MB in PSP, I believe.

PS Is it VRAM or just RAM?
_________________
Geo Massar
Retired Engineer
Back to top
View user's profile Send private message Send e-mail
Altair



Joined: 20 May 2006
Posts: 76
Location: The Netherlands

PostPosted: Sun May 21, 2006 8:32 pm    Post subject: Reply with quote

i dont know if its vram or ram, but the image itself is only 58 kB. Well thats the biggest. The others are smaller. I also have a 11 kB one.
Back to top
View user's profile Send private message
KawaGeo



Joined: 27 Aug 2005
Posts: 191
Location: Calif Mountains

PostPosted: Mon May 22, 2006 4:21 am    Post subject: Reply with quote

Aren't they all compressed before loading?

When loaded unto the memory, each image is uncompressed, that's, pixel by pixel, correct?
_________________
Geo Massar
Retired Engineer
Back to top
View user's profile Send private message Send e-mail
Teggles



Joined: 16 Jan 2006
Posts: 27

PostPosted: Mon May 22, 2006 5:36 am    Post subject: Reply with quote

LuaPlayer cannot support loading images larger than 512x512. Fact.

For your "animation", you'd do something like this:


image = Image.load("")
screen:clear()
screen:blit(0, 0, image)
screen.flip()
image = Image.load("")
screen.waitVblankStart(25)

...then back to the screen:clear and go from there. The vBlank function is how long it will stay on screen. Note this is only an example.
Back to top
View user's profile Send private message
romero126



Joined: 24 Dec 2005
Posts: 200

PostPosted: Mon May 22, 2006 9:14 am    Post subject: Reply with quote

Im so glad teggles came to this website. Its about time.
Back to top
View user's profile Send private message
youresam



Joined: 06 Nov 2005
Posts: 87

PostPosted: Mon May 22, 2006 11:21 am    Post subject: Reply with quote

I have heard that LuaPlayer can load 1000x1000 jpgs, but I havent tried it out.

I was helping someone out with code today, and the same thing happened. For some reason, a 480x272 image takes up exactly 1mb RAM. Now, with Lowser, Lua has only 16mb to use.



As for how to remove images, you should.
theimage = nil
collectgarbage()

that will remove the image from memory then garbage collect to rid of it forever.
Back to top
View user's profile Send private message AIM Address
KawaGeo



Joined: 27 Aug 2005
Posts: 191
Location: Calif Mountains

PostPosted: Mon May 22, 2006 1:50 pm    Post subject: Reply with quote

youresam wrote:
... a 480x272 image takes up exactly 1mb RAM.


Are you referring to the double buffer which occupies exactly 1 MB in the memory space, 4 bytes for the front and 4 for the back buffer?

That explains why the funny number of 272 for the height.
_________________
Geo Massar
Retired Engineer
Back to top
View user's profile Send private message Send e-mail
Altair



Joined: 20 May 2006
Posts: 76
Location: The Netherlands

PostPosted: Tue May 23, 2006 6:22 am    Post subject: Reply with quote

Ok im getting a little tired of this. How about you guys try something out yourself first. Im using a 1000x1000 JPG image of 58 kB and it works. It wont work with PNG but it does with JPG. And yoursam I was the one who told you this remember?
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 Lua Player 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