Jump to content

2D Texture Stretched


Allaric
 Share

Recommended Posts

Hello,

 

I have created a 2D 1600 x 160 pixel .PNG in GIMP that I placed into the Leadwerks folder. When I open the image in Leadwerks it is distorted to 2048 x 128. I have tried to adjust compression, reload the image several times but it just remains in the distorted shape. When I open it in paint, or another program it is the proper 1600x160 size.

 

I have looked for a way to scale this 2D image in Leadwerks, but have not been successful. Can anyone please point me in the right direction on why this is importing with distorted dimensions, or how I can scale this 2D image in Lua so that it will display properly? I could use help with both because if I change resolutions I would like rescale the 2D image appropriately.

 

Thanks for the help,

 

Allaric

Link to comment
Share on other sites

Computers are more comfortable with things being power of two because you can optimized that quite heavily.

 

or to put it another way stick to resolutions where x & y are one of 128,256,512,1024,2048,4096

  • Upvote 1

System:

Linux Mint 17 ( = Ubuntu 14.04 with cinnamon desktop ) Ubuntu 14.04, AMD HD 6850, i5 2500k

Link to comment
Share on other sites

Computers are more comfortable with things being power of two because you can optimized that quite heavily.

 

or to put it another way stick to resolutions where x & y are one of 128,256,512,1024,2048,4096

 

That's spot on, but if you really NEED 1600x160, then you should make a 2048x256 image and just add transparency around the 1600x600 part. I'm not sure if Leadwerks automatically scales to the closest power of two, but in your case it seems like it did.

Link to comment
Share on other sites

Perfect, thanks. I will adjust the image size.

 

Is there a way to scale the 2D image at runtime as well? This is an image I am throwing up on the screen, and I would like to be able to adjust it to the resolution if needed. I didn't see any commands to scale it in the Lua command reference.

Link to comment
Share on other sites

Load your texture with this:

 

http://www.leadwerks.com/werkspace/page/documentation/_/command-reference/texture/textureload-r341

 

Then, do this (the command has scaling parameters):

 

http://www.leadwerks.com/werkspace/page/documentation/_/command-reference/context/contextdrawimage-r721

 

Yes, textures can be used as 2D images (check App.lua or FPSPlayer.lua, I forget which one, but it shows how to do this).

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...