Saving an upscaled texture

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
Terff
Prole
Posts: 5
Joined: Tue Sep 26, 2017 12:42 pm

Saving an upscaled texture

Post by Terff »

Hello fellow developers! Lets say I have an image 16x16, I want to upscale it to 256x256 using bilinear interpolation (like you can in love.graphics.draw) but then I want to save the new upscaled image so I can pass it to a shader. I can't seem to find a way to upscale imagedata outside of love.graphics.draw, is there any way to get the upscaled image into imagedata?
User avatar
bartbes
Sex machine
Posts: 4946
Joined: Fri Aug 29, 2008 10:35 am
Location: The Netherlands
Contact:

Re: Saving an upscaled texture

Post by bartbes »

You can't (easily) turn it into ImageData, but you can use a Canvas.
User avatar
Nixola
Inner party member
Posts: 1949
Joined: Tue Dec 06, 2011 7:11 pm
Location: Italy

Re: Saving an upscaled texture

Post by Nixola »

Why do you need to pass the upscaled image to a shader as opposed to the normal one? Can't you just let the shader do the interpolation?
lf = love.filesystem
ls = love.sound
la = love.audio
lp = love.physics
lt = love.thread
li = love.image
lg = love.graphics
Terff
Prole
Posts: 5
Joined: Tue Sep 26, 2017 12:42 pm

Re: Saving an upscaled texture

Post by Terff »

Nixola wrote: Tue Sep 26, 2017 4:00 pm Why do you need to pass the upscaled image to a shader as opposed to the normal one? Can't you just let the shader do the interpolation?
Eh thought it would be easier to have the program do it for me, I ended up implementing the interpolation in the end.
User avatar
s-ol
Party member
Posts: 1077
Joined: Mon Sep 15, 2014 7:41 pm
Location: Cologne, Germany
Contact:

Re: Saving an upscaled texture

Post by s-ol »

Terff wrote: Fri Oct 06, 2017 9:12 pm
Nixola wrote: Tue Sep 26, 2017 4:00 pm Why do you need to pass the upscaled image to a shader as opposed to the normal one? Can't you just let the shader do the interpolation?
Eh thought it would be easier to have the program do it for me, I ended up implementing the interpolation in the end.
uhm, doesn't OpenGL do it for you either way? If you just have a 'blank' shader that samples your texture, it shoul use the bilinear sampling method set with :setFilter too.

s-ol.nu /blog  -  p.s-ol.be /st8.lua  -  g.s-ol.be /gtglg /curcur

Code: Select all

print( type(love) )
if false then
  baby:hurt(me)
end
Terff
Prole
Posts: 5
Joined: Tue Sep 26, 2017 12:42 pm

Re: Saving an upscaled texture

Post by Terff »

s-ol wrote: Sat Oct 07, 2017 1:57 am
Terff wrote: Fri Oct 06, 2017 9:12 pm
Nixola wrote: Tue Sep 26, 2017 4:00 pm Why do you need to pass the upscaled image to a shader as opposed to the normal one? Can't you just let the shader do the interpolation?
Eh thought it would be easier to have the program do it for me, I ended up implementing the interpolation in the end.
uhm, doesn't OpenGL do it for you either way? If you just have a 'blank' shader that samples your texture, it shoul use the bilinear sampling method set with :setFilter too.
oof... didn't even think about that haha, that would've been easier.
Post Reply

Who is online

Users browsing this forum: Bing [Bot], Google [Bot] and 5 guests