Page 1 of 1

Help with this out-of-date wiki page - missing pig.png

Posted: Fri Jun 09, 2023 12:10 pm
by togFox
Hoping to learn about meshes and reviewed this page:

https://love2d.org/wiki/love.graphics.newMesh

Towards the bottom of the page, there are three examples and two of them are broken. The example code refers to pig.png.

For example:

Code: Select all

function love.load()
	image = love.graphics.newImage("pig.png")
Is there any way to source the pig file (is it the Love2d pig?) and make it available on the wiki page.

I'm assuming the pig is a legacy thing - how to restore/correct?

Thanks.

Re: Help with this out-of-date wiki page - missing pig.png

Posted: Fri Jun 09, 2023 1:08 pm
by Hugues Ross
I assume that was just used as an example texture--you could include any PNG file in your project and call it pig.png, no? I'm not sure why the exact image would need to be provided, at a glance it doesn't look like there's any sort of fancy UV mapping happening in the examples.

Re: Help with this out-of-date wiki page - missing pig.png

Posted: Fri Jun 09, 2023 10:45 pm
by togFox
Wouldn't the vertices and mesh in the example need to align with the image dimensions?

Re: Help with this out-of-date wiki page - missing pig.png

Posted: Fri Jun 09, 2023 10:58 pm
by Hugues Ross
The first example is a rectangle of dimensions image width x image height, and the second appears to just be a circle. If you wanted the image to be completely unscaled, any ol' 100x100px image will do--but regardless of what your image's actual aspect ratio is the uvs in that one will just stretch it to fit.

It'd be cool to see pig.png, it's probably pretty cute, but I really think you can use any texture with these and get the correct result.

I don't know your skill level, so apologies if the following is just stating the obvious. But just in case anyone looking at this thread doesn't know, UVs are on a scale of 0-1 which maps to the dimension of the texture when sampling on the GPU. You can take any two images, and regardless of their dimensions you'll get the same relative regions from one set of UVs. Thus, when the UVs are just a rectangle covering the whole thing and a circle covering the whole thing there's no difference between what parts of the images will show up.

Re: Help with this out-of-date wiki page - missing pig.png

Posted: Fri Jun 09, 2023 11:43 pm
by GVovkiv
https://love2d.org/wiki/File:lovecoordsystem.png - i failed to found original, but that's how this pig looks like

Re: Help with this out-of-date wiki page - missing pig.png

Posted: Sat Jun 10, 2023 11:06 am
by UnixRoot
togFox wrote: Fri Jun 09, 2023 10:45 pm Wouldn't the vertices and mesh in the example need to align with the image dimensions?
Image dimensions don't matter, as UV coordinates are normalized values in the 0-1 range.

Re: Help with this out-of-date wiki page - missing pig.png

Posted: Sat Jun 10, 2023 7:56 pm
by pgimeno
I think the original pig.png that the wiki uses as example is this one: https://github.com/love2d/love/blob/mai ... es/pig.png