Allaric Posted December 16, 2014 Share Posted December 16, 2014 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 Quote Link to comment Share on other sites More sharing options...
Guppy Posted December 16, 2014 Share Posted December 16, 2014 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 1 Quote 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 More sharing options...
nick.ace Posted December 16, 2014 Share Posted December 16, 2014 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. Quote Link to comment Share on other sites More sharing options...
Allaric Posted December 16, 2014 Author Share Posted December 16, 2014 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. Quote Link to comment Share on other sites More sharing options...
nick.ace Posted December 16, 2014 Share Posted December 16, 2014 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). Quote Link to comment Share on other sites More sharing options...
Allaric Posted December 17, 2014 Author Share Posted December 17, 2014 I totally wasn't getting that the DrawImage had a scale function built right it. I don't know how I missed that. Thanks for not calling me out on that. I earned it, but it is nice that I slipped one by! 1 Quote Link to comment Share on other sites More sharing options...
nick.ace Posted December 18, 2014 Share Posted December 18, 2014 Haha, no worries, things like this slip by me too often as well! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.