Add support for sRGB capable framebuffers. (#175)
This commit is contained in:
parent
c4956857fa
commit
e00d160224
19 changed files with 437 additions and 183 deletions
|
@ -376,6 +376,41 @@ public:
|
|||
////////////////////////////////////////////////////////////
|
||||
bool isSmooth() const;
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Enable or disable conversion from sRGB
|
||||
///
|
||||
/// When providing texture data from an image file or memory, it can
|
||||
/// either be stored in a linear color space or an sRGB color space.
|
||||
/// Most digital images account for gamma correction already, so they
|
||||
/// would need to be "uncorrected" back to linear color space before
|
||||
/// being processed by the hardware. The hardware can automatically
|
||||
/// convert it from the sRGB color space to a linear color space when
|
||||
/// it gets sampled. When the rendered image gets output to the final
|
||||
/// framebuffer, it gets converted back to sRGB.
|
||||
///
|
||||
/// After enabling or disabling sRGB conversion, make sure to reload
|
||||
/// the texture data in order for the setting to take effect.
|
||||
///
|
||||
/// This option is only useful in conjunction with an sRGB capable
|
||||
/// framebuffer. This can be requested during window creation.
|
||||
///
|
||||
/// \param sRgb True to enable sRGB conversion, false to disable it
|
||||
///
|
||||
/// \see isSrgb
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
void setSrgb(bool sRgb);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Tell whether the texture source is converted from sRGB or not
|
||||
///
|
||||
/// \return True if the texture source is converted from sRGB, false if not
|
||||
///
|
||||
/// \see setSrgb
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
bool isSrgb() const;
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Enable or disable repeating
|
||||
///
|
||||
|
@ -504,6 +539,7 @@ private:
|
|||
Vector2u m_actualSize; ///< Actual texture size (can be greater than public size because of padding)
|
||||
unsigned int m_texture; ///< Internal texture identifier
|
||||
bool m_isSmooth; ///< Status of the smooth filter
|
||||
bool m_sRgb; ///< Should the texture source be converted from sRGB?
|
||||
bool m_isRepeated; ///< Is the texture in repeat mode?
|
||||
mutable bool m_pixelsFlipped; ///< To work around the inconsistency in Y orientation
|
||||
bool m_fboAttachment; ///< Is this texture owned by a framebuffer object?
|
||||
|
|
|
@ -55,15 +55,17 @@ struct ContextSettings
|
|||
/// \param major Major number of the context version
|
||||
/// \param minor Minor number of the context version
|
||||
/// \param attributes Attribute flags of the context
|
||||
/// \param sRgb sRGB capable framebuffer
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
explicit ContextSettings(unsigned int depth = 0, unsigned int stencil = 0, unsigned int antialiasing = 0, unsigned int major = 1, unsigned int minor = 1, unsigned int attributes = Default) :
|
||||
explicit ContextSettings(unsigned int depth = 0, unsigned int stencil = 0, unsigned int antialiasing = 0, unsigned int major = 1, unsigned int minor = 1, unsigned int attributes = Default, bool sRgb = false) :
|
||||
depthBits (depth),
|
||||
stencilBits (stencil),
|
||||
antialiasingLevel(antialiasing),
|
||||
majorVersion (major),
|
||||
minorVersion (minor),
|
||||
attributeFlags (attributes)
|
||||
attributeFlags (attributes),
|
||||
sRgbCapable (sRgb)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -76,6 +78,7 @@ struct ContextSettings
|
|||
unsigned int majorVersion; ///< Major number of the context version to create
|
||||
unsigned int minorVersion; ///< Minor number of the context version to create
|
||||
Uint32 attributeFlags; ///< The attribute flags to create the context with
|
||||
bool sRgbCapable; ///< Whether the context framebuffer is sRGB capable
|
||||
};
|
||||
|
||||
} // namespace sf
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue