Am I doing it wrong? - filling screen with pixels

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.
Post Reply
User avatar
NÖÖB
Prole
Posts: 41
Joined: Thu Jul 31, 2008 10:57 pm
Location: Norway

Am I doing it wrong? - filling screen with pixels

Post by NÖÖB »

Hey people,
here's my first ever lua program:

Code: Select all

function love.draw()
	for ky = 0, 239 do
		for kx = 0, 319 do
			love.graphics.point( kx, ky )
		end
	end
	love.graphics.print("FPS: " .. love.timer.getFPS(), 50, 350)
end
Just filling a 320 x 240 section of the screen with pixels, and it's very slow; getting 3 FPS :oops:
Granted, my notebook (Acer Timeline) isn't very fast, but if I do the same routine in Blitz Basic, I'm getting 60 FPS..

Then I thought maybe the love.graphics.point function was slow, so I tried using .draw (1x1 pixel image) and .rect, but to no avail; about the same FPS..
User avatar
tentus
Inner party member
Posts: 1060
Joined: Sun Oct 31, 2010 7:56 pm
Location: Appalachia
Contact:

Re: Am I doing it wrong? - filling screen with pixels

Post by tentus »

What... why... that's the least efficient possible way to draw a rectangle. :shock: Just draw a single rectangle with a width of 320 and a height of 240.
Kurosuke needs beta testers
User avatar
TechnoCat
Inner party member
Posts: 1611
Joined: Thu Jul 30, 2009 12:31 am
Location: Denver, CO
Contact:

Re: Am I doing it wrong? - filling screen with pixels

Post by TechnoCat »

If you just have to be doing it pixel by pixel, look into using a framebuffer. And then only drawing your updates.
User avatar
BlackBulletIV
Inner party member
Posts: 1261
Joined: Wed Dec 29, 2010 8:19 pm
Location: Queensland, Australia
Contact:

Re: Am I doing it wrong? - filling screen with pixels

Post by BlackBulletIV »

Why don't you draw a 239x319 rectangle? Let the graphics engine do the work, because the more you leave stuff to Love, the better.

EDIT: Wow two posts while I was typing mine, lol.
User avatar
tentus
Inner party member
Posts: 1060
Joined: Sun Oct 31, 2010 7:56 pm
Location: Appalachia
Contact:

Re: Am I doing it wrong? - filling screen with pixels

Post by tentus »

But, be warned, framebuffers aren't as widely supported outside of gaming computers. I have a great work computer but it has 0 support for framebuffers, same with my netbook.
Kurosuke needs beta testers
User avatar
NÖÖB
Prole
Posts: 41
Joined: Thu Jul 31, 2008 10:57 pm
Location: Norway

Re: Am I doing it wrong? - filling screen with pixels

Post by NÖÖB »

Yeah, I forgot to mention that this was a speed test for pixel manipulation. I wanted to try and make a mode7 routine (http://en.wikipedia.org/wiki/Mode_7)
User avatar
Taehl
Dreaming in associative arrays
Posts: 1025
Joined: Mon Jan 11, 2010 5:07 am
Location: CA, USA
Contact:

Re: Am I doing it wrong? - filling screen with pixels

Post by Taehl »

Can't you just take an image and distort it? I'm pretty sure that transform matrix code that was floating around the forum would be a much better option. Better yet, just look at how this amazing demo did the ground.
Earliest Love2D supporter who can't Love anymore. Let me disable pixel shaders if I don't use them, dammit!
Lenovo Thinkpad X60 Tablet, built like a tank. But not fancy enough for Love2D 0.10.0+.
User avatar
Jasoco
Inner party member
Posts: 3725
Joined: Mon Jun 22, 2009 9:35 am
Location: Pennsylvania, USA
Contact:

Re: Am I doing it wrong? - filling screen with pixels

Post by Jasoco »

Taehl wrote:Can't you just take an image and distort it? I'm pretty sure that transform matrix code that was floating around the forum would be a much better option. Better yet, just look at how this amazing demo did the ground.
No offense to the creator, but we already had that discussion. That demo doesn't really distort the images. It just makes it look like they're distorted. They're just skewed.

Image

Löve currently has no way to distort images. If it could, it would open so many doors, but currently it can't.
Post Reply

Who is online

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