| View previous topic :: View next topic |
| Author |
Message |
Danny769
Joined: 01 Feb 2006 Posts: 55
|
Posted: Wed Apr 26, 2006 1:14 pm Post subject: Image rendering |
|
|
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 |
|
 |
RanDom_ErrOr
Joined: 15 Apr 2006 Posts: 13
|
Posted: Wed Apr 26, 2006 4:12 pm Post subject: |
|
|
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 |
|
 |
Danny769
Joined: 01 Feb 2006 Posts: 55
|
Posted: Wed Apr 26, 2006 8:57 pm Post subject: |
|
|
Do you have an example as for the code for avi?
And will it look like a vid? |
|
| Back to top |
|
 |
Giuliano
Joined: 13 Sep 2005 Posts: 78
|
Posted: Thu Apr 27, 2006 4:02 am Post subject: |
|
|
| 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 |
|
 |
imhotep
Joined: 13 Dec 2005 Posts: 41
|
Posted: Thu Apr 27, 2006 5:48 am Post subject: |
|
|
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 |
|
 |
Danny769
Joined: 01 Feb 2006 Posts: 55
|
Posted: Thu Apr 27, 2006 11:18 am Post subject: |
|
|
How do i unasign a pic.
All i have been doing is loding a new on to replace it |
|
| Back to top |
|
 |
KawaGeo
Joined: 27 Aug 2005 Posts: 191 Location: Calif Mountains
|
Posted: Fri Apr 28, 2006 1:35 am Post subject: |
|
|
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 |
|
 |
Altair
Joined: 20 May 2006 Posts: 76 Location: The Netherlands
|
Posted: Sat May 20, 2006 2:40 am Post subject: |
|
|
| 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 |
|
 |
KawaGeo
Joined: 27 Aug 2005 Posts: 191 Location: Calif Mountains
|
Posted: Sat May 20, 2006 3:34 am Post subject: |
|
|
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 |
|
 |
romero126
Joined: 24 Dec 2005 Posts: 200
|
Posted: Sat May 20, 2006 5:24 am Post subject: |
|
|
| 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 |
|
 |
Altair
Joined: 20 May 2006 Posts: 76 Location: The Netherlands
|
Posted: Sat May 20, 2006 7:24 am Post subject: |
|
|
| 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 |
|
 |
romero126
Joined: 24 Dec 2005 Posts: 200
|
Posted: Sun May 21, 2006 11:12 am Post subject: |
|
|
1000x1000px?
The limits on the PSP is only 480x272px size |
|
| Back to top |
|
 |
Altair
Joined: 20 May 2006 Posts: 76 Location: The Netherlands
|
Posted: Sun May 21, 2006 11:57 am Post subject: |
|
|
| 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 |
|
 |
KawaGeo
Joined: 27 Aug 2005 Posts: 191 Location: Calif Mountains
|
Posted: Sun May 21, 2006 12:50 pm Post subject: |
|
|
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 |
|
 |
Altair
Joined: 20 May 2006 Posts: 76 Location: The Netherlands
|
Posted: Sun May 21, 2006 8:32 pm Post subject: |
|
|
| 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 |
|
 |
KawaGeo
Joined: 27 Aug 2005 Posts: 191 Location: Calif Mountains
|
Posted: Mon May 22, 2006 4:21 am Post subject: |
|
|
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 |
|
 |
Teggles
Joined: 16 Jan 2006 Posts: 27
|
Posted: Mon May 22, 2006 5:36 am Post subject: |
|
|
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 |
|
 |
romero126
Joined: 24 Dec 2005 Posts: 200
|
Posted: Mon May 22, 2006 9:14 am Post subject: |
|
|
| Im so glad teggles came to this website. Its about time. |
|
| Back to top |
|
 |
youresam
Joined: 06 Nov 2005 Posts: 87
|
Posted: Mon May 22, 2006 11:21 am Post subject: |
|
|
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 |
|
 |
KawaGeo
Joined: 27 Aug 2005 Posts: 191 Location: Calif Mountains
|
Posted: Mon May 22, 2006 1:50 pm Post subject: |
|
|
| 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 |
|
 |
Altair
Joined: 20 May 2006 Posts: 76 Location: The Netherlands
|
Posted: Tue May 23, 2006 6:22 am Post subject: |
|
|
| 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 |
|
 |
|