Problem with MapPixel...

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
User avatar
bmelts
Party member
Posts: 380
Joined: Fri Jan 30, 2009 3:16 am
Location: Wiscönsin
Contact:

Re: Problem with MapPixel...

Post by bmelts »

Oops. I typoed. Again. Obviously I shouldn't be coding this late. :oops:

I got the parameters reversed for the ternary parts - they should look like this:

Code: Select all

r = r > 255 and 255 or r
g = g > 255 and 255 or g
b = b > 255 and 255 or b
pekka
Party member
Posts: 206
Joined: Thu Jan 07, 2010 6:48 am
Location: Oulu, Finland
Contact:

Re: Problem with MapPixel...

Post by pekka »

MapPixel makes a lot of cross-language function calls between Lua and C++, so you should expect it to be slower than what you could do directly. There is some overhead associated with transferring data from C++ to Lua and vice versa, and if you need to do it twice for each pixel of a large image, it is going to add up. It's probably best not to think of using mapPixel every frame, but instead for one-off image transofrmations and preparing your graphics for particular uses.
User avatar
TylerKinkade
Prole
Posts: 5
Joined: Wed Feb 17, 2010 7:11 am

Re: Problem with MapPixel...

Post by TylerKinkade »

This is going to sound kind of weird but why are you using sine and cosine functions? What is the purpose? What does it benefit. And what are the uses. That is something that has been bothering me for a long time now. :(
User avatar
TechnoCat
Inner party member
Posts: 1612
Joined: Thu Jul 30, 2009 12:31 am
Location: Milwaukee, WI
Contact:

Re: Problem with MapPixel...

Post by TechnoCat »

TylerKinkade wrote:This is going to sound kind of weird but why are you using sine and cosine functions? What is the purpose? What does it benefit. And what are the uses. That is something that has been bothering me for a long time now. :(
You can get something to oscillate on and off with a sine or cosine function.
User avatar
Jasoco
Inner party member
Posts: 3727
Joined: Mon Jun 22, 2009 9:35 am
Location: Pennsylvania, USA
Contact:

Re: Problem with MapPixel...

Post by Jasoco »

Sin and Cos will create a wave. Going up and down between 1 and -1 gracefully. It's a major part of drawing in 3D too or rotating points in 2D or 3D space.
User avatar
zachwlewis
Citizen
Posts: 70
Joined: Fri Mar 19, 2010 7:58 am
Location: Huntsville, AL
Contact:

Re: Problem with MapPixel...

Post by zachwlewis »

Circles! Polar-coordinate systems! Figuring out the interior angles of anything.

Woah.
User avatar
Jasoco
Inner party member
Posts: 3727
Joined: Mon Jun 22, 2009 9:35 am
Location: Pennsylvania, USA
Contact:

Re: Problem with MapPixel...

Post by Jasoco »

Wallpaper, skyscrapers, funny papers, patterns!
Evergreens, nouvelle cuisine, human beings, patterns!
Garden rakes, wedding cakes, rattlesnakes, patterns!
Golden wheat, little feet, my heartbeat...

I gotta stop...

Patterns! Patterns! Patterns! Patterns!


Sorry.. that's what came to mind when you said that.
User avatar
zachwlewis
Citizen
Posts: 70
Joined: Fri Mar 19, 2010 7:58 am
Location: Huntsville, AL
Contact:

Re: Problem with MapPixel...

Post by zachwlewis »

Jasoco wrote:Wallpaper, skyscrapers, funny papers, patterns!
Evergreens, nouvelle cuisine, human beings, patterns!
Garden rakes, wedding cakes, rattlesnakes, patterns!
Golden wheat, little feet, my heartbeat...

I gotta stop...

Patterns! Patterns! Patterns! Patterns!


Sorry.. that's what came to mind when you said that.
Whenever I see your avatar, I want to kiss you on your mouth. Then I feel awkward, because you're not Kate Micucci.
User avatar
Jasoco
Inner party member
Posts: 3727
Joined: Mon Jun 22, 2009 9:35 am
Location: Pennsylvania, USA
Contact:

Re: Problem with MapPixel...

Post by Jasoco »

Or am I?

No. No I'm not. Sorry.
User avatar
Robin
The Omniscient
Posts: 6506
Joined: Fri Feb 20, 2009 4:29 pm
Location: The Netherlands
Contact:

Re: Problem with MapPixel...

Post by Robin »

You should just use your own picture, like all normal* people here do. :x

* Normal not guaranteed. Possible side effects may include but are not limited to: slight rashes, occasional anxiety, loss of motor control, bowel control, and/or sense of humour.
Help us help you: attach a .love.
Post Reply

Who is online

Users browsing this forum: Bing [Bot], Google [Bot] and 3 guests