mirror of
https://github.com/SFML/CSFML.git
synced 2026-10-25 13:05:16 +01:00
Merge pull request #74 from LaurentGomila/feature/gl_improvements
Added support for context creation flags and texture/shader native handles
This commit is contained in:
commit
1486a30e2f
7 files changed
+63
No files matched your search
@@ -349,6 +349,20 @@ CSFML_GRAPHICS_API void sfShader_setTextureParameter(sfShader* shader, const cha
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API void sfShader_setCurrentTextureParameter(sfShader* shader, const char* name);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the underlying OpenGL handle of the shader.
|
||||
///
|
||||
/// You shouldn't need to use this function, unless you have
|
||||
/// very specific stuff to implement that SFML doesn't support,
|
||||
/// or implement a temporary workaround until a bug is fixed.
|
||||
///
|
||||
/// \param shader Shader object
|
||||
///
|
||||
/// \return OpenGL handle of the shader or 0 if not yet loaded
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API unsigned int sfShader_getNativeHandle(const sfShader* shader);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Bind a shader for rendering (activate it)
|
||||
///
|
||||
|
||||
@@ -229,6 +229,20 @@ CSFML_GRAPHICS_API void sfTexture_setRepeated(sfTexture* texture, sfBool repeate
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API sfBool sfTexture_isRepeated(const sfTexture* texture);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the underlying OpenGL handle of the texture.
|
||||
///
|
||||
/// You shouldn't need to use this function, unless you have
|
||||
/// very specific stuff to implement that SFML doesn't support,
|
||||
/// or implement a temporary workaround until a bug is fixed.
|
||||
///
|
||||
/// \param texture The texture object
|
||||
///
|
||||
/// \return OpenGL handle of the texture or 0 if not yet created
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API unsigned int sfTexture_getNativeHandle(const sfTexture* texture);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Bind a texture for rendering
|
||||
///
|
||||
|
||||
@@ -51,6 +51,18 @@ typedef enum
|
||||
} sfWindowStyle;
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Enumeration of the context attribute flags
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
typedef enum
|
||||
{
|
||||
sfContextDefault = 0, ///< Non-debug, compatibility context (this and the core attribute are mutually exclusive)
|
||||
sfContextCore = 1 << 0, ///< Core attribute
|
||||
sfContextDebug = 1 << 2 ///< Debug attribute
|
||||
} sfContextAttribute;
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Structure defining the window's creation settings
|
||||
///
|
||||
@@ -62,6 +74,7 @@ typedef struct
|
||||
unsigned int antialiasingLevel; ///< Level of antialiasing
|
||||
unsigned int majorVersion; ///< Major number of the context version to create
|
||||
unsigned int minorVersion; ///< Minor number of the context version to create
|
||||
sfUint32 attributeFlags; ///< The attribute flags to create the context with
|
||||
} sfContextSettings;
|
||||
|
||||
|
||||
|
||||
@@ -56,6 +56,7 @@ sfRenderWindow* sfRenderWindow_create(sfVideoMode mode, const char* title, sfUin
|
||||
params.antialiasingLevel = settings->antialiasingLevel;
|
||||
params.majorVersion = settings->majorVersion;
|
||||
params.minorVersion = settings->minorVersion;
|
||||
params.attributeFlags = settings->attributeFlags;
|
||||
}
|
||||
|
||||
// Create the window
|
||||
@@ -82,6 +83,7 @@ sfRenderWindow* sfRenderWindow_createUnicode(sfVideoMode mode, const sfUint32* t
|
||||
params.antialiasingLevel = settings->antialiasingLevel;
|
||||
params.majorVersion = settings->majorVersion;
|
||||
params.minorVersion = settings->minorVersion;
|
||||
params.attributeFlags = settings->attributeFlags;
|
||||
}
|
||||
|
||||
// Create the window
|
||||
@@ -106,6 +108,7 @@ sfRenderWindow* sfRenderWindow_createFromHandle(sfWindowHandle handle, const sfC
|
||||
params.antialiasingLevel = settings->antialiasingLevel;
|
||||
params.majorVersion = settings->majorVersion;
|
||||
params.minorVersion = settings->minorVersion;
|
||||
params.attributeFlags = settings->attributeFlags;
|
||||
}
|
||||
|
||||
// Create the window
|
||||
@@ -151,6 +154,7 @@ sfContextSettings sfRenderWindow_getSettings(const sfRenderWindow* renderWindow)
|
||||
settings.antialiasingLevel = params.antialiasingLevel;
|
||||
settings.majorVersion = params.majorVersion;
|
||||
settings.minorVersion = params.minorVersion;
|
||||
settings.attributeFlags = params.attributeFlags;
|
||||
|
||||
return settings;
|
||||
}
|
||||
|
||||
@@ -217,6 +217,13 @@ void sfShader_setCurrentTextureParameter(sfShader* shader, const char* name)
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
unsigned int sfShader_getNativeHandle(const sfShader* shader)
|
||||
{
|
||||
CSFML_CALL_RETURN(shader, getNativeHandle(), 0);
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
void sfShader_bind(const sfShader* shader)
|
||||
{
|
||||
|
||||
@@ -242,6 +242,13 @@ sfBool sfTexture_isRepeated(const sfTexture* texture)
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
unsigned int sfTexture_getNativeHandle(const sfTexture* texture)
|
||||
{
|
||||
CSFML_CALL_PTR_RETURN(texture, getNativeHandle(), 0);
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
void sfTexture_bind(const sfTexture* texture)
|
||||
{
|
||||
|
||||
@@ -46,6 +46,7 @@ sfWindow* sfWindow_create(sfVideoMode mode, const char* title, sfUint32 style, c
|
||||
params.antialiasingLevel = settings->antialiasingLevel;
|
||||
params.majorVersion = settings->majorVersion;
|
||||
params.minorVersion = settings->minorVersion;
|
||||
params.attributeFlags = settings->attributeFlags;
|
||||
}
|
||||
|
||||
// Create the window
|
||||
@@ -70,6 +71,7 @@ sfWindow* sfWindow_createUnicode(sfVideoMode mode, const sfUint32* title, sfUint
|
||||
params.antialiasingLevel = settings->antialiasingLevel;
|
||||
params.majorVersion = settings->majorVersion;
|
||||
params.minorVersion = settings->minorVersion;
|
||||
params.attributeFlags = settings->attributeFlags;
|
||||
}
|
||||
|
||||
// Create the window
|
||||
@@ -92,6 +94,7 @@ sfWindow* sfWindow_createFromHandle(sfWindowHandle handle, const sfContextSettin
|
||||
params.antialiasingLevel = settings->antialiasingLevel;
|
||||
params.majorVersion = settings->majorVersion;
|
||||
params.minorVersion = settings->minorVersion;
|
||||
params.attributeFlags = settings->attributeFlags;
|
||||
}
|
||||
|
||||
// Create the window
|
||||
@@ -134,6 +137,7 @@ sfContextSettings sfWindow_getSettings(const sfWindow* window)
|
||||
settings.antialiasingLevel = params.antialiasingLevel;
|
||||
settings.majorVersion = params.majorVersion;
|
||||
settings.minorVersion = params.minorVersion;
|
||||
settings.attributeFlags = params.attributeFlags;
|
||||
|
||||
return settings;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user