3D Planets

Showcase your libraries, tools and other projects that help your fellow love users.
User avatar
mickeyjm
Party member
Posts: 237
Joined: Thu Dec 29, 2011 11:41 am

Re: 3D Planets

Post by mickeyjm » Tue Jul 31, 2012 12:52 pm

Nixola wrote:Mickeyjm, that's exactly what I want to avoid. Canvas are fast and useful, it's not fair that some Windows users can't have them because Microsoft is dumb.
I mean get them to use love.graphcs.isSupported() then if it fails use ImageData otherwise, canvases
Your screen is very zoomed in...

User avatar
T-Bone
Inner party member
Posts: 1492
Joined: Thu Jun 09, 2011 9:03 am

Re: 3D Planets

Post by T-Bone » Tue Jul 31, 2012 6:00 pm

I get 150-180 FPS on my quad core i5 (3,2 GHz) Ubuntu setup.

User avatar
Ref
Party member
Posts: 682
Joined: Wed May 02, 2012 11:05 pm

Re: 3D Planets

Post by Ref » Tue Jul 31, 2012 11:05 pm

mickeyjm wrote:
Nixola wrote:Mickeyjm, that's exactly what I want to avoid. Canvas are fast and useful, it's not fair that some Windows users can't have them because Microsoft is dumb.
I mean get them to use love.graphcs.isSupported() then if it fails use ImageData otherwise, canvases
Appreciate where you're coming from.
Still fighting my way through ImageData.
Can't figure out how to direct drawing primitives to an image without using canvases.
We don't seem to have an equivalent for:
love.grahpics.setCanvas( canvas ) - something like love.graphics.setImage( image )
Guess that would essentially involve a canvas anyway.
But, if you are only dealing with pre-drawn (loaded from disk) images, you can get along pretty well.
Still looking for pointers (help) and examples - just to see how other people do it.
Conversions between userdata, imagedata & images are still a pain.
For those that are interested this is all the farther I've managed to get:
(note: I haven't found a way to convert an image to imagedata - just have to load an image as imagedata.)

Code: Select all

gr = love.graphics
-- load a host image
    host = love.image.newImageData( 'buda.png' )
-- apply an effect to host image
    host:mapPixel( effect )
-- load image to be inserted into host
    insert = love.image.newImageData( 'Linux.png' )
-- insert imagedata into host
    host:paste(insert,10,10,0,0,40,40)
-- create a drawing surface (canvas)
    canvas = love.graphics.newCanvas( 20,20)
-- direct drawing to canvas
    gr.setCanvas( canvas )
        gr.setColor(255,55,255,255)
        gr.circle('fill',10,10,8)
        gr.setCanvas()
-- convert userdata (canvas) to imagedata
    data = canvas:getImageData( )
-- add converted canvas to host imagedata
    host:paste(data,30,30,0,0,20,20)
-- convert imagedata into an image
    composite = gr.newImage(host)
-- now ready to draw composite
    gr.setColorMode('replace')
    gr.draw(composite,100,100)
Anything I missed or are using incorrectly (seems to work)?
Edit:
You can also put a image into a canvas:

Code: Select all

canvas:renderTo( function() gr.draw( image ) end )

User avatar
Xgoff
Party member
Posts: 211
Joined: Fri Nov 19, 2010 4:20 am

Re: 3D Planets

Post by Xgoff » Wed Aug 01, 2012 5:07 pm

Ref wrote:Can't figure out how to direct drawing primitives to an image without using canvases.
that's the thing... you can't. not unless you actually find/implement a software implementation of opengl. doing this with on a pixel-by-pixel basis through lua (if mapPixel and setPixel are involved) is going to be obscenely slow for just about any task you'd actually want to use canvases for anyway.

it may be possible to get some sort of canvas emulation with some horrific hodge-podge of scissoring, off-screen drawing, and cutting those areas out of screenshots (maybe, i've never used screenshots so i don't know if they always use the actual screen area or the scissor box)

User avatar
retrotails
Party member
Posts: 211
Joined: Wed Apr 18, 2012 12:37 am

Re: 3D Planets

Post by retrotails » Fri Aug 03, 2012 9:31 am

OK, so my real goal with this was to make a Pandemic clone. http://www.crazymonkeygames.com/Pandemic-2.html
You can mouse over countries and it'll tell you what they are. However, I need to use a shader to get it to function properly.
I need to send the GPU a black and white image, which is a different color for each country, and a table of how red each country is. Lets say the color of a pixel in the image I send is 0x30. That's the united states. Say the US is 50% infected. It should be turned 50% red.
How can I send a texture to a shader, and how can I get the color of a random pixel on the screen? Or do I have to send it a canvas of the entire rendered screen as a texture?

User avatar
ishkabible
Party member
Posts: 241
Joined: Sat Oct 23, 2010 7:34 pm
Location: Kansas USA

Re: 3D Planets

Post by ishkabible » Sat Aug 04, 2012 4:23 am

hold on...did I see pluto at the end there? I that the guys with degrees already went over this ;)

Ponosna
Prole
Posts: 1
Joined: Sat Aug 04, 2012 7:05 pm

Re: 3D Planets

Post by Ponosna » Sat Aug 04, 2012 7:08 pm

Planet looks great. I'm really surprised that the details are made

Post Reply

Who is online

Users browsing this forum: Google [Bot] and 6 guests