hi,
if i use setpixel on an image is this change reflected in a later call to getpixel? also, how fast is setpixel? and how are you keeping the local image data in sync with the opengl textures? Are you keeping a local copy of the image data and then reading/writing to that? or are you doing everything to the opengl texture itself? (which i imagine would be slow)
i just plan to write a fairly getpixel/setpixel intensive game (a la worms) so i need to know the performance characteristics, thanks
how fast is getpixel and setpixel?
- bartbes
- Sex machine
- Posts: 4946
- Joined: Fri Aug 29, 2008 10:35 am
- Location: The Netherlands
- Contact:
Re: how fast is getpixel and setpixel?
I thought get/setPixel acted on ImageData, so I don't think that an image object created before the setPixel call will change when you call setPixel. About the speed, in my relatively simple tests it was pretty fast, but the simple answer is: nobody knows.
Re: how fast is getpixel and setpixel?
@bartbes
hmm, sorry im new to Love. So i cannot directly modify an Image? My problem is i need to modify an image that i am displaying on screen. How do i do this? or must i convert between Image and ImageData (which i imagine would be slow...?)
thanks
hmm, sorry im new to Love. So i cannot directly modify an Image? My problem is i need to modify an image that i am displaying on screen. How do i do this? or must i convert between Image and ImageData (which i imagine would be slow...?)
thanks
- bartbes
- Sex machine
- Posts: 4946
- Joined: Fri Aug 29, 2008 10:35 am
- Location: The Netherlands
- Contact:
Re: how fast is getpixel and setpixel?
Well, of course there's love.graphics.point, which might be what you're looking for, and ImageData -> Image is done using love.graphics.newImage.
Re: how fast is getpixel and setpixel?
@bartbes, it seems that graphics.point draws a pixel on the framebuffer? what i want is to set and get pixels on an Image that i am currently displaying.
I assume this is not yet possible? (at least with very good performance)
I assume this is not yet possible? (at least with very good performance)
- bartbes
- Sex machine
- Posts: 4946
- Joined: Fri Aug 29, 2008 10:35 am
- Location: The Netherlands
- Contact:
Re: how fast is getpixel and setpixel?
I don't see the purpose, doesn't either setPixel or love.graphics.point work?
Re: how fast is getpixel and setpixel?
The purpose is that i need to manipulate a particular image (not just draw on the framebuffer) and that i need also to be able to do a getpixel on the image. Say for example i have an image that is landscape, and i want the ability to blow up the landscape then i want to be able to do a setpixel on the image. But because it is landscape i also need to move over it using pixelperfect collisions, so i also need to have a getpixel on the image. So i need both a fast setpixel and getpixel for a regular image and it needs to be very fast (so i cant imagine converting between imagedata and image is going to be fast enough :/)
Re: how fast is getpixel and setpixel?
One solution could be having a table with exploded pixels, and after the terrain is drawn draw the background again at those pixels. If collisions are important you could let the physic function (which I guess is self made) skip collisions with those pixels. It would speed up the game even when more than half of the landscape is blown up
Re: how fast is getpixel and setpixel?
@kalle thanks However it does seem like quite a weird limitation with Love that i cannot do some simple image manipulation like i want..
- Robin
- The Omniscient
- Posts: 6506
- Joined: Fri Feb 20, 2009 4:29 pm
- Location: The Netherlands
- Contact:
Re: how fast is getpixel and setpixel?
I think that's a design choice: pixel manipulation is very low-level, far from the ultra rapid game development LÖVE was made for.plymouth wrote:it does seem like quite a weird limitation with Love that i cannot do some simple image manipulation like i want..
Help us help you: attach a .love.
Who is online
Users browsing this forum: Google [Bot] and 3 guests