Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Question about Interpolation  (Read 3042 times)

0 Members and 1 Guest are viewing this topic.

whitegentleman

  • Newbie
  • *
  • Posts: 6
    • View Profile
    • Email
Question about Interpolation
« on: February 18, 2013, 12:19:26 pm »
My Question is about Interpolation.
If i resize an Image, which Interpolation algo. uses SFML 2.0 as default?
Nearest neighbor interpolation ? or Bilinear interpolation? or Bicubic interpolation?
and how can i change it?

Thx in advance  :) .


Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Re: Question about Interpolation
« Reply #1 on: February 18, 2013, 12:23:07 pm »
If you zoom or stretch a sf::Texture, the interpolation mode is either:
- nearest pixel if the texture is not smoothed (texture.setSmooth(false)) -- the default
- bilinear if the texture is smoothed (texture.setSmooth(true))
Laurent Gomila - SFML developer

whitegentleman

  • Newbie
  • *
  • Posts: 6
    • View Profile
    • Email
Re: Question about Interpolation
« Reply #2 on: February 18, 2013, 12:30:56 pm »
Thx for the fast reply :)
My last question would be, will sfml get Bicubic interpolation?

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Re: Question about Interpolation
« Reply #3 on: February 18, 2013, 01:17:14 pm »
OpenGL (which SFML is based on) only provides linear and nearest pixel interpolations. If you want bicubic interpolation, you must implement it yourself with a shader.

You can take a look at this article:
http://www.codeproject.com/Articles/236394/Bi-Cubic-and-Bi-Linear-Interpolation-with-GLSL
Laurent Gomila - SFML developer