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

General discussion about LÖVE, Lua, game development, puns, and unicorns.
Post Reply
User avatar
togFox
Party member
Posts: 770
Joined: Sat Jan 30, 2021 9:46 am
Location: Brisbane, Oztralia

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

Post 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.
Current project:
https://togfox.itch.io/backyard-gridiron-manager
American football manager/sim game - build and manage a roster and win season after season
User avatar
Hugues Ross
Citizen
Posts: 85
Joined: Fri Oct 22, 2021 9:18 pm
Location: Quebec
Contact:

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

Post 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.
User avatar
togFox
Party member
Posts: 770
Joined: Sat Jan 30, 2021 9:46 am
Location: Brisbane, Oztralia

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

Post by togFox »

Wouldn't the vertices and mesh in the example need to align with the image dimensions?
Current project:
https://togfox.itch.io/backyard-gridiron-manager
American football manager/sim game - build and manage a roster and win season after season
User avatar
Hugues Ross
Citizen
Posts: 85
Joined: Fri Oct 22, 2021 9:18 pm
Location: Quebec
Contact:

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

Post 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.
User avatar
UnixRoot
Citizen
Posts: 80
Joined: Mon Nov 08, 2021 8:10 am

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

Post 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.
User avatar
pgimeno
Party member
Posts: 3544
Joined: Sun Oct 18, 2015 2:58 pm

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

Post 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
Post Reply

Who is online

Users browsing this forum: No registered users and 53 guests