mirror of
https://github.com/SFML/SFML.git
synced 2024-11-25 04:41:05 +08:00
Replaced GLEW with (a highly customized) loader generated by glLoadGen, restructured GLExtensions.hpp for easier extension bookkeeping, make use of GLEXT definitions in Shader.cpp and Texture.cpp as well, replaced GL_MAX_TEXTURE_COORDS with GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS, implemented flags for requesting a debug or core/compatibility profile context, changed the default context version from 2.0 to 2.1.
This commit is contained in:
parent
ea2bf65186
commit
3e397bff4b
@ -1,65 +0,0 @@
|
||||
#
|
||||
# Try to find GLEW library and include path.
|
||||
# Once done this will define
|
||||
#
|
||||
# GLEW_FOUND
|
||||
# GLEW_INCLUDE_PATH
|
||||
# GLEW_LIBRARY
|
||||
#
|
||||
|
||||
IF (WIN32)
|
||||
FIND_PATH( GLEW_INCLUDE_PATH GL/glew.h
|
||||
$ENV{PROGRAMFILES}/GLEW/include
|
||||
${GLEW_ROOT_DIR}/include
|
||||
DOC "The directory where GL/glew.h resides")
|
||||
|
||||
IF (NV_SYSTEM_PROCESSOR STREQUAL "AMD64")
|
||||
FIND_LIBRARY( GLEW_LIBRARY
|
||||
NAMES glew64 glew64s
|
||||
PATHS
|
||||
$ENV{PROGRAMFILES}/GLEW/lib
|
||||
${PROJECT_SOURCE_DIR}/src/nvgl/glew/bin
|
||||
${PROJECT_SOURCE_DIR}/src/nvgl/glew/lib
|
||||
DOC "The GLEW library (64-bit)"
|
||||
)
|
||||
ELSE(NV_SYSTEM_PROCESSOR STREQUAL "AMD64")
|
||||
FIND_LIBRARY( GLEW_LIBRARY
|
||||
NAMES glew GLEW glew32 glew32s
|
||||
PATHS
|
||||
$ENV{PROGRAMFILES}/GLEW/lib
|
||||
${PROJECT_SOURCE_DIR}/src/nvgl/glew/bin
|
||||
${PROJECT_SOURCE_DIR}/src/nvgl/glew/lib
|
||||
DOC "The GLEW library"
|
||||
)
|
||||
ENDIF(NV_SYSTEM_PROCESSOR STREQUAL "AMD64")
|
||||
ELSE (WIN32)
|
||||
FIND_PATH( GLEW_INCLUDE_PATH GL/glew.h
|
||||
/usr/include
|
||||
/usr/local/include
|
||||
/sw/include
|
||||
/opt/local/include
|
||||
${GLEW_ROOT_DIR}/include
|
||||
DOC "The directory where GL/glew.h resides")
|
||||
|
||||
FIND_LIBRARY( GLEW_LIBRARY
|
||||
NAMES GLEW glew
|
||||
PATHS
|
||||
/usr/lib64
|
||||
/usr/lib
|
||||
/usr/local/lib64
|
||||
/usr/local/lib
|
||||
/sw/lib
|
||||
/opt/local/lib
|
||||
${GLEW_ROOT_DIR}/lib
|
||||
DOC "The GLEW library")
|
||||
ENDIF (WIN32)
|
||||
|
||||
SET(GLEW_FOUND "NO")
|
||||
IF (GLEW_INCLUDE_PATH AND GLEW_LIBRARY)
|
||||
SET(GLEW_LIBRARIES ${GLEW_LIBRARY})
|
||||
SET(GLEW_FOUND "YES")
|
||||
ENDIF (GLEW_INCLUDE_PATH AND GLEW_LIBRARY)
|
||||
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(GLEW DEFAULT_MSG GLEW_LIBRARY GLEW_INCLUDE_PATH)
|
@ -308,11 +308,10 @@ if(SFML_STATIC_LIBRARIES)
|
||||
|
||||
# find libraries
|
||||
find_sfml_dependency(FREETYPE_LIBRARY "FreeType" freetype)
|
||||
find_sfml_dependency(GLEW_LIBRARY "GLEW" glew GLEW glew32 glew32s glew64 glew64s)
|
||||
find_sfml_dependency(JPEG_LIBRARY "libjpeg" jpeg)
|
||||
|
||||
# update the list
|
||||
set(SFML_GRAPHICS_DEPENDENCIES ${FREETYPE_LIBRARY} ${GLEW_LIBRARY} ${JPEG_LIBRARY})
|
||||
set(SFML_GRAPHICS_DEPENDENCIES ${FREETYPE_LIBRARY} ${JPEG_LIBRARY})
|
||||
set(SFML_DEPENDENCIES ${SFML_GRAPHICS_DEPENDENCIES} ${SFML_DEPENDENCIES})
|
||||
endif()
|
||||
|
||||
|
15343
extlibs/headers/GL/glew.h
vendored
15343
extlibs/headers/GL/glew.h
vendored
File diff suppressed because it is too large
Load Diff
1537
extlibs/headers/GL/glxew.h
vendored
1537
extlibs/headers/GL/glxew.h
vendored
File diff suppressed because it is too large
Load Diff
1287
extlibs/headers/GL/wglew.h
vendored
1287
extlibs/headers/GL/wglew.h
vendored
File diff suppressed because it is too large
Load Diff
BIN
extlibs/libs-mingw/x64/libglew32.a
vendored
BIN
extlibs/libs-mingw/x64/libglew32.a
vendored
Binary file not shown.
BIN
extlibs/libs-mingw/x86/libglew.a
vendored
BIN
extlibs/libs-mingw/x86/libglew.a
vendored
Binary file not shown.
BIN
extlibs/libs-msvc/x64/glew.lib
vendored
BIN
extlibs/libs-msvc/x64/glew.lib
vendored
Binary file not shown.
BIN
extlibs/libs-msvc/x86/glew.lib
vendored
BIN
extlibs/libs-msvc/x86/glew.lib
vendored
Binary file not shown.
BIN
extlibs/libs-osx/lib/libGLEW.a
vendored
BIN
extlibs/libs-osx/lib/libGLEW.a
vendored
Binary file not shown.
@ -35,6 +35,17 @@ namespace sf
|
||||
////////////////////////////////////////////////////////////
|
||||
struct ContextSettings
|
||||
{
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Enumeration of the context attribute flags
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
enum Attribute
|
||||
{
|
||||
Default = 0, ///< Non-debug, compatibility context (this and the core attribute are mutually exclusive)
|
||||
Core = 1 << 0, ///< Core attribute
|
||||
Debug = 1 << 2 ///< Debug attribute
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Default constructor
|
||||
///
|
||||
@ -43,14 +54,16 @@ struct ContextSettings
|
||||
/// \param antialiasing Antialiasing level
|
||||
/// \param major Major number of the context version
|
||||
/// \param minor Minor number of the context version
|
||||
/// \param attributes Attribute flags of the context
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
explicit ContextSettings(unsigned int depth = 0, unsigned int stencil = 0, unsigned int antialiasing = 0, unsigned int major = 2, unsigned int minor = 0) :
|
||||
explicit ContextSettings(unsigned int depth = 0, unsigned int stencil = 0, unsigned int antialiasing = 0, unsigned int major = 2, unsigned int minor = 1, unsigned int attributes = Default) :
|
||||
depthBits (depth),
|
||||
stencilBits (stencil),
|
||||
antialiasingLevel(antialiasing),
|
||||
majorVersion (major),
|
||||
minorVersion (minor)
|
||||
minorVersion (minor),
|
||||
attributeFlags (attributes)
|
||||
{
|
||||
}
|
||||
|
||||
@ -62,6 +75,7 @@ struct ContextSettings
|
||||
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
|
||||
Uint32 attributeFlags; ///< The attribute flags to create the context with
|
||||
};
|
||||
|
||||
} // namespace sf
|
||||
@ -76,10 +90,11 @@ struct ContextSettings
|
||||
///
|
||||
/// ContextSettings allows to define several advanced settings
|
||||
/// of the OpenGL context attached to a window. All these
|
||||
/// settings have no impact on the regular SFML rendering
|
||||
/// (graphics module) -- except the anti-aliasing level, so
|
||||
/// you may need to use this structure only if you're using
|
||||
/// SFML as a windowing system for custom OpenGL rendering.
|
||||
/// settings with the exception of the compatibility flag
|
||||
/// and anti-aliasing level have no impact on the regular
|
||||
/// SFML rendering (graphics module), so you may need to use
|
||||
/// this structure only if you're using SFML as a windowing
|
||||
/// system for custom OpenGL rendering.
|
||||
///
|
||||
/// The depthBits and stencilBits members define the number
|
||||
/// of bits per pixel requested for the (respectively) depth
|
||||
@ -94,6 +109,32 @@ struct ContextSettings
|
||||
/// all handled the same way (i.e. you can use any version
|
||||
/// < 3.0 if you don't want an OpenGL 3 context).
|
||||
///
|
||||
/// When requesting a context with a version greater or equal
|
||||
/// to 3.2, you have the option of specifying whether the
|
||||
/// context should follow the core or compatibility profile
|
||||
/// of all newer (>= 3.2) OpenGL specifications. For versions
|
||||
/// 3.0 and 3.1 there is only the core profile. By default
|
||||
/// a compatibility context is created. You only need to specify
|
||||
/// the core flag if you want a core profile context to use with
|
||||
/// your own OpenGL rendering.
|
||||
/// <b>Warning: The graphics module will not function if you
|
||||
/// request a core profile context. Make sure the attributes are
|
||||
/// set to Default if you want to use the graphics module.</b>
|
||||
///
|
||||
/// Setting the debug attribute flag will request a context with
|
||||
/// additional debugging features enabled. Depending on the
|
||||
/// system, this might be required for advanced OpenGL debugging.
|
||||
/// OpenGL debugging is disabled by default.
|
||||
///
|
||||
/// <b>Special Note for OS X:</b>
|
||||
/// Apple only supports choosing between either a legacy context
|
||||
/// (OpenGL 2.1) or a core context (OpenGL version depends on the
|
||||
/// operating system version but is at least 3.2). Compatibility
|
||||
/// contexts are not supported. Further information is available on the
|
||||
/// <a href="https://developer.apple.com/opengl/capabilities/index.html">
|
||||
/// OpenGL Capabilities Tables</a> page. OS X also currently does
|
||||
/// not support debug contexts.
|
||||
///
|
||||
/// Please note that these values are only a hint.
|
||||
/// No failure will be reported if one or more of these values
|
||||
/// are not supported by the system; instead, SFML will try to
|
||||
|
@ -32,7 +32,5 @@ External libraries used by SFML
|
||||
* libjpeg is public domain
|
||||
* stb_image and stb_image_write are public domain
|
||||
* freetype is under the FreeType license or the GPL license
|
||||
* GLEW is under the modified BSD License, the Mesa 3-D License (MIT License), and the Khronos License (MIT License)
|
||||
* libogg is under the BSD license
|
||||
* libvorbis is under the BSD license
|
||||
* libogg is under the BSD license* libvorbis is under the BSD license
|
||||
* libflac is under the BSD license
|
||||
|
@ -46,6 +46,10 @@ set(SRC
|
||||
${SRCROOT}/Vertex.cpp
|
||||
${INCROOT}/Vertex.hpp
|
||||
)
|
||||
if(NOT SFML_OPENGL_ES)
|
||||
list(APPEND SRC ${SRCROOT}/GLLoader.cpp)
|
||||
list(APPEND SRC ${SRCROOT}/GLLoader.hpp)
|
||||
endif()
|
||||
source_group("" FILES ${SRC})
|
||||
|
||||
# drawables sources
|
||||
@ -101,11 +105,10 @@ endif()
|
||||
# find external libraries
|
||||
if(NOT SFML_OPENGL_ES)
|
||||
find_package(OpenGL REQUIRED)
|
||||
find_package(GLEW REQUIRED)
|
||||
if(SFML_OS_LINUX)
|
||||
find_package(X11 REQUIRED)
|
||||
endif()
|
||||
include_directories(${FREETYPE_INCLUDE_DIRS} ${GLEW_INCLUDE_PATH} ${JPEG_INCLUDE_DIR} ${OPENGL_INCLUDE_DIR})
|
||||
include_directories(${FREETYPE_INCLUDE_DIRS} ${JPEG_INCLUDE_DIR} ${OPENGL_INCLUDE_DIR})
|
||||
endif()
|
||||
if(SFML_OPENGL_ES AND SFML_OS_LINUX)
|
||||
find_package(EGL REQUIRED)
|
||||
@ -123,7 +126,7 @@ include_directories(${FREETYPE_INCLUDE_DIRS} ${JPEG_INCLUDE_DIR})
|
||||
|
||||
# build the list of external libraries to link
|
||||
if(NOT SFML_OPENGL_ES)
|
||||
list(APPEND GRAPHICS_EXT_LIBS ${GLEW_LIBRARY} ${OPENGL_gl_LIBRARY})
|
||||
list(APPEND GRAPHICS_EXT_LIBS ${OPENGL_gl_LIBRARY})
|
||||
if(SFML_OS_LINUX)
|
||||
list(APPEND GRAPHICS_EXT_LIBS ${X11_LIBRARIES})
|
||||
endif()
|
||||
@ -139,9 +142,6 @@ endif()
|
||||
list(APPEND GRAPHICS_EXT_LIBS ${FREETYPE_LIBRARY} ${JPEG_LIBRARY})
|
||||
|
||||
# add preprocessor symbols
|
||||
if(NOT SFML_OPENGL_ES)
|
||||
add_definitions(-DGLEW_STATIC)
|
||||
endif()
|
||||
add_definitions(-DSTBI_FAILURE_USERMSG)
|
||||
|
||||
# ImageLoader.cpp must be compiled with the -fno-strict-aliasing
|
||||
|
@ -40,15 +40,40 @@ void ensureExtensionsInit()
|
||||
static bool initialized = false;
|
||||
if (!initialized)
|
||||
{
|
||||
GLenum status = glewInit();
|
||||
if (status == GLEW_OK)
|
||||
int loaded = sfogl_LoadFunctions();
|
||||
|
||||
if (!sfogl_IsVersionGEQ(1, 2))
|
||||
{
|
||||
err() << "sfml-graphics requires support for OpenGL 1.2 or greater" << std::endl;
|
||||
err() << "Ensure that hardware acceleration is enabled if available" << std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
if (loaded == sfogl_LOAD_FAILED)
|
||||
{
|
||||
err() << "Failed to initialize OpenGL 1.2 entry points, ";
|
||||
err() << "number of functions that failed to load: " << loaded - sfogl_LOAD_SUCCEEDED << std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
bool missing = false;
|
||||
|
||||
if (sfogl_ext_EXT_blend_minmax == sfogl_LOAD_FAILED)
|
||||
{
|
||||
err() << "Required extension EXT_blend_minmax unavailable" << std::endl;
|
||||
missing = true;
|
||||
}
|
||||
|
||||
if (sfogl_ext_EXT_blend_subtract == sfogl_LOAD_FAILED)
|
||||
{
|
||||
err() << "Required extension EXT_blend_subtract unavailable" << std::endl;
|
||||
missing = true;
|
||||
}
|
||||
|
||||
if (!missing)
|
||||
{
|
||||
initialized = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
err() << "Failed to initialize GLEW, " << glewGetErrorString(status) << std::endl;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
@ -34,80 +34,175 @@
|
||||
|
||||
#include <SFML/OpenGL.hpp>
|
||||
|
||||
#ifdef SFML_SYSTEM_ANDROID
|
||||
// Hack to make transparency working on some Android devices
|
||||
#define GLEXT_blend_func_separate false
|
||||
#define GLEXT_blend_equation_separate false
|
||||
#else
|
||||
#define GLEXT_blend_func_separate GL_OES_blend_func_separate
|
||||
#define GLEXT_blend_equation_separate GL_OES_blend_equation_separate
|
||||
#endif
|
||||
#define GLEXT_glBlendFuncSeparate glBlendFuncSeparateOES
|
||||
#define GLEXT_glBlendEquationSeparate glBlendEquationSeparateOES
|
||||
#define GLEXT_framebuffer_object GL_OES_framebuffer_object
|
||||
#define GLEXT_glGenFramebuffers glGenFramebuffersOES
|
||||
#define GLEXT_glGenRenderbuffers glGenRenderbuffersOES
|
||||
#define GLEXT_glBindFramebuffer glBindFramebufferOES
|
||||
#define GLEXT_glBindRenderbuffer glBindRenderbufferOES
|
||||
#define GLEXT_glDeleteFramebuffers glDeleteFramebuffersOES
|
||||
#define GLEXT_glDeleteRenderbuffers glDeleteRenderbuffersOES
|
||||
#define GLEXT_glRenderbufferStorage glRenderbufferStorageOES
|
||||
#define GLEXT_glFramebufferRenderbuffer glFramebufferRenderbufferOES
|
||||
#define GLEXT_glFramebufferTexture2D glFramebufferTexture2DOES
|
||||
#define GLEXT_glCheckFramebufferStatus glCheckFramebufferStatusOES
|
||||
#define GLEXT_GL_FRAMEBUFFER GL_FRAMEBUFFER_OES
|
||||
#define GLEXT_GL_FRAMEBUFFER_BINDING GL_FRAMEBUFFER_BINDING_OES
|
||||
#define GLEXT_GL_RENDERBUFFER GL_RENDERBUFFER_OES
|
||||
#define GLEXT_GL_COLOR_ATTACHMENT0 GL_COLOR_ATTACHMENT0_OES
|
||||
#define GLEXT_GL_DEPTH_ATTACHMENT GL_DEPTH_ATTACHMENT_OES
|
||||
#define GLEXT_GL_FRAMEBUFFER_COMPLETE GL_FRAMEBUFFER_COMPLETE_OES
|
||||
#define GLEXT_GL_DEPTH_COMPONENT GL_DEPTH_COMPONENT16_OES
|
||||
#define GLEXT_GL_INVALID_FRAMEBUFFER_OPERATION GL_INVALID_FRAMEBUFFER_OPERATION_OES
|
||||
#define GLEXT_texture_non_power_of_two false
|
||||
#define GLEXT_multitexture true
|
||||
#define GLEXT_glClientActiveTexture glClientActiveTexture
|
||||
#define GLEXT_glActiveTexture glActiveTexture
|
||||
#define GLEXT_GL_TEXTURE0 GL_TEXTURE0
|
||||
#define GLEXT_glBlendEquation glBlendEquationOES
|
||||
#define GLEXT_GL_FUNC_ADD GL_FUNC_ADD_OES
|
||||
#define GLEXT_GL_FUNC_SUBTRACT GL_FUNC_SUBTRACT_OES
|
||||
// SFML requires at a bare minimum OpenGL ES 1.0 capability
|
||||
// Some extensions only incorporated by 2.0 are also required
|
||||
// OpenGL ES 1.0 is defined relative to OpenGL 1.3
|
||||
// OpenGL ES 1.1 is defined relative to OpenGL 1.5
|
||||
// OpenGL ES 2.0 is defined relative to OpenGL 2.0
|
||||
// All functionality beyond that is optional
|
||||
// and has to be checked for prior to use
|
||||
|
||||
// Core since 1.0
|
||||
#define GLEXT_multitexture true
|
||||
#define GLEXT_glClientActiveTexture glClientActiveTexture
|
||||
#define GLEXT_glActiveTexture glActiveTexture
|
||||
#define GLEXT_GL_TEXTURE0 GL_TEXTURE0
|
||||
|
||||
// The following extensions are listed chronologically
|
||||
// Extension macro first, followed by tokens then
|
||||
// functions according to the corresponding specification
|
||||
|
||||
// The following extensions are required.
|
||||
|
||||
// Core since 2.0 - OES_blend_subtract
|
||||
#define GLEXT_blend_subtract GL_OES_blend_subtract
|
||||
#define GLEXT_glBlendEquation glBlendEquationOES
|
||||
#define GLEXT_GL_FUNC_ADD GL_FUNC_ADD_OES
|
||||
#define GLEXT_GL_FUNC_SUBTRACT GL_FUNC_SUBTRACT_OES
|
||||
|
||||
// The following extensions are optional.
|
||||
|
||||
// Core since 2.0 - OES_blend_func_separate
|
||||
#ifdef SFML_SYSTEM_ANDROID
|
||||
// Hack to make transparency working on some Android devices
|
||||
#define GLEXT_blend_func_separate false
|
||||
#else
|
||||
#define GLEXT_blend_func_separate GL_OES_blend_func_separate
|
||||
#endif
|
||||
#define GLEXT_glBlendFuncSeparate glBlendFuncSeparateOES
|
||||
|
||||
// Core since 2.0 - OES_blend_equation_separate
|
||||
#ifdef SFML_SYSTEM_ANDROID
|
||||
// Hack to make transparency working on some Android devices
|
||||
#define GLEXT_blend_equation_separate false
|
||||
#else
|
||||
#define GLEXT_blend_equation_separate GL_OES_blend_equation_separate
|
||||
#endif
|
||||
#define GLEXT_glBlendEquationSeparate glBlendEquationSeparateOES
|
||||
|
||||
// Core since 2.0 - OES_texture_npot
|
||||
#define GLEXT_texture_non_power_of_two false
|
||||
|
||||
// Core since 2.0 - OES_framebuffer_object
|
||||
#define GLEXT_framebuffer_object GL_OES_framebuffer_object
|
||||
#define GLEXT_glBindRenderbuffer glBindRenderbufferOES
|
||||
#define GLEXT_glDeleteRenderbuffers glDeleteRenderbuffersOES
|
||||
#define GLEXT_glGenRenderbuffers glGenRenderbuffersOES
|
||||
#define GLEXT_glRenderbufferStorage glRenderbufferStorageOES
|
||||
#define GLEXT_glBindFramebuffer glBindFramebufferOES
|
||||
#define GLEXT_glDeleteFramebuffers glDeleteFramebuffersOES
|
||||
#define GLEXT_glGenFramebuffers glGenFramebuffersOES
|
||||
#define GLEXT_glCheckFramebufferStatus glCheckFramebufferStatusOES
|
||||
#define GLEXT_glFramebufferTexture2D glFramebufferTexture2DOES
|
||||
#define GLEXT_glFramebufferRenderbuffer glFramebufferRenderbufferOES
|
||||
#define GLEXT_GL_FRAMEBUFFER GL_FRAMEBUFFER_OES
|
||||
#define GLEXT_GL_RENDERBUFFER GL_RENDERBUFFER_OES
|
||||
#define GLEXT_GL_DEPTH_COMPONENT GL_DEPTH_COMPONENT16_OES
|
||||
#define GLEXT_GL_COLOR_ATTACHMENT0 GL_COLOR_ATTACHMENT0_OES
|
||||
#define GLEXT_GL_DEPTH_ATTACHMENT GL_DEPTH_ATTACHMENT_OES
|
||||
#define GLEXT_GL_FRAMEBUFFER_COMPLETE GL_FRAMEBUFFER_COMPLETE_OES
|
||||
#define GLEXT_GL_FRAMEBUFFER_BINDING GL_FRAMEBUFFER_BINDING_OES
|
||||
#define GLEXT_GL_INVALID_FRAMEBUFFER_OPERATION GL_INVALID_FRAMEBUFFER_OPERATION_OES
|
||||
|
||||
#else
|
||||
|
||||
#include <GL/glew.h>
|
||||
#include <SFML/OpenGL.hpp>
|
||||
#include <SFML/Graphics/GLLoader.hpp>
|
||||
|
||||
#define GLEXT_blend_func_separate GLEW_EXT_blend_func_separate
|
||||
#define GLEXT_blend_equation_separate GLEW_EXT_blend_equation_separate
|
||||
#define GLEXT_glBlendFuncSeparate glBlendFuncSeparateEXT
|
||||
#define GLEXT_glBlendEquationSeparate glBlendEquationSeparateEXT
|
||||
#define GLEXT_framebuffer_object GLEW_EXT_framebuffer_object
|
||||
#define GLEXT_glGenFramebuffers glGenFramebuffersEXT
|
||||
#define GLEXT_glGenRenderbuffers glGenRenderbuffersEXT
|
||||
#define GLEXT_glBindFramebuffer glBindFramebufferEXT
|
||||
#define GLEXT_glBindRenderbuffer glBindRenderbufferEXT
|
||||
#define GLEXT_glDeleteFramebuffers glDeleteFramebuffersEXT
|
||||
#define GLEXT_glDeleteRenderbuffers glDeleteRenderbuffersEXT
|
||||
#define GLEXT_glRenderbufferStorage glRenderbufferStorageEXT
|
||||
#define GLEXT_glFramebufferRenderbuffer glFramebufferRenderbufferEXT
|
||||
#define GLEXT_glFramebufferTexture2D glFramebufferTexture2DEXT
|
||||
#define GLEXT_glCheckFramebufferStatus glCheckFramebufferStatusEXT
|
||||
#define GLEXT_GL_FRAMEBUFFER GL_FRAMEBUFFER_EXT
|
||||
#define GLEXT_GL_FRAMEBUFFER_BINDING GL_FRAMEBUFFER_BINDING_EXT
|
||||
#define GLEXT_GL_RENDERBUFFER GL_RENDERBUFFER_EXT
|
||||
#define GLEXT_GL_COLOR_ATTACHMENT0 GL_COLOR_ATTACHMENT0_EXT
|
||||
#define GLEXT_GL_DEPTH_ATTACHMENT GL_DEPTH_ATTACHMENT_EXT
|
||||
#define GLEXT_GL_FRAMEBUFFER_COMPLETE GL_FRAMEBUFFER_COMPLETE_EXT
|
||||
#define GLEXT_GL_DEPTH_COMPONENT GL_DEPTH_COMPONENT
|
||||
#define GLEXT_GL_INVALID_FRAMEBUFFER_OPERATION GL_INVALID_FRAMEBUFFER_OPERATION_EXT
|
||||
#define GLEXT_texture_non_power_of_two GLEW_ARB_texture_non_power_of_two
|
||||
#define GLEXT_multitexture GLEW_ARB_multitexture
|
||||
#define GLEXT_glClientActiveTexture glClientActiveTextureARB
|
||||
#define GLEXT_glActiveTexture glActiveTextureARB
|
||||
#define GLEXT_GL_TEXTURE0 GL_TEXTURE0_ARB
|
||||
#define GLEXT_glBlendEquation glBlendEquation
|
||||
#define GLEXT_GL_FUNC_ADD GL_FUNC_ADD
|
||||
#define GLEXT_GL_FUNC_SUBTRACT GL_FUNC_SUBTRACT
|
||||
// SFML requires at a bare minimum OpenGL 1.2 capability
|
||||
// All functionality beyond that is optional
|
||||
// and has to be checked for prior to use
|
||||
|
||||
// Core since 1.1
|
||||
#define GLEXT_GL_DEPTH_COMPONENT GL_DEPTH_COMPONENT
|
||||
|
||||
// The following extensions are listed chronologically
|
||||
// Extension macro first, followed by tokens then
|
||||
// functions according to the corresponding specification
|
||||
|
||||
// The following extensions are required.
|
||||
|
||||
// Core since 1.2 - EXT_blend_minmax
|
||||
#define GLEXT_glBlendEquation glBlendEquationEXT
|
||||
#define GLEXT_GL_FUNC_ADD GL_FUNC_ADD_EXT
|
||||
|
||||
// Core since 1.2 - EXT_blend_subtract
|
||||
#define GLEXT_GL_FUNC_SUBTRACT GL_FUNC_SUBTRACT_EXT
|
||||
|
||||
// The following extensions are optional.
|
||||
|
||||
// Core since 1.3 - ARB_multitexture
|
||||
#define GLEXT_multitexture sfogl_ext_ARB_multitexture
|
||||
#define GLEXT_glClientActiveTexture glClientActiveTextureARB
|
||||
#define GLEXT_glActiveTexture glActiveTextureARB
|
||||
#define GLEXT_GL_TEXTURE0 GL_TEXTURE0_ARB
|
||||
|
||||
// Core since 1.4 - EXT_blend_func_separate
|
||||
#define GLEXT_blend_func_separate sfogl_ext_EXT_blend_func_separate
|
||||
#define GLEXT_glBlendFuncSeparate glBlendFuncSeparateEXT
|
||||
|
||||
// Core since 2.0 - ARB_shading_language_100
|
||||
#define GLEXT_shading_language_100 sfogl_ext_ARB_shading_language_100
|
||||
|
||||
// Core since 2.0 - ARB_shader_objects
|
||||
#define GLEXT_shader_objects sfogl_ext_ARB_shader_objects
|
||||
#define GLEXT_glDeleteObject glDeleteObjectARB
|
||||
#define GLEXT_glGetHandle glGetHandleARB
|
||||
#define GLEXT_glCreateShaderObject glCreateShaderObjectARB
|
||||
#define GLEXT_glShaderSource glShaderSourceARB
|
||||
#define GLEXT_glCompileShader glCompileShaderARB
|
||||
#define GLEXT_glCreateProgramObject glCreateProgramObjectARB
|
||||
#define GLEXT_glAttachObject glAttachObjectARB
|
||||
#define GLEXT_glLinkProgram glLinkProgramARB
|
||||
#define GLEXT_glUseProgramObject glUseProgramObjectARB
|
||||
#define GLEXT_glUniform1f glUniform1fARB
|
||||
#define GLEXT_glUniform2f glUniform2fARB
|
||||
#define GLEXT_glUniform3f glUniform3fARB
|
||||
#define GLEXT_glUniform4f glUniform4fARB
|
||||
#define GLEXT_glUniform1i glUniform1iARB
|
||||
#define GLEXT_glUniformMatrix4fv glUniformMatrix4fvARB
|
||||
#define GLEXT_glGetObjectParameteriv glGetObjectParameterivARB
|
||||
#define GLEXT_glGetInfoLog glGetInfoLogARB
|
||||
#define GLEXT_glGetUniformLocation glGetUniformLocationARB
|
||||
#define GLEXT_GL_PROGRAM_OBJECT GL_PROGRAM_OBJECT_ARB
|
||||
#define GLEXT_GL_OBJECT_COMPILE_STATUS GL_OBJECT_COMPILE_STATUS_ARB
|
||||
#define GLEXT_GL_OBJECT_LINK_STATUS GL_OBJECT_LINK_STATUS_ARB
|
||||
#define GLEXT_GLhandle GLhandleARB
|
||||
|
||||
// Core since 2.0 - ARB_vertex_shader
|
||||
#define GLEXT_vertex_shader sfogl_ext_ARB_vertex_shader
|
||||
#define GLEXT_GL_VERTEX_SHADER GL_VERTEX_SHADER_ARB
|
||||
#define GLEXT_GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS_ARB
|
||||
|
||||
// Core since 2.0 - ARB_fragment_shader
|
||||
#define GLEXT_fragment_shader sfogl_ext_ARB_fragment_shader
|
||||
#define GLEXT_GL_FRAGMENT_SHADER GL_FRAGMENT_SHADER_ARB
|
||||
|
||||
// Core since 2.0 - ARB_texture_non_power_of_two
|
||||
#define GLEXT_texture_non_power_of_two sfogl_ext_ARB_texture_non_power_of_two
|
||||
|
||||
// Core since 2.0 - EXT_blend_equation_separate
|
||||
#define GLEXT_blend_equation_separate sfogl_ext_EXT_blend_equation_separate
|
||||
#define GLEXT_glBlendEquationSeparate glBlendEquationSeparateEXT
|
||||
|
||||
// Core since 3.0 - EXT_framebuffer_object
|
||||
#define GLEXT_framebuffer_object sfogl_ext_EXT_framebuffer_object
|
||||
#define GLEXT_glBindRenderbuffer glBindRenderbufferEXT
|
||||
#define GLEXT_glDeleteRenderbuffers glDeleteRenderbuffersEXT
|
||||
#define GLEXT_glGenRenderbuffers glGenRenderbuffersEXT
|
||||
#define GLEXT_glRenderbufferStorage glRenderbufferStorageEXT
|
||||
#define GLEXT_glBindFramebuffer glBindFramebufferEXT
|
||||
#define GLEXT_glDeleteFramebuffers glDeleteFramebuffersEXT
|
||||
#define GLEXT_glGenFramebuffers glGenFramebuffersEXT
|
||||
#define GLEXT_glCheckFramebufferStatus glCheckFramebufferStatusEXT
|
||||
#define GLEXT_glFramebufferTexture2D glFramebufferTexture2DEXT
|
||||
#define GLEXT_glFramebufferRenderbuffer glFramebufferRenderbufferEXT
|
||||
#define GLEXT_GL_FRAMEBUFFER GL_FRAMEBUFFER_EXT
|
||||
#define GLEXT_GL_RENDERBUFFER GL_RENDERBUFFER_EXT
|
||||
#define GLEXT_GL_COLOR_ATTACHMENT0 GL_COLOR_ATTACHMENT0_EXT
|
||||
#define GLEXT_GL_DEPTH_ATTACHMENT GL_DEPTH_ATTACHMENT_EXT
|
||||
#define GLEXT_GL_FRAMEBUFFER_COMPLETE GL_FRAMEBUFFER_COMPLETE_EXT
|
||||
#define GLEXT_GL_FRAMEBUFFER_BINDING GL_FRAMEBUFFER_BINDING_EXT
|
||||
#define GLEXT_GL_INVALID_FRAMEBUFFER_OPERATION GL_INVALID_FRAMEBUFFER_OPERATION_EXT
|
||||
|
||||
#endif
|
||||
|
||||
|
16
src/SFML/Graphics/GLExtensions.txt
Normal file
16
src/SFML/Graphics/GLExtensions.txt
Normal file
@ -0,0 +1,16 @@
|
||||
// Created with:
|
||||
// https://bitbucket.org/KhronosGroup/glloadgen
|
||||
// Commit d143d66ac90d538ed06f806188714861b8e8e2f9
|
||||
// lua LoadGen.lua -style=pointer_c -spec=gl -version=1.2 -indent=space -prefix=sf -extfile=GLExtensions.txt GLLoader
|
||||
|
||||
EXT_blend_minmax
|
||||
EXT_blend_subtract
|
||||
ARB_multitexture
|
||||
EXT_blend_func_separate
|
||||
ARB_shading_language_100
|
||||
ARB_shader_objects
|
||||
ARB_vertex_shader
|
||||
ARB_fragment_shader
|
||||
ARB_texture_non_power_of_two
|
||||
EXT_blend_equation_separate
|
||||
EXT_framebuffer_object
|
562
src/SFML/Graphics/GLLoader.cpp
Normal file
562
src/SFML/Graphics/GLLoader.cpp
Normal file
@ -0,0 +1,562 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stddef.h>
|
||||
#include <SFML/Graphics/GLLoader.hpp>
|
||||
|
||||
#if defined(__APPLE__)
|
||||
#include <dlfcn.h>
|
||||
|
||||
static void* AppleGLGetProcAddress (const char *name)
|
||||
{
|
||||
static void* image = NULL;
|
||||
|
||||
if (NULL == image)
|
||||
image = dlopen("/System/Library/Frameworks/OpenGL.framework/Versions/Current/OpenGL", RTLD_LAZY);
|
||||
|
||||
return (image ? dlsym(image, name) : NULL);
|
||||
}
|
||||
#define IntGetProcAddress(name) AppleGLGetProcAddress(name)
|
||||
#endif /* __APPLE__ */
|
||||
|
||||
#if defined(__sgi) || defined (__sun)
|
||||
#include <dlfcn.h>
|
||||
#include <stdio.h>
|
||||
|
||||
static void* SunGetProcAddress (const GLubyte* name)
|
||||
{
|
||||
static void* h = NULL;
|
||||
static void* gpa;
|
||||
|
||||
if (h == NULL)
|
||||
{
|
||||
if ((h = dlopen(NULL, RTLD_LAZY | RTLD_LOCAL)) == NULL) return NULL;
|
||||
gpa = dlsym(h, "glXGetProcAddress");
|
||||
}
|
||||
|
||||
if (gpa != NULL)
|
||||
return ((void*(*)(const GLubyte*))gpa)(name);
|
||||
else
|
||||
return dlsym(h, (const char*)name);
|
||||
}
|
||||
#endif /* __sgi || __sun */
|
||||
|
||||
#if defined(_WIN32)
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(disable: 4055)
|
||||
#pragma warning(disable: 4054)
|
||||
#pragma warning(disable: 4996)
|
||||
#endif
|
||||
|
||||
static int TestPointer(const PROC pTest)
|
||||
{
|
||||
ptrdiff_t iTest;
|
||||
if(!pTest) return 0;
|
||||
iTest = (ptrdiff_t)pTest;
|
||||
|
||||
if(iTest == 1 || iTest == 2 || iTest == 3 || iTest == -1) return 0;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static PROC WinGetProcAddress(const char *name)
|
||||
{
|
||||
static HMODULE glMod = NULL;
|
||||
PROC pFunc = wglGetProcAddress((LPCSTR)name);
|
||||
|
||||
if (TestPointer(pFunc)) return pFunc;
|
||||
|
||||
if (NULL == glMod)
|
||||
glMod = GetModuleHandleA("OpenGL32.dll");
|
||||
|
||||
return (PROC)GetProcAddress(glMod, (LPCSTR)name);
|
||||
}
|
||||
|
||||
#define IntGetProcAddress(name) WinGetProcAddress(name)
|
||||
#else
|
||||
#if defined(__APPLE__)
|
||||
#define IntGetProcAddress(name) AppleGLGetProcAddress(name)
|
||||
#else
|
||||
#if defined(__sgi) || defined(__sun)
|
||||
#define IntGetProcAddress(name) SunGetProcAddress(name)
|
||||
#else /* GLX */
|
||||
#include <GL/glx.h>
|
||||
|
||||
#define IntGetProcAddress(name) (*glXGetProcAddressARB)((const GLubyte*)name)
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
int sfogl_ext_EXT_blend_minmax = sfogl_LOAD_FAILED;
|
||||
int sfogl_ext_EXT_blend_subtract = sfogl_LOAD_FAILED;
|
||||
int sfogl_ext_ARB_multitexture = sfogl_LOAD_FAILED;
|
||||
int sfogl_ext_EXT_blend_func_separate = sfogl_LOAD_FAILED;
|
||||
int sfogl_ext_ARB_shading_language_100 = sfogl_LOAD_FAILED;
|
||||
int sfogl_ext_ARB_shader_objects = sfogl_LOAD_FAILED;
|
||||
int sfogl_ext_ARB_vertex_shader = sfogl_LOAD_FAILED;
|
||||
int sfogl_ext_ARB_fragment_shader = sfogl_LOAD_FAILED;
|
||||
int sfogl_ext_ARB_texture_non_power_of_two = sfogl_LOAD_FAILED;
|
||||
int sfogl_ext_EXT_blend_equation_separate = sfogl_LOAD_FAILED;
|
||||
int sfogl_ext_EXT_framebuffer_object = sfogl_LOAD_FAILED;
|
||||
|
||||
void (CODEGEN_FUNCPTR *sf_ptrc_glBlendEquationEXT)(GLenum) = NULL;
|
||||
|
||||
static int Load_EXT_blend_minmax()
|
||||
{
|
||||
int numFailed = 0;
|
||||
sf_ptrc_glBlendEquationEXT = (void (CODEGEN_FUNCPTR *)(GLenum))IntGetProcAddress("glBlendEquationEXT");
|
||||
if(!sf_ptrc_glBlendEquationEXT) numFailed++;
|
||||
return numFailed;
|
||||
}
|
||||
|
||||
void (CODEGEN_FUNCPTR *sf_ptrc_glActiveTextureARB)(GLenum) = NULL;
|
||||
void (CODEGEN_FUNCPTR *sf_ptrc_glClientActiveTextureARB)(GLenum) = NULL;
|
||||
|
||||
static int Load_ARB_multitexture()
|
||||
{
|
||||
int numFailed = 0;
|
||||
sf_ptrc_glActiveTextureARB = (void (CODEGEN_FUNCPTR *)(GLenum))IntGetProcAddress("glActiveTextureARB");
|
||||
if(!sf_ptrc_glActiveTextureARB) numFailed++;
|
||||
sf_ptrc_glClientActiveTextureARB = (void (CODEGEN_FUNCPTR *)(GLenum))IntGetProcAddress("glClientActiveTextureARB");
|
||||
if(!sf_ptrc_glClientActiveTextureARB) numFailed++;
|
||||
return numFailed;
|
||||
}
|
||||
|
||||
void (CODEGEN_FUNCPTR *sf_ptrc_glBlendFuncSeparateEXT)(GLenum, GLenum, GLenum, GLenum) = NULL;
|
||||
|
||||
static int Load_EXT_blend_func_separate()
|
||||
{
|
||||
int numFailed = 0;
|
||||
sf_ptrc_glBlendFuncSeparateEXT = (void (CODEGEN_FUNCPTR *)(GLenum, GLenum, GLenum, GLenum))IntGetProcAddress("glBlendFuncSeparateEXT");
|
||||
if(!sf_ptrc_glBlendFuncSeparateEXT) numFailed++;
|
||||
return numFailed;
|
||||
}
|
||||
|
||||
void (CODEGEN_FUNCPTR *sf_ptrc_glAttachObjectARB)(GLhandleARB, GLhandleARB) = NULL;
|
||||
void (CODEGEN_FUNCPTR *sf_ptrc_glCompileShaderARB)(GLhandleARB) = NULL;
|
||||
GLhandleARB (CODEGEN_FUNCPTR *sf_ptrc_glCreateProgramObjectARB)() = NULL;
|
||||
GLhandleARB (CODEGEN_FUNCPTR *sf_ptrc_glCreateShaderObjectARB)(GLenum) = NULL;
|
||||
void (CODEGEN_FUNCPTR *sf_ptrc_glDeleteObjectARB)(GLhandleARB) = NULL;
|
||||
void (CODEGEN_FUNCPTR *sf_ptrc_glDetachObjectARB)(GLhandleARB, GLhandleARB) = NULL;
|
||||
void (CODEGEN_FUNCPTR *sf_ptrc_glGetActiveUniformARB)(GLhandleARB, GLuint, GLsizei, GLsizei *, GLint *, GLenum *, GLcharARB *) = NULL;
|
||||
void (CODEGEN_FUNCPTR *sf_ptrc_glGetAttachedObjectsARB)(GLhandleARB, GLsizei, GLsizei *, GLhandleARB *) = NULL;
|
||||
GLhandleARB (CODEGEN_FUNCPTR *sf_ptrc_glGetHandleARB)(GLenum) = NULL;
|
||||
void (CODEGEN_FUNCPTR *sf_ptrc_glGetInfoLogARB)(GLhandleARB, GLsizei, GLsizei *, GLcharARB *) = NULL;
|
||||
void (CODEGEN_FUNCPTR *sf_ptrc_glGetObjectParameterfvARB)(GLhandleARB, GLenum, GLfloat *) = NULL;
|
||||
void (CODEGEN_FUNCPTR *sf_ptrc_glGetObjectParameterivARB)(GLhandleARB, GLenum, GLint *) = NULL;
|
||||
void (CODEGEN_FUNCPTR *sf_ptrc_glGetShaderSourceARB)(GLhandleARB, GLsizei, GLsizei *, GLcharARB *) = NULL;
|
||||
GLint (CODEGEN_FUNCPTR *sf_ptrc_glGetUniformLocationARB)(GLhandleARB, const GLcharARB *) = NULL;
|
||||
void (CODEGEN_FUNCPTR *sf_ptrc_glGetUniformfvARB)(GLhandleARB, GLint, GLfloat *) = NULL;
|
||||
void (CODEGEN_FUNCPTR *sf_ptrc_glGetUniformivARB)(GLhandleARB, GLint, GLint *) = NULL;
|
||||
void (CODEGEN_FUNCPTR *sf_ptrc_glLinkProgramARB)(GLhandleARB) = NULL;
|
||||
void (CODEGEN_FUNCPTR *sf_ptrc_glShaderSourceARB)(GLhandleARB, GLsizei, const GLcharARB **, const GLint *) = NULL;
|
||||
void (CODEGEN_FUNCPTR *sf_ptrc_glUniform1fARB)(GLint, GLfloat) = NULL;
|
||||
void (CODEGEN_FUNCPTR *sf_ptrc_glUniform1fvARB)(GLint, GLsizei, const GLfloat *) = NULL;
|
||||
void (CODEGEN_FUNCPTR *sf_ptrc_glUniform1iARB)(GLint, GLint) = NULL;
|
||||
void (CODEGEN_FUNCPTR *sf_ptrc_glUniform1ivARB)(GLint, GLsizei, const GLint *) = NULL;
|
||||
void (CODEGEN_FUNCPTR *sf_ptrc_glUniform2fARB)(GLint, GLfloat, GLfloat) = NULL;
|
||||
void (CODEGEN_FUNCPTR *sf_ptrc_glUniform2fvARB)(GLint, GLsizei, const GLfloat *) = NULL;
|
||||
void (CODEGEN_FUNCPTR *sf_ptrc_glUniform2iARB)(GLint, GLint, GLint) = NULL;
|
||||
void (CODEGEN_FUNCPTR *sf_ptrc_glUniform2ivARB)(GLint, GLsizei, const GLint *) = NULL;
|
||||
void (CODEGEN_FUNCPTR *sf_ptrc_glUniform3fARB)(GLint, GLfloat, GLfloat, GLfloat) = NULL;
|
||||
void (CODEGEN_FUNCPTR *sf_ptrc_glUniform3fvARB)(GLint, GLsizei, const GLfloat *) = NULL;
|
||||
void (CODEGEN_FUNCPTR *sf_ptrc_glUniform3iARB)(GLint, GLint, GLint, GLint) = NULL;
|
||||
void (CODEGEN_FUNCPTR *sf_ptrc_glUniform3ivARB)(GLint, GLsizei, const GLint *) = NULL;
|
||||
void (CODEGEN_FUNCPTR *sf_ptrc_glUniform4fARB)(GLint, GLfloat, GLfloat, GLfloat, GLfloat) = NULL;
|
||||
void (CODEGEN_FUNCPTR *sf_ptrc_glUniform4fvARB)(GLint, GLsizei, const GLfloat *) = NULL;
|
||||
void (CODEGEN_FUNCPTR *sf_ptrc_glUniform4iARB)(GLint, GLint, GLint, GLint, GLint) = NULL;
|
||||
void (CODEGEN_FUNCPTR *sf_ptrc_glUniform4ivARB)(GLint, GLsizei, const GLint *) = NULL;
|
||||
void (CODEGEN_FUNCPTR *sf_ptrc_glUniformMatrix2fvARB)(GLint, GLsizei, GLboolean, const GLfloat *) = NULL;
|
||||
void (CODEGEN_FUNCPTR *sf_ptrc_glUniformMatrix3fvARB)(GLint, GLsizei, GLboolean, const GLfloat *) = NULL;
|
||||
void (CODEGEN_FUNCPTR *sf_ptrc_glUniformMatrix4fvARB)(GLint, GLsizei, GLboolean, const GLfloat *) = NULL;
|
||||
void (CODEGEN_FUNCPTR *sf_ptrc_glUseProgramObjectARB)(GLhandleARB) = NULL;
|
||||
void (CODEGEN_FUNCPTR *sf_ptrc_glValidateProgramARB)(GLhandleARB) = NULL;
|
||||
|
||||
static int Load_ARB_shader_objects()
|
||||
{
|
||||
int numFailed = 0;
|
||||
sf_ptrc_glAttachObjectARB = (void (CODEGEN_FUNCPTR *)(GLhandleARB, GLhandleARB))IntGetProcAddress("glAttachObjectARB");
|
||||
if(!sf_ptrc_glAttachObjectARB) numFailed++;
|
||||
sf_ptrc_glCompileShaderARB = (void (CODEGEN_FUNCPTR *)(GLhandleARB))IntGetProcAddress("glCompileShaderARB");
|
||||
if(!sf_ptrc_glCompileShaderARB) numFailed++;
|
||||
sf_ptrc_glCreateProgramObjectARB = (GLhandleARB (CODEGEN_FUNCPTR *)())IntGetProcAddress("glCreateProgramObjectARB");
|
||||
if(!sf_ptrc_glCreateProgramObjectARB) numFailed++;
|
||||
sf_ptrc_glCreateShaderObjectARB = (GLhandleARB (CODEGEN_FUNCPTR *)(GLenum))IntGetProcAddress("glCreateShaderObjectARB");
|
||||
if(!sf_ptrc_glCreateShaderObjectARB) numFailed++;
|
||||
sf_ptrc_glDeleteObjectARB = (void (CODEGEN_FUNCPTR *)(GLhandleARB))IntGetProcAddress("glDeleteObjectARB");
|
||||
if(!sf_ptrc_glDeleteObjectARB) numFailed++;
|
||||
sf_ptrc_glDetachObjectARB = (void (CODEGEN_FUNCPTR *)(GLhandleARB, GLhandleARB))IntGetProcAddress("glDetachObjectARB");
|
||||
if(!sf_ptrc_glDetachObjectARB) numFailed++;
|
||||
sf_ptrc_glGetActiveUniformARB = (void (CODEGEN_FUNCPTR *)(GLhandleARB, GLuint, GLsizei, GLsizei *, GLint *, GLenum *, GLcharARB *))IntGetProcAddress("glGetActiveUniformARB");
|
||||
if(!sf_ptrc_glGetActiveUniformARB) numFailed++;
|
||||
sf_ptrc_glGetAttachedObjectsARB = (void (CODEGEN_FUNCPTR *)(GLhandleARB, GLsizei, GLsizei *, GLhandleARB *))IntGetProcAddress("glGetAttachedObjectsARB");
|
||||
if(!sf_ptrc_glGetAttachedObjectsARB) numFailed++;
|
||||
sf_ptrc_glGetHandleARB = (GLhandleARB (CODEGEN_FUNCPTR *)(GLenum))IntGetProcAddress("glGetHandleARB");
|
||||
if(!sf_ptrc_glGetHandleARB) numFailed++;
|
||||
sf_ptrc_glGetInfoLogARB = (void (CODEGEN_FUNCPTR *)(GLhandleARB, GLsizei, GLsizei *, GLcharARB *))IntGetProcAddress("glGetInfoLogARB");
|
||||
if(!sf_ptrc_glGetInfoLogARB) numFailed++;
|
||||
sf_ptrc_glGetObjectParameterfvARB = (void (CODEGEN_FUNCPTR *)(GLhandleARB, GLenum, GLfloat *))IntGetProcAddress("glGetObjectParameterfvARB");
|
||||
if(!sf_ptrc_glGetObjectParameterfvARB) numFailed++;
|
||||
sf_ptrc_glGetObjectParameterivARB = (void (CODEGEN_FUNCPTR *)(GLhandleARB, GLenum, GLint *))IntGetProcAddress("glGetObjectParameterivARB");
|
||||
if(!sf_ptrc_glGetObjectParameterivARB) numFailed++;
|
||||
sf_ptrc_glGetShaderSourceARB = (void (CODEGEN_FUNCPTR *)(GLhandleARB, GLsizei, GLsizei *, GLcharARB *))IntGetProcAddress("glGetShaderSourceARB");
|
||||
if(!sf_ptrc_glGetShaderSourceARB) numFailed++;
|
||||
sf_ptrc_glGetUniformLocationARB = (GLint (CODEGEN_FUNCPTR *)(GLhandleARB, const GLcharARB *))IntGetProcAddress("glGetUniformLocationARB");
|
||||
if(!sf_ptrc_glGetUniformLocationARB) numFailed++;
|
||||
sf_ptrc_glGetUniformfvARB = (void (CODEGEN_FUNCPTR *)(GLhandleARB, GLint, GLfloat *))IntGetProcAddress("glGetUniformfvARB");
|
||||
if(!sf_ptrc_glGetUniformfvARB) numFailed++;
|
||||
sf_ptrc_glGetUniformivARB = (void (CODEGEN_FUNCPTR *)(GLhandleARB, GLint, GLint *))IntGetProcAddress("glGetUniformivARB");
|
||||
if(!sf_ptrc_glGetUniformivARB) numFailed++;
|
||||
sf_ptrc_glLinkProgramARB = (void (CODEGEN_FUNCPTR *)(GLhandleARB))IntGetProcAddress("glLinkProgramARB");
|
||||
if(!sf_ptrc_glLinkProgramARB) numFailed++;
|
||||
sf_ptrc_glShaderSourceARB = (void (CODEGEN_FUNCPTR *)(GLhandleARB, GLsizei, const GLcharARB **, const GLint *))IntGetProcAddress("glShaderSourceARB");
|
||||
if(!sf_ptrc_glShaderSourceARB) numFailed++;
|
||||
sf_ptrc_glUniform1fARB = (void (CODEGEN_FUNCPTR *)(GLint, GLfloat))IntGetProcAddress("glUniform1fARB");
|
||||
if(!sf_ptrc_glUniform1fARB) numFailed++;
|
||||
sf_ptrc_glUniform1fvARB = (void (CODEGEN_FUNCPTR *)(GLint, GLsizei, const GLfloat *))IntGetProcAddress("glUniform1fvARB");
|
||||
if(!sf_ptrc_glUniform1fvARB) numFailed++;
|
||||
sf_ptrc_glUniform1iARB = (void (CODEGEN_FUNCPTR *)(GLint, GLint))IntGetProcAddress("glUniform1iARB");
|
||||
if(!sf_ptrc_glUniform1iARB) numFailed++;
|
||||
sf_ptrc_glUniform1ivARB = (void (CODEGEN_FUNCPTR *)(GLint, GLsizei, const GLint *))IntGetProcAddress("glUniform1ivARB");
|
||||
if(!sf_ptrc_glUniform1ivARB) numFailed++;
|
||||
sf_ptrc_glUniform2fARB = (void (CODEGEN_FUNCPTR *)(GLint, GLfloat, GLfloat))IntGetProcAddress("glUniform2fARB");
|
||||
if(!sf_ptrc_glUniform2fARB) numFailed++;
|
||||
sf_ptrc_glUniform2fvARB = (void (CODEGEN_FUNCPTR *)(GLint, GLsizei, const GLfloat *))IntGetProcAddress("glUniform2fvARB");
|
||||
if(!sf_ptrc_glUniform2fvARB) numFailed++;
|
||||
sf_ptrc_glUniform2iARB = (void (CODEGEN_FUNCPTR *)(GLint, GLint, GLint))IntGetProcAddress("glUniform2iARB");
|
||||
if(!sf_ptrc_glUniform2iARB) numFailed++;
|
||||
sf_ptrc_glUniform2ivARB = (void (CODEGEN_FUNCPTR *)(GLint, GLsizei, const GLint *))IntGetProcAddress("glUniform2ivARB");
|
||||
if(!sf_ptrc_glUniform2ivARB) numFailed++;
|
||||
sf_ptrc_glUniform3fARB = (void (CODEGEN_FUNCPTR *)(GLint, GLfloat, GLfloat, GLfloat))IntGetProcAddress("glUniform3fARB");
|
||||
if(!sf_ptrc_glUniform3fARB) numFailed++;
|
||||
sf_ptrc_glUniform3fvARB = (void (CODEGEN_FUNCPTR *)(GLint, GLsizei, const GLfloat *))IntGetProcAddress("glUniform3fvARB");
|
||||
if(!sf_ptrc_glUniform3fvARB) numFailed++;
|
||||
sf_ptrc_glUniform3iARB = (void (CODEGEN_FUNCPTR *)(GLint, GLint, GLint, GLint))IntGetProcAddress("glUniform3iARB");
|
||||
if(!sf_ptrc_glUniform3iARB) numFailed++;
|
||||
sf_ptrc_glUniform3ivARB = (void (CODEGEN_FUNCPTR *)(GLint, GLsizei, const GLint *))IntGetProcAddress("glUniform3ivARB");
|
||||
if(!sf_ptrc_glUniform3ivARB) numFailed++;
|
||||
sf_ptrc_glUniform4fARB = (void (CODEGEN_FUNCPTR *)(GLint, GLfloat, GLfloat, GLfloat, GLfloat))IntGetProcAddress("glUniform4fARB");
|
||||
if(!sf_ptrc_glUniform4fARB) numFailed++;
|
||||
sf_ptrc_glUniform4fvARB = (void (CODEGEN_FUNCPTR *)(GLint, GLsizei, const GLfloat *))IntGetProcAddress("glUniform4fvARB");
|
||||
if(!sf_ptrc_glUniform4fvARB) numFailed++;
|
||||
sf_ptrc_glUniform4iARB = (void (CODEGEN_FUNCPTR *)(GLint, GLint, GLint, GLint, GLint))IntGetProcAddress("glUniform4iARB");
|
||||
if(!sf_ptrc_glUniform4iARB) numFailed++;
|
||||
sf_ptrc_glUniform4ivARB = (void (CODEGEN_FUNCPTR *)(GLint, GLsizei, const GLint *))IntGetProcAddress("glUniform4ivARB");
|
||||
if(!sf_ptrc_glUniform4ivARB) numFailed++;
|
||||
sf_ptrc_glUniformMatrix2fvARB = (void (CODEGEN_FUNCPTR *)(GLint, GLsizei, GLboolean, const GLfloat *))IntGetProcAddress("glUniformMatrix2fvARB");
|
||||
if(!sf_ptrc_glUniformMatrix2fvARB) numFailed++;
|
||||
sf_ptrc_glUniformMatrix3fvARB = (void (CODEGEN_FUNCPTR *)(GLint, GLsizei, GLboolean, const GLfloat *))IntGetProcAddress("glUniformMatrix3fvARB");
|
||||
if(!sf_ptrc_glUniformMatrix3fvARB) numFailed++;
|
||||
sf_ptrc_glUniformMatrix4fvARB = (void (CODEGEN_FUNCPTR *)(GLint, GLsizei, GLboolean, const GLfloat *))IntGetProcAddress("glUniformMatrix4fvARB");
|
||||
if(!sf_ptrc_glUniformMatrix4fvARB) numFailed++;
|
||||
sf_ptrc_glUseProgramObjectARB = (void (CODEGEN_FUNCPTR *)(GLhandleARB))IntGetProcAddress("glUseProgramObjectARB");
|
||||
if(!sf_ptrc_glUseProgramObjectARB) numFailed++;
|
||||
sf_ptrc_glValidateProgramARB = (void (CODEGEN_FUNCPTR *)(GLhandleARB))IntGetProcAddress("glValidateProgramARB");
|
||||
if(!sf_ptrc_glValidateProgramARB) numFailed++;
|
||||
return numFailed;
|
||||
}
|
||||
|
||||
void (CODEGEN_FUNCPTR *sf_ptrc_glBindAttribLocationARB)(GLhandleARB, GLuint, const GLcharARB *) = NULL;
|
||||
void (CODEGEN_FUNCPTR *sf_ptrc_glGetActiveAttribARB)(GLhandleARB, GLuint, GLsizei, GLsizei *, GLint *, GLenum *, GLcharARB *) = NULL;
|
||||
GLint (CODEGEN_FUNCPTR *sf_ptrc_glGetAttribLocationARB)(GLhandleARB, const GLcharARB *) = NULL;
|
||||
|
||||
static int Load_ARB_vertex_shader()
|
||||
{
|
||||
int numFailed = 0;
|
||||
sf_ptrc_glBindAttribLocationARB = (void (CODEGEN_FUNCPTR *)(GLhandleARB, GLuint, const GLcharARB *))IntGetProcAddress("glBindAttribLocationARB");
|
||||
if(!sf_ptrc_glBindAttribLocationARB) numFailed++;
|
||||
sf_ptrc_glGetActiveAttribARB = (void (CODEGEN_FUNCPTR *)(GLhandleARB, GLuint, GLsizei, GLsizei *, GLint *, GLenum *, GLcharARB *))IntGetProcAddress("glGetActiveAttribARB");
|
||||
if(!sf_ptrc_glGetActiveAttribARB) numFailed++;
|
||||
sf_ptrc_glGetAttribLocationARB = (GLint (CODEGEN_FUNCPTR *)(GLhandleARB, const GLcharARB *))IntGetProcAddress("glGetAttribLocationARB");
|
||||
if(!sf_ptrc_glGetAttribLocationARB) numFailed++;
|
||||
return numFailed;
|
||||
}
|
||||
|
||||
void (CODEGEN_FUNCPTR *sf_ptrc_glBlendEquationSeparateEXT)(GLenum, GLenum) = NULL;
|
||||
|
||||
static int Load_EXT_blend_equation_separate()
|
||||
{
|
||||
int numFailed = 0;
|
||||
sf_ptrc_glBlendEquationSeparateEXT = (void (CODEGEN_FUNCPTR *)(GLenum, GLenum))IntGetProcAddress("glBlendEquationSeparateEXT");
|
||||
if(!sf_ptrc_glBlendEquationSeparateEXT) numFailed++;
|
||||
return numFailed;
|
||||
}
|
||||
|
||||
void (CODEGEN_FUNCPTR *sf_ptrc_glBindFramebufferEXT)(GLenum, GLuint) = NULL;
|
||||
void (CODEGEN_FUNCPTR *sf_ptrc_glBindRenderbufferEXT)(GLenum, GLuint) = NULL;
|
||||
GLenum (CODEGEN_FUNCPTR *sf_ptrc_glCheckFramebufferStatusEXT)(GLenum) = NULL;
|
||||
void (CODEGEN_FUNCPTR *sf_ptrc_glDeleteFramebuffersEXT)(GLsizei, const GLuint *) = NULL;
|
||||
void (CODEGEN_FUNCPTR *sf_ptrc_glDeleteRenderbuffersEXT)(GLsizei, const GLuint *) = NULL;
|
||||
void (CODEGEN_FUNCPTR *sf_ptrc_glFramebufferRenderbufferEXT)(GLenum, GLenum, GLenum, GLuint) = NULL;
|
||||
void (CODEGEN_FUNCPTR *sf_ptrc_glFramebufferTexture1DEXT)(GLenum, GLenum, GLenum, GLuint, GLint) = NULL;
|
||||
void (CODEGEN_FUNCPTR *sf_ptrc_glFramebufferTexture2DEXT)(GLenum, GLenum, GLenum, GLuint, GLint) = NULL;
|
||||
void (CODEGEN_FUNCPTR *sf_ptrc_glFramebufferTexture3DEXT)(GLenum, GLenum, GLenum, GLuint, GLint, GLint) = NULL;
|
||||
void (CODEGEN_FUNCPTR *sf_ptrc_glGenFramebuffersEXT)(GLsizei, GLuint *) = NULL;
|
||||
void (CODEGEN_FUNCPTR *sf_ptrc_glGenRenderbuffersEXT)(GLsizei, GLuint *) = NULL;
|
||||
void (CODEGEN_FUNCPTR *sf_ptrc_glGenerateMipmapEXT)(GLenum) = NULL;
|
||||
void (CODEGEN_FUNCPTR *sf_ptrc_glGetFramebufferAttachmentParameterivEXT)(GLenum, GLenum, GLenum, GLint *) = NULL;
|
||||
void (CODEGEN_FUNCPTR *sf_ptrc_glGetRenderbufferParameterivEXT)(GLenum, GLenum, GLint *) = NULL;
|
||||
GLboolean (CODEGEN_FUNCPTR *sf_ptrc_glIsFramebufferEXT)(GLuint) = NULL;
|
||||
GLboolean (CODEGEN_FUNCPTR *sf_ptrc_glIsRenderbufferEXT)(GLuint) = NULL;
|
||||
void (CODEGEN_FUNCPTR *sf_ptrc_glRenderbufferStorageEXT)(GLenum, GLenum, GLsizei, GLsizei) = NULL;
|
||||
|
||||
static int Load_EXT_framebuffer_object()
|
||||
{
|
||||
int numFailed = 0;
|
||||
sf_ptrc_glBindFramebufferEXT = (void (CODEGEN_FUNCPTR *)(GLenum, GLuint))IntGetProcAddress("glBindFramebufferEXT");
|
||||
if(!sf_ptrc_glBindFramebufferEXT) numFailed++;
|
||||
sf_ptrc_glBindRenderbufferEXT = (void (CODEGEN_FUNCPTR *)(GLenum, GLuint))IntGetProcAddress("glBindRenderbufferEXT");
|
||||
if(!sf_ptrc_glBindRenderbufferEXT) numFailed++;
|
||||
sf_ptrc_glCheckFramebufferStatusEXT = (GLenum (CODEGEN_FUNCPTR *)(GLenum))IntGetProcAddress("glCheckFramebufferStatusEXT");
|
||||
if(!sf_ptrc_glCheckFramebufferStatusEXT) numFailed++;
|
||||
sf_ptrc_glDeleteFramebuffersEXT = (void (CODEGEN_FUNCPTR *)(GLsizei, const GLuint *))IntGetProcAddress("glDeleteFramebuffersEXT");
|
||||
if(!sf_ptrc_glDeleteFramebuffersEXT) numFailed++;
|
||||
sf_ptrc_glDeleteRenderbuffersEXT = (void (CODEGEN_FUNCPTR *)(GLsizei, const GLuint *))IntGetProcAddress("glDeleteRenderbuffersEXT");
|
||||
if(!sf_ptrc_glDeleteRenderbuffersEXT) numFailed++;
|
||||
sf_ptrc_glFramebufferRenderbufferEXT = (void (CODEGEN_FUNCPTR *)(GLenum, GLenum, GLenum, GLuint))IntGetProcAddress("glFramebufferRenderbufferEXT");
|
||||
if(!sf_ptrc_glFramebufferRenderbufferEXT) numFailed++;
|
||||
sf_ptrc_glFramebufferTexture1DEXT = (void (CODEGEN_FUNCPTR *)(GLenum, GLenum, GLenum, GLuint, GLint))IntGetProcAddress("glFramebufferTexture1DEXT");
|
||||
if(!sf_ptrc_glFramebufferTexture1DEXT) numFailed++;
|
||||
sf_ptrc_glFramebufferTexture2DEXT = (void (CODEGEN_FUNCPTR *)(GLenum, GLenum, GLenum, GLuint, GLint))IntGetProcAddress("glFramebufferTexture2DEXT");
|
||||
if(!sf_ptrc_glFramebufferTexture2DEXT) numFailed++;
|
||||
sf_ptrc_glFramebufferTexture3DEXT = (void (CODEGEN_FUNCPTR *)(GLenum, GLenum, GLenum, GLuint, GLint, GLint))IntGetProcAddress("glFramebufferTexture3DEXT");
|
||||
if(!sf_ptrc_glFramebufferTexture3DEXT) numFailed++;
|
||||
sf_ptrc_glGenFramebuffersEXT = (void (CODEGEN_FUNCPTR *)(GLsizei, GLuint *))IntGetProcAddress("glGenFramebuffersEXT");
|
||||
if(!sf_ptrc_glGenFramebuffersEXT) numFailed++;
|
||||
sf_ptrc_glGenRenderbuffersEXT = (void (CODEGEN_FUNCPTR *)(GLsizei, GLuint *))IntGetProcAddress("glGenRenderbuffersEXT");
|
||||
if(!sf_ptrc_glGenRenderbuffersEXT) numFailed++;
|
||||
sf_ptrc_glGenerateMipmapEXT = (void (CODEGEN_FUNCPTR *)(GLenum))IntGetProcAddress("glGenerateMipmapEXT");
|
||||
if(!sf_ptrc_glGenerateMipmapEXT) numFailed++;
|
||||
sf_ptrc_glGetFramebufferAttachmentParameterivEXT = (void (CODEGEN_FUNCPTR *)(GLenum, GLenum, GLenum, GLint *))IntGetProcAddress("glGetFramebufferAttachmentParameterivEXT");
|
||||
if(!sf_ptrc_glGetFramebufferAttachmentParameterivEXT) numFailed++;
|
||||
sf_ptrc_glGetRenderbufferParameterivEXT = (void (CODEGEN_FUNCPTR *)(GLenum, GLenum, GLint *))IntGetProcAddress("glGetRenderbufferParameterivEXT");
|
||||
if(!sf_ptrc_glGetRenderbufferParameterivEXT) numFailed++;
|
||||
sf_ptrc_glIsFramebufferEXT = (GLboolean (CODEGEN_FUNCPTR *)(GLuint))IntGetProcAddress("glIsFramebufferEXT");
|
||||
if(!sf_ptrc_glIsFramebufferEXT) numFailed++;
|
||||
sf_ptrc_glIsRenderbufferEXT = (GLboolean (CODEGEN_FUNCPTR *)(GLuint))IntGetProcAddress("glIsRenderbufferEXT");
|
||||
if(!sf_ptrc_glIsRenderbufferEXT) numFailed++;
|
||||
sf_ptrc_glRenderbufferStorageEXT = (void (CODEGEN_FUNCPTR *)(GLenum, GLenum, GLsizei, GLsizei))IntGetProcAddress("glRenderbufferStorageEXT");
|
||||
if(!sf_ptrc_glRenderbufferStorageEXT) numFailed++;
|
||||
return numFailed;
|
||||
}
|
||||
|
||||
void (CODEGEN_FUNCPTR *sf_ptrc_glBlendColor)(GLfloat, GLfloat, GLfloat, GLfloat) = NULL;
|
||||
void (CODEGEN_FUNCPTR *sf_ptrc_glBlendEquation)(GLenum) = NULL;
|
||||
void (CODEGEN_FUNCPTR *sf_ptrc_glCopyTexSubImage3D)(GLenum, GLint, GLint, GLint, GLint, GLint, GLint, GLsizei, GLsizei) = NULL;
|
||||
void (CODEGEN_FUNCPTR *sf_ptrc_glDrawRangeElements)(GLenum, GLuint, GLuint, GLsizei, GLenum, const GLvoid *) = NULL;
|
||||
void (CODEGEN_FUNCPTR *sf_ptrc_glTexImage3D)(GLenum, GLint, GLint, GLsizei, GLsizei, GLsizei, GLint, GLenum, GLenum, const GLvoid *) = NULL;
|
||||
void (CODEGEN_FUNCPTR *sf_ptrc_glTexSubImage3D)(GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *) = NULL;
|
||||
|
||||
static int Load_Version_1_2()
|
||||
{
|
||||
int numFailed = 0;
|
||||
sf_ptrc_glBlendColor = (void (CODEGEN_FUNCPTR *)(GLfloat, GLfloat, GLfloat, GLfloat))IntGetProcAddress("glBlendColor");
|
||||
if(!sf_ptrc_glBlendColor) numFailed++;
|
||||
sf_ptrc_glBlendEquation = (void (CODEGEN_FUNCPTR *)(GLenum))IntGetProcAddress("glBlendEquation");
|
||||
if(!sf_ptrc_glBlendEquation) numFailed++;
|
||||
sf_ptrc_glCopyTexSubImage3D = (void (CODEGEN_FUNCPTR *)(GLenum, GLint, GLint, GLint, GLint, GLint, GLint, GLsizei, GLsizei))IntGetProcAddress("glCopyTexSubImage3D");
|
||||
if(!sf_ptrc_glCopyTexSubImage3D) numFailed++;
|
||||
sf_ptrc_glDrawRangeElements = (void (CODEGEN_FUNCPTR *)(GLenum, GLuint, GLuint, GLsizei, GLenum, const GLvoid *))IntGetProcAddress("glDrawRangeElements");
|
||||
if(!sf_ptrc_glDrawRangeElements) numFailed++;
|
||||
sf_ptrc_glTexImage3D = (void (CODEGEN_FUNCPTR *)(GLenum, GLint, GLint, GLsizei, GLsizei, GLsizei, GLint, GLenum, GLenum, const GLvoid *))IntGetProcAddress("glTexImage3D");
|
||||
if(!sf_ptrc_glTexImage3D) numFailed++;
|
||||
sf_ptrc_glTexSubImage3D = (void (CODEGEN_FUNCPTR *)(GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *))IntGetProcAddress("glTexSubImage3D");
|
||||
if(!sf_ptrc_glTexSubImage3D) numFailed++;
|
||||
return numFailed;
|
||||
}
|
||||
|
||||
typedef int (*PFN_LOADFUNCPOINTERS)();
|
||||
typedef struct sfogl_StrToExtMap_s
|
||||
{
|
||||
const char *extensionName;
|
||||
int *extensionVariable;
|
||||
PFN_LOADFUNCPOINTERS LoadExtension;
|
||||
} sfogl_StrToExtMap;
|
||||
|
||||
static sfogl_StrToExtMap ExtensionMap[11] = {
|
||||
{"GL_EXT_blend_minmax", &sfogl_ext_EXT_blend_minmax, Load_EXT_blend_minmax},
|
||||
{"GL_EXT_blend_subtract", &sfogl_ext_EXT_blend_subtract, NULL},
|
||||
{"GL_ARB_multitexture", &sfogl_ext_ARB_multitexture, Load_ARB_multitexture},
|
||||
{"GL_EXT_blend_func_separate", &sfogl_ext_EXT_blend_func_separate, Load_EXT_blend_func_separate},
|
||||
{"GL_ARB_shading_language_100", &sfogl_ext_ARB_shading_language_100, NULL},
|
||||
{"GL_ARB_shader_objects", &sfogl_ext_ARB_shader_objects, Load_ARB_shader_objects},
|
||||
{"GL_ARB_vertex_shader", &sfogl_ext_ARB_vertex_shader, Load_ARB_vertex_shader},
|
||||
{"GL_ARB_fragment_shader", &sfogl_ext_ARB_fragment_shader, NULL},
|
||||
{"GL_ARB_texture_non_power_of_two", &sfogl_ext_ARB_texture_non_power_of_two, NULL},
|
||||
{"GL_EXT_blend_equation_separate", &sfogl_ext_EXT_blend_equation_separate, Load_EXT_blend_equation_separate},
|
||||
{"GL_EXT_framebuffer_object", &sfogl_ext_EXT_framebuffer_object, Load_EXT_framebuffer_object}
|
||||
};
|
||||
|
||||
static int g_extensionMapSize = 11;
|
||||
|
||||
static sfogl_StrToExtMap *FindExtEntry(const char *extensionName)
|
||||
{
|
||||
int loop;
|
||||
sfogl_StrToExtMap *currLoc = ExtensionMap;
|
||||
for(loop = 0; loop < g_extensionMapSize; ++loop, ++currLoc)
|
||||
{
|
||||
if(strcmp(extensionName, currLoc->extensionName) == 0)
|
||||
return currLoc;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void ClearExtensionVars()
|
||||
{
|
||||
sfogl_ext_EXT_blend_minmax = sfogl_LOAD_FAILED;
|
||||
sfogl_ext_EXT_blend_subtract = sfogl_LOAD_FAILED;
|
||||
sfogl_ext_ARB_multitexture = sfogl_LOAD_FAILED;
|
||||
sfogl_ext_EXT_blend_func_separate = sfogl_LOAD_FAILED;
|
||||
sfogl_ext_ARB_shading_language_100 = sfogl_LOAD_FAILED;
|
||||
sfogl_ext_ARB_shader_objects = sfogl_LOAD_FAILED;
|
||||
sfogl_ext_ARB_vertex_shader = sfogl_LOAD_FAILED;
|
||||
sfogl_ext_ARB_fragment_shader = sfogl_LOAD_FAILED;
|
||||
sfogl_ext_ARB_texture_non_power_of_two = sfogl_LOAD_FAILED;
|
||||
sfogl_ext_EXT_blend_equation_separate = sfogl_LOAD_FAILED;
|
||||
sfogl_ext_EXT_framebuffer_object = sfogl_LOAD_FAILED;
|
||||
}
|
||||
|
||||
|
||||
static void LoadExtByName(const char *extensionName)
|
||||
{
|
||||
sfogl_StrToExtMap *entry = NULL;
|
||||
entry = FindExtEntry(extensionName);
|
||||
if(entry)
|
||||
{
|
||||
if(entry->LoadExtension)
|
||||
{
|
||||
int numFailed = entry->LoadExtension();
|
||||
if(numFailed == 0)
|
||||
{
|
||||
*(entry->extensionVariable) = sfogl_LOAD_SUCCEEDED;
|
||||
}
|
||||
else
|
||||
{
|
||||
*(entry->extensionVariable) = sfogl_LOAD_SUCCEEDED + numFailed;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
*(entry->extensionVariable) = sfogl_LOAD_SUCCEEDED;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void ProcExtsFromExtString(const char *strExtList)
|
||||
{
|
||||
size_t iExtListLen = strlen(strExtList);
|
||||
const char *strExtListEnd = strExtList + iExtListLen;
|
||||
const char *strCurrPos = strExtList;
|
||||
char strWorkBuff[256];
|
||||
|
||||
while(*strCurrPos)
|
||||
{
|
||||
/*Get the extension at our position.*/
|
||||
int iStrLen = 0;
|
||||
const char *strEndStr = strchr(strCurrPos, ' ');
|
||||
int iStop = 0;
|
||||
if(strEndStr == NULL)
|
||||
{
|
||||
strEndStr = strExtListEnd;
|
||||
iStop = 1;
|
||||
}
|
||||
|
||||
iStrLen = (int)((ptrdiff_t)strEndStr - (ptrdiff_t)strCurrPos);
|
||||
|
||||
if(iStrLen > 255)
|
||||
return;
|
||||
|
||||
strncpy(strWorkBuff, strCurrPos, iStrLen);
|
||||
strWorkBuff[iStrLen] = '\0';
|
||||
|
||||
LoadExtByName(strWorkBuff);
|
||||
|
||||
strCurrPos = strEndStr + 1;
|
||||
if(iStop) break;
|
||||
}
|
||||
}
|
||||
|
||||
int sfogl_LoadFunctions()
|
||||
{
|
||||
int numFailed = 0;
|
||||
ClearExtensionVars();
|
||||
|
||||
ProcExtsFromExtString((const char *)glGetString(GL_EXTENSIONS));
|
||||
numFailed = Load_Version_1_2();
|
||||
|
||||
if(numFailed == 0)
|
||||
return sfogl_LOAD_SUCCEEDED;
|
||||
else
|
||||
return sfogl_LOAD_SUCCEEDED + numFailed;
|
||||
}
|
||||
|
||||
static int g_major_version = 0;
|
||||
static int g_minor_version = 0;
|
||||
|
||||
static void ParseVersionFromString(int *pOutMajor, int *pOutMinor, const char *strVersion)
|
||||
{
|
||||
const char *strDotPos = NULL;
|
||||
int iLength = 0;
|
||||
char strWorkBuff[10];
|
||||
*pOutMinor = 0;
|
||||
*pOutMajor = 0;
|
||||
|
||||
strDotPos = strchr(strVersion, '.');
|
||||
if(!strDotPos)
|
||||
return;
|
||||
|
||||
iLength = (int)((ptrdiff_t)strDotPos - (ptrdiff_t)strVersion);
|
||||
strncpy(strWorkBuff, strVersion, iLength);
|
||||
strWorkBuff[iLength] = '\0';
|
||||
|
||||
*pOutMajor = atoi(strWorkBuff);
|
||||
strDotPos = strchr(strVersion + iLength + 1, ' ');
|
||||
if(!strDotPos)
|
||||
{
|
||||
/*No extra data. Take the whole rest of the string.*/
|
||||
strcpy(strWorkBuff, strVersion + iLength + 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
/*Copy only up until the space.*/
|
||||
int iLengthMinor = (int)((ptrdiff_t)strDotPos - (ptrdiff_t)strVersion);
|
||||
iLengthMinor = iLengthMinor - (iLength + 1);
|
||||
strncpy(strWorkBuff, strVersion + iLength + 1, iLengthMinor);
|
||||
strWorkBuff[iLengthMinor] = '\0';
|
||||
}
|
||||
|
||||
*pOutMinor = atoi(strWorkBuff);
|
||||
}
|
||||
|
||||
static void GetGLVersion()
|
||||
{
|
||||
ParseVersionFromString(&g_major_version, &g_minor_version, (const char*)glGetString(GL_VERSION));
|
||||
}
|
||||
|
||||
int sfogl_GetMajorVersion()
|
||||
{
|
||||
if(g_major_version == 0)
|
||||
GetGLVersion();
|
||||
return g_major_version;
|
||||
}
|
||||
|
||||
int sfogl_GetMinorVersion()
|
||||
{
|
||||
if(g_major_version == 0) //Yes, check the major version to get the minor one.
|
||||
GetGLVersion();
|
||||
return g_minor_version;
|
||||
}
|
||||
|
||||
int sfogl_IsVersionGEQ(int majorVersion, int minorVersion)
|
||||
{
|
||||
if(g_major_version == 0)
|
||||
GetGLVersion();
|
||||
|
||||
if(majorVersion > g_major_version) return 0;
|
||||
if(majorVersion < g_major_version) return 1;
|
||||
if(g_minor_version >= minorVersion) return 1;
|
||||
return 0;
|
||||
}
|
||||
|
1078
src/SFML/Graphics/GLLoader.hpp
Normal file
1078
src/SFML/Graphics/GLLoader.hpp
Normal file
File diff suppressed because it is too large
Load Diff
@ -40,6 +40,18 @@
|
||||
|
||||
#ifndef SFML_OPENGL_ES
|
||||
|
||||
#if defined(SFML_SYSTEM_MACOS) || defined(SFML_SYSTEM_IOS)
|
||||
|
||||
#define castToGlHandle(x) reinterpret_cast<GLEXT_GLhandle>(static_cast<ptrdiff_t>(x))
|
||||
#define castFromGlHandle(x) static_cast<unsigned int>(reinterpret_cast<ptrdiff_t>(x))
|
||||
|
||||
#else
|
||||
|
||||
#define castToGlHandle(x) (x)
|
||||
#define castFromGlHandle(x) (x)
|
||||
|
||||
#endif
|
||||
|
||||
namespace
|
||||
{
|
||||
sf::Mutex mutex;
|
||||
@ -47,8 +59,7 @@ namespace
|
||||
GLint checkMaxTextureUnits()
|
||||
{
|
||||
GLint maxUnits = 0;
|
||||
|
||||
glCheck(glGetIntegerv(GL_MAX_TEXTURE_COORDS_ARB, &maxUnits));
|
||||
glCheck(glGetIntegerv(GLEXT_GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS, &maxUnits));
|
||||
|
||||
return maxUnits;
|
||||
}
|
||||
@ -113,10 +124,11 @@ namespace
|
||||
// Make sure that extensions are initialized
|
||||
sf::priv::ensureExtensionsInit();
|
||||
|
||||
bool available = GLEW_ARB_shading_language_100 &&
|
||||
GLEW_ARB_shader_objects &&
|
||||
GLEW_ARB_vertex_shader &&
|
||||
GLEW_ARB_fragment_shader;
|
||||
bool available = GLEXT_multitexture &&
|
||||
GLEXT_shading_language_100 &&
|
||||
GLEXT_shader_objects &&
|
||||
GLEXT_vertex_shader &&
|
||||
GLEXT_fragment_shader;
|
||||
|
||||
return available;
|
||||
}
|
||||
@ -146,7 +158,7 @@ Shader::~Shader()
|
||||
|
||||
// Destroy effect program
|
||||
if (m_shaderProgram)
|
||||
glCheck(glDeleteObjectARB(m_shaderProgram));
|
||||
glCheck(GLEXT_glDeleteObject(castToGlHandle(m_shaderProgram)));
|
||||
}
|
||||
|
||||
|
||||
@ -263,18 +275,18 @@ void Shader::setParameter(const std::string& name, float x)
|
||||
ensureGlContext();
|
||||
|
||||
// Enable program
|
||||
GLhandleARB program = glCheck(glGetHandleARB(GL_PROGRAM_OBJECT_ARB));
|
||||
glCheck(glUseProgramObjectARB(m_shaderProgram));
|
||||
GLEXT_GLhandle program = glCheck(GLEXT_glGetHandle(GLEXT_GL_PROGRAM_OBJECT));
|
||||
glCheck(GLEXT_glUseProgramObject(castToGlHandle(m_shaderProgram)));
|
||||
|
||||
// Get parameter location and assign it new values
|
||||
GLint location = getParamLocation(name);
|
||||
if (location != -1)
|
||||
{
|
||||
glCheck(glUniform1fARB(location, x));
|
||||
glCheck(GLEXT_glUniform1f(location, x));
|
||||
}
|
||||
|
||||
// Disable program
|
||||
glCheck(glUseProgramObjectARB(program));
|
||||
glCheck(GLEXT_glUseProgramObject(program));
|
||||
}
|
||||
}
|
||||
|
||||
@ -287,18 +299,18 @@ void Shader::setParameter(const std::string& name, float x, float y)
|
||||
ensureGlContext();
|
||||
|
||||
// Enable program
|
||||
GLhandleARB program = glCheck(glGetHandleARB(GL_PROGRAM_OBJECT_ARB));
|
||||
glCheck(glUseProgramObjectARB(m_shaderProgram));
|
||||
GLEXT_GLhandle program = glCheck(GLEXT_glGetHandle(GLEXT_GL_PROGRAM_OBJECT));
|
||||
glCheck(GLEXT_glUseProgramObject(castToGlHandle(m_shaderProgram)));
|
||||
|
||||
// Get parameter location and assign it new values
|
||||
GLint location = getParamLocation(name);
|
||||
if (location != -1)
|
||||
{
|
||||
glCheck(glUniform2fARB(location, x, y));
|
||||
glCheck(GLEXT_glUniform2f(location, x, y));
|
||||
}
|
||||
|
||||
// Disable program
|
||||
glCheck(glUseProgramObjectARB(program));
|
||||
glCheck(GLEXT_glUseProgramObject(program));
|
||||
}
|
||||
}
|
||||
|
||||
@ -311,18 +323,18 @@ void Shader::setParameter(const std::string& name, float x, float y, float z)
|
||||
ensureGlContext();
|
||||
|
||||
// Enable program
|
||||
GLhandleARB program = glCheck(glGetHandleARB(GL_PROGRAM_OBJECT_ARB));
|
||||
glCheck(glUseProgramObjectARB(m_shaderProgram));
|
||||
GLEXT_GLhandle program = glCheck(GLEXT_glGetHandle(GLEXT_GL_PROGRAM_OBJECT));
|
||||
glCheck(GLEXT_glUseProgramObject(castToGlHandle(m_shaderProgram)));
|
||||
|
||||
// Get parameter location and assign it new values
|
||||
GLint location = getParamLocation(name);
|
||||
if (location != -1)
|
||||
{
|
||||
glCheck(glUniform3fARB(location, x, y, z));
|
||||
glCheck(GLEXT_glUniform3f(location, x, y, z));
|
||||
}
|
||||
|
||||
// Disable program
|
||||
glCheck(glUseProgramObjectARB(program));
|
||||
glCheck(GLEXT_glUseProgramObject(program));
|
||||
}
|
||||
}
|
||||
|
||||
@ -335,18 +347,18 @@ void Shader::setParameter(const std::string& name, float x, float y, float z, fl
|
||||
ensureGlContext();
|
||||
|
||||
// Enable program
|
||||
GLhandleARB program = glCheck(glGetHandleARB(GL_PROGRAM_OBJECT_ARB));
|
||||
glCheck(glUseProgramObjectARB(m_shaderProgram));
|
||||
GLEXT_GLhandle program = glCheck(GLEXT_glGetHandle(GLEXT_GL_PROGRAM_OBJECT));
|
||||
glCheck(GLEXT_glUseProgramObject(castToGlHandle(m_shaderProgram)));
|
||||
|
||||
// Get parameter location and assign it new values
|
||||
GLint location = getParamLocation(name);
|
||||
if (location != -1)
|
||||
{
|
||||
glCheck(glUniform4fARB(location, x, y, z, w));
|
||||
glCheck(GLEXT_glUniform4f(location, x, y, z, w));
|
||||
}
|
||||
|
||||
// Disable program
|
||||
glCheck(glUseProgramObjectARB(program));
|
||||
glCheck(GLEXT_glUseProgramObject(program));
|
||||
}
|
||||
}
|
||||
|
||||
@ -380,18 +392,18 @@ void Shader::setParameter(const std::string& name, const sf::Transform& transfor
|
||||
ensureGlContext();
|
||||
|
||||
// Enable program
|
||||
GLhandleARB program = glCheck(glGetHandleARB(GL_PROGRAM_OBJECT_ARB));
|
||||
glCheck(glUseProgramObjectARB(m_shaderProgram));
|
||||
GLEXT_GLhandle program = glCheck(GLEXT_glGetHandle(GLEXT_GL_PROGRAM_OBJECT));
|
||||
glCheck(GLEXT_glUseProgramObject(castToGlHandle(m_shaderProgram)));
|
||||
|
||||
// Get parameter location and assign it new values
|
||||
GLint location = getParamLocation(name);
|
||||
if (location != -1)
|
||||
{
|
||||
glCheck(glUniformMatrix4fvARB(location, 1, GL_FALSE, transform.getMatrix()));
|
||||
glCheck(GLEXT_glUniformMatrix4fv(location, 1, GL_FALSE, transform.getMatrix()));
|
||||
}
|
||||
|
||||
// Disable program
|
||||
glCheck(glUseProgramObjectARB(program));
|
||||
glCheck(GLEXT_glUseProgramObject(program));
|
||||
}
|
||||
}
|
||||
|
||||
@ -449,22 +461,30 @@ void Shader::bind(const Shader* shader)
|
||||
{
|
||||
ensureGlContext();
|
||||
|
||||
// Make sure that we can use shaders
|
||||
if (!isAvailable())
|
||||
{
|
||||
err() << "Failed to bind or unbind shader: your system doesn't support shaders "
|
||||
<< "(you should test Shader::isAvailable() before trying to use the Shader class)" << std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
if (shader && shader->m_shaderProgram)
|
||||
{
|
||||
// Enable the program
|
||||
glCheck(glUseProgramObjectARB(shader->m_shaderProgram));
|
||||
glCheck(GLEXT_glUseProgramObject(castToGlHandle(shader->m_shaderProgram)));
|
||||
|
||||
// Bind the textures
|
||||
shader->bindTextures();
|
||||
|
||||
// Bind the current texture
|
||||
if (shader->m_currentTexture != -1)
|
||||
glCheck(glUniform1iARB(shader->m_currentTexture, 0));
|
||||
glCheck(GLEXT_glUniform1i(shader->m_currentTexture, 0));
|
||||
}
|
||||
else
|
||||
{
|
||||
// Bind no shader
|
||||
glCheck(glUseProgramObjectARB(0));
|
||||
glCheck(GLEXT_glUseProgramObject(0));
|
||||
}
|
||||
}
|
||||
|
||||
@ -496,7 +516,10 @@ bool Shader::compile(const char* vertexShaderCode, const char* fragmentShaderCod
|
||||
|
||||
// Destroy the shader if it was already created
|
||||
if (m_shaderProgram)
|
||||
glCheck(glDeleteObjectARB(m_shaderProgram));
|
||||
{
|
||||
glCheck(GLEXT_glDeleteObject(castToGlHandle(m_shaderProgram)));
|
||||
m_shaderProgram = 0;
|
||||
}
|
||||
|
||||
// Reset the internal state
|
||||
m_currentTexture = -1;
|
||||
@ -504,81 +527,80 @@ bool Shader::compile(const char* vertexShaderCode, const char* fragmentShaderCod
|
||||
m_params.clear();
|
||||
|
||||
// Create the program
|
||||
m_shaderProgram = glCheck(glCreateProgramObjectARB());
|
||||
GLEXT_GLhandle shaderProgram = glCheck(GLEXT_glCreateProgramObject());
|
||||
|
||||
// Create the vertex shader if needed
|
||||
if (vertexShaderCode)
|
||||
{
|
||||
// Create and compile the shader
|
||||
GLhandleARB vertexShader = glCheck(glCreateShaderObjectARB(GL_VERTEX_SHADER_ARB));
|
||||
glCheck(glShaderSourceARB(vertexShader, 1, &vertexShaderCode, NULL));
|
||||
glCheck(glCompileShaderARB(vertexShader));
|
||||
GLEXT_GLhandle vertexShader = glCheck(GLEXT_glCreateShaderObject(GLEXT_GL_VERTEX_SHADER));
|
||||
glCheck(GLEXT_glShaderSource(vertexShader, 1, &vertexShaderCode, NULL));
|
||||
glCheck(GLEXT_glCompileShader(vertexShader));
|
||||
|
||||
// Check the compile log
|
||||
GLint success;
|
||||
glCheck(glGetObjectParameterivARB(vertexShader, GL_OBJECT_COMPILE_STATUS_ARB, &success));
|
||||
glCheck(GLEXT_glGetObjectParameteriv(vertexShader, GLEXT_GL_OBJECT_COMPILE_STATUS, &success));
|
||||
if (success == GL_FALSE)
|
||||
{
|
||||
char log[1024];
|
||||
glCheck(glGetInfoLogARB(vertexShader, sizeof(log), 0, log));
|
||||
glCheck(GLEXT_glGetInfoLog(vertexShader, sizeof(log), 0, log));
|
||||
err() << "Failed to compile vertex shader:" << std::endl
|
||||
<< log << std::endl;
|
||||
glCheck(glDeleteObjectARB(vertexShader));
|
||||
glCheck(glDeleteObjectARB(m_shaderProgram));
|
||||
m_shaderProgram = 0;
|
||||
glCheck(GLEXT_glDeleteObject(vertexShader));
|
||||
glCheck(GLEXT_glDeleteObject(shaderProgram));
|
||||
return false;
|
||||
}
|
||||
|
||||
// Attach the shader to the program, and delete it (not needed anymore)
|
||||
glCheck(glAttachObjectARB(m_shaderProgram, vertexShader));
|
||||
glCheck(glDeleteObjectARB(vertexShader));
|
||||
glCheck(GLEXT_glAttachObject(shaderProgram, vertexShader));
|
||||
glCheck(GLEXT_glDeleteObject(vertexShader));
|
||||
}
|
||||
|
||||
// Create the fragment shader if needed
|
||||
if (fragmentShaderCode)
|
||||
{
|
||||
// Create and compile the shader
|
||||
GLhandleARB fragmentShader = glCheck(glCreateShaderObjectARB(GL_FRAGMENT_SHADER_ARB));
|
||||
glCheck(glShaderSourceARB(fragmentShader, 1, &fragmentShaderCode, NULL));
|
||||
glCheck(glCompileShaderARB(fragmentShader));
|
||||
GLEXT_GLhandle fragmentShader = glCheck(GLEXT_glCreateShaderObject(GLEXT_GL_FRAGMENT_SHADER));
|
||||
glCheck(GLEXT_glShaderSource(fragmentShader, 1, &fragmentShaderCode, NULL));
|
||||
glCheck(GLEXT_glCompileShader(fragmentShader));
|
||||
|
||||
// Check the compile log
|
||||
GLint success;
|
||||
glCheck(glGetObjectParameterivARB(fragmentShader, GL_OBJECT_COMPILE_STATUS_ARB, &success));
|
||||
glCheck(GLEXT_glGetObjectParameteriv(fragmentShader, GLEXT_GL_OBJECT_COMPILE_STATUS, &success));
|
||||
if (success == GL_FALSE)
|
||||
{
|
||||
char log[1024];
|
||||
glCheck(glGetInfoLogARB(fragmentShader, sizeof(log), 0, log));
|
||||
glCheck(GLEXT_glGetInfoLog(fragmentShader, sizeof(log), 0, log));
|
||||
err() << "Failed to compile fragment shader:" << std::endl
|
||||
<< log << std::endl;
|
||||
glCheck(glDeleteObjectARB(fragmentShader));
|
||||
glCheck(glDeleteObjectARB(m_shaderProgram));
|
||||
m_shaderProgram = 0;
|
||||
glCheck(GLEXT_glDeleteObject(fragmentShader));
|
||||
glCheck(GLEXT_glDeleteObject(shaderProgram));
|
||||
return false;
|
||||
}
|
||||
|
||||
// Attach the shader to the program, and delete it (not needed anymore)
|
||||
glCheck(glAttachObjectARB(m_shaderProgram, fragmentShader));
|
||||
glCheck(glDeleteObjectARB(fragmentShader));
|
||||
glCheck(GLEXT_glAttachObject(shaderProgram, fragmentShader));
|
||||
glCheck(GLEXT_glDeleteObject(fragmentShader));
|
||||
}
|
||||
|
||||
// Link the program
|
||||
glCheck(glLinkProgramARB(m_shaderProgram));
|
||||
glCheck(GLEXT_glLinkProgram(shaderProgram));
|
||||
|
||||
// Check the link log
|
||||
GLint success;
|
||||
glCheck(glGetObjectParameterivARB(m_shaderProgram, GL_OBJECT_LINK_STATUS_ARB, &success));
|
||||
glCheck(GLEXT_glGetObjectParameteriv(shaderProgram, GLEXT_GL_OBJECT_LINK_STATUS, &success));
|
||||
if (success == GL_FALSE)
|
||||
{
|
||||
char log[1024];
|
||||
glCheck(glGetInfoLogARB(m_shaderProgram, sizeof(log), 0, log));
|
||||
glCheck(GLEXT_glGetInfoLog(shaderProgram, sizeof(log), 0, log));
|
||||
err() << "Failed to link shader:" << std::endl
|
||||
<< log << std::endl;
|
||||
glCheck(glDeleteObjectARB(m_shaderProgram));
|
||||
m_shaderProgram = 0;
|
||||
glCheck(GLEXT_glDeleteObject(shaderProgram));
|
||||
return false;
|
||||
}
|
||||
|
||||
m_shaderProgram = castFromGlHandle(shaderProgram);
|
||||
|
||||
// Force an OpenGL flush, so that the shader will appear updated
|
||||
// in all contexts immediately (solves problems in multi-threaded apps)
|
||||
glCheck(glFlush());
|
||||
@ -594,14 +616,14 @@ void Shader::bindTextures() const
|
||||
for (std::size_t i = 0; i < m_textures.size(); ++i)
|
||||
{
|
||||
GLint index = static_cast<GLsizei>(i + 1);
|
||||
glCheck(glUniform1iARB(it->first, index));
|
||||
glCheck(glActiveTextureARB(GL_TEXTURE0_ARB + index));
|
||||
glCheck(GLEXT_glUniform1i(it->first, index));
|
||||
glCheck(GLEXT_glActiveTexture(GLEXT_GL_TEXTURE0 + index));
|
||||
Texture::bind(it->second);
|
||||
++it;
|
||||
}
|
||||
|
||||
// Make sure that the texture unit which is left active is the number 0
|
||||
glCheck(glActiveTextureARB(GL_TEXTURE0_ARB));
|
||||
glCheck(GLEXT_glActiveTexture(GLEXT_GL_TEXTURE0));
|
||||
}
|
||||
|
||||
|
||||
@ -618,7 +640,7 @@ int Shader::getParamLocation(const std::string& name)
|
||||
else
|
||||
{
|
||||
// Not in cache, request the location from OpenGL
|
||||
int location = glGetUniformLocationARB(m_shaderProgram, name.c_str());
|
||||
int location = GLEXT_glGetUniformLocation(castToGlHandle(m_shaderProgram), name.c_str());
|
||||
m_params.insert(std::make_pair(name, location));
|
||||
|
||||
if (location == -1)
|
||||
|
@ -80,7 +80,6 @@ m_isRepeated (false),
|
||||
m_pixelsFlipped(false),
|
||||
m_cacheId (getUniqueId())
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -53,6 +53,8 @@ if(SFML_OS_WINDOWS)
|
||||
set(PLATFORM_SRC
|
||||
${SRCROOT}/Win32/WglContext.cpp
|
||||
${SRCROOT}/Win32/WglContext.hpp
|
||||
${SRCROOT}/Win32/WglExtensions.cpp
|
||||
${SRCROOT}/Win32/WglExtensions.hpp
|
||||
${SRCROOT}/Win32/InputImpl.cpp
|
||||
${SRCROOT}/Win32/InputImpl.hpp
|
||||
${SRCROOT}/Win32/JoystickImpl.cpp
|
||||
@ -84,6 +86,8 @@ elseif(SFML_OS_LINUX OR SFML_OS_FREEBSD)
|
||||
${PLATFORM_SRC}
|
||||
${SRCROOT}/Unix/GlxContext.cpp
|
||||
${SRCROOT}/Unix/GlxContext.hpp
|
||||
${SRCROOT}/Unix/GlxExtensions.cpp
|
||||
${SRCROOT}/Unix/GlxExtensions.hpp
|
||||
)
|
||||
endif()
|
||||
if(SFML_OS_LINUX)
|
||||
|
@ -32,11 +32,6 @@
|
||||
#include <SFML/OpenGL.hpp>
|
||||
#include <set>
|
||||
#include <cstdlib>
|
||||
#ifdef SFML_SYSTEM_IOS
|
||||
#include <OpenGLES/ES1/gl.h>
|
||||
#else
|
||||
#include <SFML/Window/glext/glext.h>
|
||||
#endif
|
||||
|
||||
#if !defined(SFML_OPENGL_ES)
|
||||
|
||||
@ -73,6 +68,30 @@
|
||||
|
||||
#endif
|
||||
|
||||
#if !defined(GL_MULTISAMPLE)
|
||||
#define GL_MULTISAMPLE 0x809D
|
||||
#endif
|
||||
|
||||
#if !defined(GL_CONTEXT_FLAGS)
|
||||
#define GL_CONTEXT_FLAGS 0x821E
|
||||
#endif
|
||||
|
||||
#if !defined(GL_CONTEXT_FLAG_DEBUG_BIT)
|
||||
#define GL_CONTEXT_FLAG_DEBUG_BIT 0x00000002
|
||||
#endif
|
||||
|
||||
#if !defined(GL_CONTEXT_PROFILE_MASK)
|
||||
#define GL_CONTEXT_PROFILE_MASK 0x9126
|
||||
#endif
|
||||
|
||||
#if !defined(GL_CONTEXT_CORE_PROFILE_BIT)
|
||||
#define GL_CONTEXT_CORE_PROFILE_BIT 0x00000001
|
||||
#endif
|
||||
|
||||
#if !defined(GL_CONTEXT_COMPATIBILITY_PROFILE_BIT)
|
||||
#define GL_CONTEXT_COMPATIBILITY_PROFILE_BIT 0x00000002
|
||||
#endif
|
||||
|
||||
|
||||
namespace
|
||||
{
|
||||
@ -285,9 +304,34 @@ void GlContext::initialize()
|
||||
}
|
||||
else
|
||||
{
|
||||
// Can't get the version number, assume 2.0
|
||||
// Can't get the version number, assume 2.1
|
||||
m_settings.majorVersion = 2;
|
||||
m_settings.minorVersion = 0;
|
||||
m_settings.minorVersion = 1;
|
||||
}
|
||||
|
||||
// Verify non-default settings, just to be extra sure
|
||||
if (m_settings.attributeFlags & ContextSettings::Debug)
|
||||
{
|
||||
// Retrieve the context flags
|
||||
int flags = 0;
|
||||
glGetIntegerv(GL_CONTEXT_FLAGS, &flags);
|
||||
|
||||
if (!(flags & GL_CONTEXT_FLAG_DEBUG_BIT))
|
||||
{
|
||||
m_settings.attributeFlags ^= ContextSettings::Debug;
|
||||
}
|
||||
}
|
||||
|
||||
if (m_settings.attributeFlags & ContextSettings::Core)
|
||||
{
|
||||
// Retrieve the context profile
|
||||
int profile = 0;
|
||||
glGetIntegerv(GL_CONTEXT_PROFILE_MASK, &profile);
|
||||
|
||||
if (!(profile & GL_CONTEXT_CORE_PROFILE_BIT))
|
||||
{
|
||||
m_settings.attributeFlags ^= ContextSettings::Core;
|
||||
}
|
||||
}
|
||||
|
||||
// Enable antialiasing if needed
|
||||
|
@ -140,6 +140,9 @@ void SFContext::createContext(SFContext* shared,
|
||||
unsigned int bitsPerPixel,
|
||||
const ContextSettings& settings)
|
||||
{
|
||||
// Save the settings. (OpenGL version is updated elsewhere.)
|
||||
m_settings = settings;
|
||||
|
||||
// Choose the attributes of OGL context.
|
||||
std::vector<NSOpenGLPixelFormatAttribute> attrs;
|
||||
attrs.reserve(20); // max attributes (estimation).
|
||||
@ -156,12 +159,12 @@ void SFContext::createContext(SFContext* shared,
|
||||
}
|
||||
|
||||
attrs.push_back(NSOpenGLPFADepthSize);
|
||||
attrs.push_back((NSOpenGLPixelFormatAttribute)settings.depthBits);
|
||||
attrs.push_back((NSOpenGLPixelFormatAttribute)m_settings.depthBits);
|
||||
|
||||
attrs.push_back(NSOpenGLPFAStencilSize);
|
||||
attrs.push_back((NSOpenGLPixelFormatAttribute)settings.stencilBits);
|
||||
attrs.push_back((NSOpenGLPixelFormatAttribute)m_settings.stencilBits);
|
||||
|
||||
if (settings.antialiasingLevel > 0)
|
||||
if (m_settings.antialiasingLevel > 0)
|
||||
{
|
||||
/*
|
||||
* Antialiasing techniques are described in the
|
||||
@ -183,32 +186,48 @@ void SFContext::createContext(SFContext* shared,
|
||||
|
||||
// Antialiasing level
|
||||
attrs.push_back(NSOpenGLPFASamples);
|
||||
attrs.push_back((NSOpenGLPixelFormatAttribute)settings.antialiasingLevel);
|
||||
attrs.push_back((NSOpenGLPixelFormatAttribute)m_settings.antialiasingLevel);
|
||||
|
||||
// No software renderer - only hardware renderer
|
||||
attrs.push_back(NSOpenGLPFAAccelerated);
|
||||
}
|
||||
|
||||
// Support for OpenGL 3.2 on Mac OS X Lion and later:
|
||||
// SFML 2 Graphics module uses some OpenGL features that are deprecated
|
||||
// in OpenGL 3.2 and that are no more available with core context.
|
||||
// SFML 2 Graphics module uses some OpenGL features that are deprecated in
|
||||
// OpenGL 3.0 and that are no longer available in 3.1 and 3.2+ with a core context.
|
||||
// Therefore the Graphics module won't work as expected.
|
||||
|
||||
// 2.x are mapped to 2.1 since Apple only support that legacy version.
|
||||
// 1.x/2.x are mapped to 2.1 since Apple only support that legacy version.
|
||||
// >=3.0 are mapped to a 3.2 core profile.
|
||||
bool legacy = settings.majorVersion < 3;
|
||||
bool legacy = m_settings.majorVersion < 3;
|
||||
|
||||
if (legacy)
|
||||
{
|
||||
m_settings.attributeFlags &= ~ContextSettings::Core;
|
||||
m_settings.majorVersion = 2;
|
||||
m_settings.minorVersion = 1;
|
||||
attrs.push_back(NSOpenGLPFAOpenGLProfile);
|
||||
attrs.push_back(NSOpenGLProfileVersionLegacy);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!(m_settings.attributeFlags & ContextSettings::Core))
|
||||
{
|
||||
sf::err() << "Warning. Compatibility profile not supported on this platform." << std::endl;
|
||||
m_settings.attributeFlags |= ContextSettings::Core;
|
||||
}
|
||||
m_settings.majorVersion = 3;
|
||||
m_settings.minorVersion = 2;
|
||||
attrs.push_back(NSOpenGLPFAOpenGLProfile);
|
||||
attrs.push_back(NSOpenGLProfileVersion3_2Core);
|
||||
}
|
||||
|
||||
if (m_settings.attributeFlags & ContextSettings::Debug)
|
||||
{
|
||||
sf::err() << "Warning. OpenGL debugging not supported on this platform." << std::endl;
|
||||
m_settings.attributeFlags &= ~ContextSettings::Debug;
|
||||
}
|
||||
|
||||
attrs.push_back((NSOpenGLPixelFormatAttribute)0); // end of array
|
||||
|
||||
// Create the pixel format.
|
||||
@ -242,8 +261,6 @@ void SFContext::createContext(SFContext* shared,
|
||||
// Free up.
|
||||
[pixFmt release];
|
||||
|
||||
// Save the settings. (OpenGL version is updated elsewhere.)
|
||||
m_settings = settings;
|
||||
}
|
||||
|
||||
} // namespace priv
|
||||
|
@ -28,7 +28,6 @@
|
||||
#include <SFML/Window/Unix/GlxContext.hpp>
|
||||
#include <SFML/Window/Unix/WindowImplX11.hpp>
|
||||
#include <SFML/Window/Unix/Display.hpp>
|
||||
#include <SFML/OpenGL.hpp>
|
||||
#include <SFML/System/Err.hpp>
|
||||
|
||||
|
||||
@ -36,6 +35,25 @@ namespace sf
|
||||
{
|
||||
namespace priv
|
||||
{
|
||||
////////////////////////////////////////////////////////////
|
||||
void ensureExtensionsInit(::Display* display, int screen)
|
||||
{
|
||||
static bool initialized = false;
|
||||
if (!initialized)
|
||||
{
|
||||
int loaded = sfglx_LoadFunctions(display, screen);
|
||||
if (loaded == sfglx_LOAD_FAILED)
|
||||
{
|
||||
err() << "Failed to initialize GlxExtensions" << std::endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
initialized = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
GlxContext::GlxContext(GlxContext* shared) :
|
||||
m_window (0),
|
||||
@ -177,10 +195,11 @@ void GlxContext::display()
|
||||
////////////////////////////////////////////////////////////
|
||||
void GlxContext::setVerticalSyncEnabled(bool enabled)
|
||||
{
|
||||
const GLubyte* name = reinterpret_cast<const GLubyte*>("glXSwapIntervalSGI");
|
||||
PFNGLXSWAPINTERVALSGIPROC glXSwapIntervalSGI = reinterpret_cast<PFNGLXSWAPINTERVALSGIPROC>(glXGetProcAddress(name));
|
||||
if (glXSwapIntervalSGI)
|
||||
glXSwapIntervalSGI(enabled ? 1 : 0);
|
||||
// Make sure that extensions are initialized
|
||||
ensureExtensionsInit(m_display, DefaultScreen(m_display));
|
||||
|
||||
if (sfglx_ext_EXT_swap_control == sfglx_LOAD_SUCCEEDED)
|
||||
glXSwapIntervalEXT(m_display, glXGetCurrentDrawable(), enabled ? 1 : 0);
|
||||
}
|
||||
|
||||
|
||||
@ -330,119 +349,180 @@ void GlxContext::createContext(GlxContext* shared, unsigned int bitsPerPixel, co
|
||||
if (!glXQueryVersion(m_display, &major, &minor))
|
||||
err() << "Failed to query GLX version, limited to legacy context creation" << std::endl;
|
||||
|
||||
// Create the OpenGL context -- first try context versions >= 3.0 if it is requested (they require special code and GLX 1.3 or greater)
|
||||
if ((m_settings.majorVersion >= 3) && ((major > 1) || (minor >= 3)))
|
||||
// Make sure that extensions are initialized if this is not the shared context
|
||||
// The shared context is the context used to initialize the extensions
|
||||
if (shared)
|
||||
ensureExtensionsInit(m_display, DefaultScreen(m_display));
|
||||
|
||||
// Create the OpenGL context -- first try using glXCreateContextAttribsARB (requires GLX 1.3 or greater)
|
||||
if ((sfglx_ext_ARB_create_context == sfglx_LOAD_SUCCEEDED) && ((major > 1) || (minor >= 3)))
|
||||
{
|
||||
const GLubyte* name = reinterpret_cast<const GLubyte*>("glXCreateContextAttribsARB");
|
||||
PFNGLXCREATECONTEXTATTRIBSARBPROC glXCreateContextAttribsARB = reinterpret_cast<PFNGLXCREATECONTEXTATTRIBSARBPROC>(glXGetProcAddress(name));
|
||||
if (glXCreateContextAttribsARB)
|
||||
// Select a GLXFB config that matches the requested context settings
|
||||
int nbConfigs = 0;
|
||||
GLXFBConfig* configs = NULL;
|
||||
|
||||
// Check if multisampling is supported
|
||||
if (sfglx_ext_ARB_multisample == sfglx_LOAD_SUCCEEDED)
|
||||
{
|
||||
// Select a GLXFB config that matches the requested context settings
|
||||
int nbConfigs = 0;
|
||||
int fbAttributes[] =
|
||||
{
|
||||
GLX_DEPTH_SIZE, static_cast<int>(settings.depthBits),
|
||||
GLX_STENCIL_SIZE, static_cast<int>(settings.stencilBits),
|
||||
GLX_SAMPLE_BUFFERS, settings.antialiasingLevel > 0,
|
||||
GLX_SAMPLES, static_cast<int>(settings.antialiasingLevel),
|
||||
GLX_RED_SIZE, 8,
|
||||
GLX_GREEN_SIZE, 8,
|
||||
GLX_BLUE_SIZE, 8,
|
||||
GLX_ALPHA_SIZE, bitsPerPixel == 32 ? 8 : 0,
|
||||
GLX_DOUBLEBUFFER, True,
|
||||
GLX_X_RENDERABLE, True,
|
||||
GLX_DEPTH_SIZE, static_cast<int>(settings.depthBits),
|
||||
GLX_STENCIL_SIZE, static_cast<int>(settings.stencilBits),
|
||||
GLX_SAMPLE_BUFFERS_ARB, (settings.antialiasingLevel > 0) ? 1 : 0,
|
||||
GLX_SAMPLES_ARB, static_cast<int>(settings.antialiasingLevel),
|
||||
GLX_RED_SIZE, 8,
|
||||
GLX_GREEN_SIZE, 8,
|
||||
GLX_BLUE_SIZE, 8,
|
||||
GLX_ALPHA_SIZE, bitsPerPixel == 32 ? 8 : 0,
|
||||
GLX_DOUBLEBUFFER, True,
|
||||
GLX_X_RENDERABLE, True,
|
||||
GLX_DRAWABLE_TYPE, GLX_WINDOW_BIT,
|
||||
GLX_RENDER_TYPE, GLX_RGBA_BIT,
|
||||
GLX_CONFIG_CAVEAT, GLX_NONE,
|
||||
None
|
||||
};
|
||||
configs = glXChooseFBConfig(m_display, DefaultScreen(m_display), fbAttributes, &nbConfigs);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_settings.antialiasingLevel = 0;
|
||||
|
||||
int fbAttributes[] =
|
||||
{
|
||||
GLX_DEPTH_SIZE, static_cast<int>(settings.depthBits),
|
||||
GLX_STENCIL_SIZE, static_cast<int>(settings.stencilBits),
|
||||
GLX_RED_SIZE, 8,
|
||||
GLX_GREEN_SIZE, 8,
|
||||
GLX_BLUE_SIZE, 8,
|
||||
GLX_ALPHA_SIZE, bitsPerPixel == 32 ? 8 : 0,
|
||||
GLX_DOUBLEBUFFER, True,
|
||||
GLX_X_RENDERABLE, True,
|
||||
GLX_DRAWABLE_TYPE, GLX_WINDOW_BIT,
|
||||
GLX_RENDER_TYPE, GLX_RGBA_BIT,
|
||||
GLX_RENDER_TYPE, GLX_RGBA_BIT,
|
||||
GLX_CONFIG_CAVEAT, GLX_NONE,
|
||||
None
|
||||
};
|
||||
GLXFBConfig* configs = glXChooseFBConfig(m_display, DefaultScreen(m_display), fbAttributes, &nbConfigs);
|
||||
configs = glXChooseFBConfig(m_display, DefaultScreen(m_display), fbAttributes, &nbConfigs);
|
||||
}
|
||||
|
||||
int bestScore = 0xFFFF;
|
||||
GLXFBConfig* bestConfig;
|
||||
int bestScore = 0xFFFF;
|
||||
GLXFBConfig* bestConfig;
|
||||
|
||||
for (int i = 0; configs && (i < nbConfigs); ++i)
|
||||
for (int i = 0; configs && (i < nbConfigs); ++i)
|
||||
{
|
||||
XVisualInfo* visual = glXGetVisualFromFBConfig(m_display, configs[i]);
|
||||
|
||||
// We only want FBConfigs with associated X visuals (most have one)
|
||||
// We do this to match what was used during window creation
|
||||
if (!visual)
|
||||
continue;
|
||||
|
||||
// We won't need the visual for glXCreateContextAttribsARB, so get rid of it
|
||||
XFree(visual);
|
||||
|
||||
// Check mandatory attributes
|
||||
int doubleBuffer;
|
||||
glXGetFBConfigAttrib(m_display, configs[i], GLX_DOUBLEBUFFER, &doubleBuffer);
|
||||
if (!doubleBuffer)
|
||||
continue;
|
||||
|
||||
// Extract the components of the current visual
|
||||
int red, green, blue, alpha, depth, stencil, multiSampling, samples;
|
||||
glXGetFBConfigAttrib(m_display, configs[i], GLX_RED_SIZE, &red);
|
||||
glXGetFBConfigAttrib(m_display, configs[i], GLX_GREEN_SIZE, &green);
|
||||
glXGetFBConfigAttrib(m_display, configs[i], GLX_BLUE_SIZE, &blue);
|
||||
glXGetFBConfigAttrib(m_display, configs[i], GLX_ALPHA_SIZE, &alpha);
|
||||
glXGetFBConfigAttrib(m_display, configs[i], GLX_DEPTH_SIZE, &depth);
|
||||
glXGetFBConfigAttrib(m_display, configs[i], GLX_STENCIL_SIZE, &stencil);
|
||||
glXGetFBConfigAttrib(m_display, configs[i], GLX_SAMPLE_BUFFERS_ARB, &multiSampling);
|
||||
glXGetFBConfigAttrib(m_display, configs[i], GLX_SAMPLES_ARB, &samples);
|
||||
|
||||
// Evaluate the visual
|
||||
int color = red + green + blue + alpha;
|
||||
int score = evaluateFormat(bitsPerPixel, settings, color, depth, stencil, multiSampling ? samples : 0);
|
||||
|
||||
// If it's better than the current best, make it the new best
|
||||
if (score < bestScore)
|
||||
{
|
||||
XVisualInfo* visual = glXGetVisualFromFBConfig(m_display, configs[i]);
|
||||
|
||||
// We only want FBConfigs with associated X visuals (most have one)
|
||||
// We do this to match what was used during window creation
|
||||
if (!visual)
|
||||
continue;
|
||||
|
||||
// We won't need the visual for glXCreateContextAttribsARB, so get rid of it
|
||||
XFree(visual);
|
||||
|
||||
// Check mandatory attributes
|
||||
int doubleBuffer;
|
||||
glXGetFBConfigAttrib(m_display, configs[i], GLX_DOUBLEBUFFER, &doubleBuffer);
|
||||
if (!doubleBuffer)
|
||||
continue;
|
||||
|
||||
// Extract the components of the current visual
|
||||
int red, green, blue, alpha, depth, stencil, multiSampling, samples;
|
||||
glXGetFBConfigAttrib(m_display, configs[i], GLX_RED_SIZE, &red);
|
||||
glXGetFBConfigAttrib(m_display, configs[i], GLX_GREEN_SIZE, &green);
|
||||
glXGetFBConfigAttrib(m_display, configs[i], GLX_BLUE_SIZE, &blue);
|
||||
glXGetFBConfigAttrib(m_display, configs[i], GLX_ALPHA_SIZE, &alpha);
|
||||
glXGetFBConfigAttrib(m_display, configs[i], GLX_DEPTH_SIZE, &depth);
|
||||
glXGetFBConfigAttrib(m_display, configs[i], GLX_STENCIL_SIZE, &stencil);
|
||||
glXGetFBConfigAttrib(m_display, configs[i], GLX_SAMPLE_BUFFERS_ARB, &multiSampling);
|
||||
glXGetFBConfigAttrib(m_display, configs[i], GLX_SAMPLES_ARB, &samples);
|
||||
|
||||
// Evaluate the visual
|
||||
int color = red + green + blue + alpha;
|
||||
int score = evaluateFormat(bitsPerPixel, settings, color, depth, stencil, multiSampling ? samples : 0);
|
||||
|
||||
// If it's better than the current best, make it the new best
|
||||
if (score < bestScore)
|
||||
{
|
||||
bestScore = score;
|
||||
bestConfig = &configs[i];
|
||||
}
|
||||
bestScore = score;
|
||||
bestConfig = &configs[i];
|
||||
}
|
||||
}
|
||||
|
||||
if (bestScore < 0xFFFF)
|
||||
if (bestScore < 0xFFFF)
|
||||
{
|
||||
while (!m_context && m_settings.majorVersion)
|
||||
{
|
||||
while (!m_context && (m_settings.majorVersion >= 3))
|
||||
// Check if setting the profile is supported
|
||||
if (sfglx_ext_ARB_create_context_profile == sfglx_LOAD_SUCCEEDED)
|
||||
{
|
||||
int profile = (m_settings.attributeFlags & ContextSettings::Core) ? GLX_CONTEXT_CORE_PROFILE_BIT_ARB : GLX_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB;
|
||||
int debug = (m_settings.attributeFlags & ContextSettings::Debug) ? GLX_CONTEXT_DEBUG_BIT_ARB : 0;
|
||||
|
||||
// Create the context
|
||||
int attributes[] =
|
||||
{
|
||||
GLX_CONTEXT_MAJOR_VERSION_ARB, static_cast<int>(m_settings.majorVersion),
|
||||
GLX_CONTEXT_MINOR_VERSION_ARB, static_cast<int>(m_settings.minorVersion),
|
||||
GLX_CONTEXT_PROFILE_MASK_ARB, GLX_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB,
|
||||
0, 0
|
||||
GLX_CONTEXT_PROFILE_MASK_ARB, profile,
|
||||
GLX_CONTEXT_FLAGS_ARB, debug,
|
||||
0, 0
|
||||
};
|
||||
m_context = glXCreateContextAttribsARB(m_display, *bestConfig, toShare, true, attributes);
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((m_settings.attributeFlags & ContextSettings::Core) || (m_settings.attributeFlags & ContextSettings::Debug))
|
||||
err() << "Selecting a profile during context creation is not supported,"
|
||||
<< "disabling comptibility and debug" << std::endl;
|
||||
|
||||
if (m_context)
|
||||
m_settings.attributeFlags = ContextSettings::Default;
|
||||
|
||||
// Create the context
|
||||
int attributes[] =
|
||||
{
|
||||
// Update the creation settings from the chosen format
|
||||
int depth, stencil, multiSampling, samples;
|
||||
glXGetFBConfigAttrib(m_display, *bestConfig, GLX_DEPTH_SIZE, &depth);
|
||||
glXGetFBConfigAttrib(m_display, *bestConfig, GLX_STENCIL_SIZE, &stencil);
|
||||
glXGetFBConfigAttrib(m_display, *bestConfig, GLX_SAMPLE_BUFFERS_ARB, &multiSampling);
|
||||
glXGetFBConfigAttrib(m_display, *bestConfig, GLX_SAMPLES_ARB, &samples);
|
||||
m_settings.depthBits = static_cast<unsigned int>(depth);
|
||||
m_settings.stencilBits = static_cast<unsigned int>(stencil);
|
||||
m_settings.antialiasingLevel = multiSampling ? samples : 0;
|
||||
GLX_CONTEXT_MAJOR_VERSION_ARB, static_cast<int>(m_settings.majorVersion),
|
||||
GLX_CONTEXT_MINOR_VERSION_ARB, static_cast<int>(m_settings.minorVersion),
|
||||
0, 0
|
||||
};
|
||||
m_context = glXCreateContextAttribsARB(m_display, *bestConfig, toShare, true, attributes);
|
||||
}
|
||||
|
||||
if (m_context)
|
||||
{
|
||||
// Update the creation settings from the chosen format
|
||||
int depth, stencil, multiSampling, samples;
|
||||
glXGetFBConfigAttrib(m_display, *bestConfig, GLX_DEPTH_SIZE, &depth);
|
||||
glXGetFBConfigAttrib(m_display, *bestConfig, GLX_STENCIL_SIZE, &stencil);
|
||||
glXGetFBConfigAttrib(m_display, *bestConfig, GLX_SAMPLE_BUFFERS_ARB, &multiSampling);
|
||||
glXGetFBConfigAttrib(m_display, *bestConfig, GLX_SAMPLES_ARB, &samples);
|
||||
m_settings.depthBits = static_cast<unsigned int>(depth);
|
||||
m_settings.stencilBits = static_cast<unsigned int>(stencil);
|
||||
m_settings.antialiasingLevel = multiSampling ? samples : 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
// If we couldn't create the context, first try disabling flags,
|
||||
// then lower the version number and try again -- stop at 0.0
|
||||
// Invalid version numbers will be generated by this algorithm (like 3.9), but we really don't care
|
||||
if (m_settings.attributeFlags != ContextSettings::Default)
|
||||
{
|
||||
m_settings.attributeFlags = ContextSettings::Default;
|
||||
}
|
||||
else if (m_settings.minorVersion > 0)
|
||||
{
|
||||
// If the minor version is not 0, we decrease it and try again
|
||||
m_settings.minorVersion--;
|
||||
|
||||
m_settings.attributeFlags = settings.attributeFlags;
|
||||
}
|
||||
else
|
||||
{
|
||||
// If we couldn't create the context, lower the version number and try again -- stop at 3.0
|
||||
// Invalid version numbers will be generated by this algorithm (like 3.9), but we really don't care
|
||||
if (m_settings.minorVersion > 0)
|
||||
{
|
||||
// If the minor version is not 0, we decrease it and try again
|
||||
m_settings.minorVersion--;
|
||||
}
|
||||
else
|
||||
{
|
||||
// If the minor version is 0, we decrease the major version
|
||||
m_settings.majorVersion--;
|
||||
m_settings.minorVersion = 9;
|
||||
}
|
||||
// If the minor version is 0, we decrease the major version
|
||||
m_settings.majorVersion--;
|
||||
m_settings.minorVersion = 9;
|
||||
|
||||
m_settings.attributeFlags = settings.attributeFlags;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -452,12 +532,13 @@ void GlxContext::createContext(GlxContext* shared, unsigned int bitsPerPixel, co
|
||||
}
|
||||
}
|
||||
|
||||
// If the OpenGL >= 3.0 context failed or if we don't want one, create a regular OpenGL 1.x/2.x context
|
||||
// If glXCreateContextAttribsARB failed, use glXCreateContext
|
||||
if (!m_context)
|
||||
{
|
||||
// set the context version to 2.0 (arbitrary)
|
||||
// set the context version to 2.1 (arbitrary) and disable flags
|
||||
m_settings.majorVersion = 2;
|
||||
m_settings.minorVersion = 0;
|
||||
m_settings.minorVersion = 1;
|
||||
m_settings.attributeFlags = ContextSettings::Default;
|
||||
|
||||
// Retrieve the attributes of the target window
|
||||
XWindowAttributes windowAttributes;
|
||||
@ -486,8 +567,18 @@ void GlxContext::createContext(GlxContext* shared, unsigned int bitsPerPixel, co
|
||||
int depth, stencil, multiSampling, samples;
|
||||
glXGetConfig(m_display, visualInfo, GLX_DEPTH_SIZE, &depth);
|
||||
glXGetConfig(m_display, visualInfo, GLX_STENCIL_SIZE, &stencil);
|
||||
glXGetConfig(m_display, visualInfo, GLX_SAMPLE_BUFFERS_ARB, &multiSampling);
|
||||
glXGetConfig(m_display, visualInfo, GLX_SAMPLES_ARB, &samples);
|
||||
|
||||
if (sfglx_ext_ARB_multisample == sfglx_LOAD_SUCCEEDED)
|
||||
{
|
||||
glXGetConfig(m_display, visualInfo, GLX_SAMPLE_BUFFERS_ARB, &multiSampling);
|
||||
glXGetConfig(m_display, visualInfo, GLX_SAMPLES_ARB, &samples);
|
||||
}
|
||||
else
|
||||
{
|
||||
multiSampling = 0;
|
||||
samples = 0;
|
||||
}
|
||||
|
||||
m_settings.depthBits = static_cast<unsigned int>(depth);
|
||||
m_settings.stencilBits = static_cast<unsigned int>(stencil);
|
||||
m_settings.antialiasingLevel = multiSampling ? samples : 0;
|
||||
|
@ -29,8 +29,8 @@
|
||||
// Headers
|
||||
////////////////////////////////////////////////////////////
|
||||
#include <SFML/Window/GlContext.hpp>
|
||||
#include <SFML/Window/Unix/GlxExtensions.hpp>
|
||||
#include <X11/Xlib-xcb.h>
|
||||
#include <GL/glx.h>
|
||||
|
||||
|
||||
namespace sf
|
||||
|
142
src/SFML/Window/Unix/GlxExtensions.cpp
Normal file
142
src/SFML/Window/Unix/GlxExtensions.cpp
Normal file
@ -0,0 +1,142 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stddef.h>
|
||||
#include <SFML/Window/Unix/GlxExtensions.hpp>
|
||||
|
||||
#include <GL/glx.h>
|
||||
|
||||
#define IntGetProcAddress(name) (*glXGetProcAddressARB)((const GLubyte*)name)
|
||||
|
||||
int sfglx_ext_EXT_swap_control = sfglx_LOAD_FAILED;
|
||||
int sfglx_ext_ARB_multisample = sfglx_LOAD_FAILED;
|
||||
int sfglx_ext_ARB_create_context = sfglx_LOAD_FAILED;
|
||||
int sfglx_ext_ARB_create_context_profile = sfglx_LOAD_FAILED;
|
||||
|
||||
void (CODEGEN_FUNCPTR *sf_ptrc_glXSwapIntervalEXT)(Display *, GLXDrawable, int) = NULL;
|
||||
|
||||
static int Load_EXT_swap_control(void)
|
||||
{
|
||||
int numFailed = 0;
|
||||
sf_ptrc_glXSwapIntervalEXT = (void (CODEGEN_FUNCPTR *)(Display *, GLXDrawable, int))IntGetProcAddress("glXSwapIntervalEXT");
|
||||
if(!sf_ptrc_glXSwapIntervalEXT) numFailed++;
|
||||
return numFailed;
|
||||
}
|
||||
|
||||
GLXContext (CODEGEN_FUNCPTR *sf_ptrc_glXCreateContextAttribsARB)(Display *, GLXFBConfig, GLXContext, Bool, const int *) = NULL;
|
||||
|
||||
static int Load_ARB_create_context(void)
|
||||
{
|
||||
int numFailed = 0;
|
||||
sf_ptrc_glXCreateContextAttribsARB = (GLXContext (CODEGEN_FUNCPTR *)(Display *, GLXFBConfig, GLXContext, Bool, const int *))IntGetProcAddress("glXCreateContextAttribsARB");
|
||||
if(!sf_ptrc_glXCreateContextAttribsARB) numFailed++;
|
||||
return numFailed;
|
||||
}
|
||||
|
||||
typedef int (*PFN_LOADFUNCPOINTERS)(void);
|
||||
typedef struct sfglx_StrToExtMap_s
|
||||
{
|
||||
const char *extensionName;
|
||||
int *extensionVariable;
|
||||
PFN_LOADFUNCPOINTERS LoadExtension;
|
||||
} sfglx_StrToExtMap;
|
||||
|
||||
static sfglx_StrToExtMap ExtensionMap[4] = {
|
||||
{"GLX_EXT_swap_control", &sfglx_ext_EXT_swap_control, Load_EXT_swap_control},
|
||||
{"GLX_ARB_multisample", &sfglx_ext_ARB_multisample, NULL},
|
||||
{"GLX_ARB_create_context", &sfglx_ext_ARB_create_context, Load_ARB_create_context},
|
||||
{"GLX_ARB_create_context_profile", &sfglx_ext_ARB_create_context_profile, NULL},
|
||||
};
|
||||
|
||||
static int g_extensionMapSize = 4;
|
||||
|
||||
static sfglx_StrToExtMap *FindExtEntry(const char *extensionName)
|
||||
{
|
||||
int loop;
|
||||
sfglx_StrToExtMap *currLoc = ExtensionMap;
|
||||
for(loop = 0; loop < g_extensionMapSize; ++loop, ++currLoc)
|
||||
{
|
||||
if(strcmp(extensionName, currLoc->extensionName) == 0)
|
||||
return currLoc;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void ClearExtensionVars(void)
|
||||
{
|
||||
sfglx_ext_EXT_swap_control = sfglx_LOAD_FAILED;
|
||||
sfglx_ext_ARB_multisample = sfglx_LOAD_FAILED;
|
||||
sfglx_ext_ARB_create_context = sfglx_LOAD_FAILED;
|
||||
sfglx_ext_ARB_create_context_profile = sfglx_LOAD_FAILED;
|
||||
}
|
||||
|
||||
|
||||
static void LoadExtByName(const char *extensionName)
|
||||
{
|
||||
sfglx_StrToExtMap *entry = NULL;
|
||||
entry = FindExtEntry(extensionName);
|
||||
if(entry)
|
||||
{
|
||||
if(entry->LoadExtension)
|
||||
{
|
||||
int numFailed = entry->LoadExtension();
|
||||
if(numFailed == 0)
|
||||
{
|
||||
*(entry->extensionVariable) = sfglx_LOAD_SUCCEEDED;
|
||||
}
|
||||
else
|
||||
{
|
||||
*(entry->extensionVariable) = sfglx_LOAD_SUCCEEDED + numFailed;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
*(entry->extensionVariable) = sfglx_LOAD_SUCCEEDED;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void ProcExtsFromExtString(const char *strExtList)
|
||||
{
|
||||
size_t iExtListLen = strlen(strExtList);
|
||||
const char *strExtListEnd = strExtList + iExtListLen;
|
||||
const char *strCurrPos = strExtList;
|
||||
char strWorkBuff[256];
|
||||
|
||||
while(*strCurrPos)
|
||||
{
|
||||
/*Get the extension at our position.*/
|
||||
int iStrLen = 0;
|
||||
const char *strEndStr = strchr(strCurrPos, ' ');
|
||||
int iStop = 0;
|
||||
if(strEndStr == NULL)
|
||||
{
|
||||
strEndStr = strExtListEnd;
|
||||
iStop = 1;
|
||||
}
|
||||
|
||||
iStrLen = (int)((ptrdiff_t)strEndStr - (ptrdiff_t)strCurrPos);
|
||||
|
||||
if(iStrLen > 255)
|
||||
return;
|
||||
|
||||
strncpy(strWorkBuff, strCurrPos, iStrLen);
|
||||
strWorkBuff[iStrLen] = '\0';
|
||||
|
||||
LoadExtByName(strWorkBuff);
|
||||
|
||||
strCurrPos = strEndStr + 1;
|
||||
if(iStop) break;
|
||||
}
|
||||
}
|
||||
|
||||
int sfglx_LoadFunctions(Display *display, int screen)
|
||||
{
|
||||
ClearExtensionVars();
|
||||
|
||||
|
||||
ProcExtsFromExtString((const char *)glXQueryExtensionsString(display, screen));
|
||||
return sfglx_LOAD_SUCCEEDED;
|
||||
}
|
||||
|
168
src/SFML/Window/Unix/GlxExtensions.hpp
Normal file
168
src/SFML/Window/Unix/GlxExtensions.hpp
Normal file
@ -0,0 +1,168 @@
|
||||
#ifndef SF_POINTER_C_GENERATED_HEADER_GLXWIN_HPP
|
||||
#define SF_POINTER_C_GENERATED_HEADER_GLXWIN_HPP
|
||||
|
||||
#ifdef __glxext_h_
|
||||
#error Attempt to include glx_exts after including glxext.h
|
||||
#endif
|
||||
|
||||
#define __glxext_h_
|
||||
|
||||
#include <X11/Xlib.h>
|
||||
#include <X11/Xutil.h>
|
||||
#include <GL/glx.h>
|
||||
#ifdef CODEGEN_FUNCPTR
|
||||
#undef CODEGEN_FUNCPTR
|
||||
#endif /*CODEGEN_FUNCPTR*/
|
||||
#define CODEGEN_FUNCPTR
|
||||
|
||||
#ifndef GL_LOAD_GEN_BASIC_OPENGL_TYPEDEFS
|
||||
#define GL_LOAD_GEN_BASIC_OPENGL_TYPEDEFS
|
||||
|
||||
typedef unsigned int GLenum;
|
||||
typedef unsigned char GLboolean;
|
||||
typedef unsigned int GLbitfield;
|
||||
typedef signed char GLbyte;
|
||||
typedef short GLshort;
|
||||
typedef int GLint;
|
||||
typedef int GLsizei;
|
||||
typedef unsigned char GLubyte;
|
||||
typedef unsigned short GLushort;
|
||||
typedef unsigned int GLuint;
|
||||
typedef float GLfloat;
|
||||
typedef float GLclampf;
|
||||
typedef double GLdouble;
|
||||
typedef double GLclampd;
|
||||
#define GLvoid void
|
||||
|
||||
#endif /*GL_LOAD_GEN_BASIC_OPENGL_TYPEDEFS*/
|
||||
|
||||
|
||||
#ifndef GL_LOAD_GEN_BASIC_OPENGL_TYPEDEFS
|
||||
#define GL_LOAD_GEN_BASIC_OPENGL_TYPEDEFS
|
||||
|
||||
|
||||
#endif /*GL_LOAD_GEN_BASIC_OPENGL_TYPEDEFS*/
|
||||
|
||||
|
||||
#ifndef GLEXT_64_TYPES_DEFINED
|
||||
/* This code block is duplicated in glext.h, so must be protected */
|
||||
#define GLEXT_64_TYPES_DEFINED
|
||||
/* Define int32_t, int64_t, and uint64_t types for UST/MSC */
|
||||
/* (as used in the GLX_OML_sync_control extension). */
|
||||
#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
|
||||
#include <inttypes.h>
|
||||
#elif defined(__sun__) || defined(__digital__)
|
||||
#include <inttypes.h>
|
||||
#if defined(__STDC__)
|
||||
#if defined(__arch64__) || defined(_LP64)
|
||||
typedef long int int64_t;
|
||||
typedef unsigned long int uint64_t;
|
||||
#else
|
||||
typedef long long int int64_t;
|
||||
typedef unsigned long long int uint64_t;
|
||||
#endif /* __arch64__ */
|
||||
#endif /* __STDC__ */
|
||||
#elif defined( __VMS ) || defined(__sgi)
|
||||
#include <inttypes.h>
|
||||
#elif defined(__SCO__) || defined(__USLC__)
|
||||
#include <stdint.h>
|
||||
#elif defined(__UNIXOS2__) || defined(__SOL64__)
|
||||
typedef long int int32_t;
|
||||
typedef long long int int64_t;
|
||||
typedef unsigned long long int uint64_t;
|
||||
#elif defined(_WIN32) && defined(__GNUC__)
|
||||
#include <stdint.h>
|
||||
#elif defined(_WIN32)
|
||||
typedef __int32 int32_t;
|
||||
typedef __int64 int64_t;
|
||||
typedef unsigned __int64 uint64_t;
|
||||
#else
|
||||
/* Fallback if nothing above works */
|
||||
#include <inttypes.h>
|
||||
#endif
|
||||
#endif
|
||||
typedef struct __GLXFBConfigRec *GLXFBConfig;
|
||||
typedef XID GLXContextID;
|
||||
typedef struct __GLXcontextRec *GLXContext;
|
||||
typedef XID GLXPixmap;
|
||||
typedef XID GLXDrawable;
|
||||
typedef XID GLXPbuffer;
|
||||
typedef void (APIENTRY *__GLXextFuncPtr)(void);
|
||||
typedef XID GLXVideoCaptureDeviceNV;
|
||||
typedef unsigned int GLXVideoDeviceNV;
|
||||
typedef XID GLXVideoSourceSGIX;
|
||||
typedef struct __GLXFBConfigRec *GLXFBConfigSGIX;
|
||||
typedef XID GLXPbufferSGIX;
|
||||
typedef struct {
|
||||
char pipeName[80]; /* Should be [GLX_HYPERPIPE_PIPE_NAME_LENGTH_SGIX] */
|
||||
int networkId;
|
||||
} GLXHyperpipeNetworkSGIX;
|
||||
typedef struct {
|
||||
char pipeName[80]; /* Should be [GLX_HYPERPIPE_PIPE_NAME_LENGTH_SGIX] */
|
||||
int channel;
|
||||
unsigned int participationType;
|
||||
int timeSlice;
|
||||
} GLXHyperpipeConfigSGIX;
|
||||
typedef struct {
|
||||
char pipeName[80]; /* Should be [GLX_HYPERPIPE_PIPE_NAME_LENGTH_SGIX] */
|
||||
int srcXOrigin, srcYOrigin, srcWidth, srcHeight;
|
||||
int destXOrigin, destYOrigin, destWidth, destHeight;
|
||||
} GLXPipeRect;
|
||||
typedef struct {
|
||||
char pipeName[80]; /* Should be [GLX_HYPERPIPE_PIPE_NAME_LENGTH_SGIX] */
|
||||
int XOrigin, YOrigin, maxHeight, maxWidth;
|
||||
} GLXPipeRectLimits;
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /*__cplusplus*/
|
||||
|
||||
extern int sfglx_ext_EXT_swap_control;
|
||||
extern int sfglx_ext_ARB_multisample;
|
||||
extern int sfglx_ext_ARB_create_context;
|
||||
extern int sfglx_ext_ARB_create_context_profile;
|
||||
|
||||
#define GLX_MAX_SWAP_INTERVAL_EXT 0x20F2
|
||||
#define GLX_SWAP_INTERVAL_EXT 0x20F1
|
||||
|
||||
#define GLX_SAMPLES_ARB 100001
|
||||
#define GLX_SAMPLE_BUFFERS_ARB 100000
|
||||
|
||||
#define GLX_CONTEXT_DEBUG_BIT_ARB 0x00000001
|
||||
#define GLX_CONTEXT_FLAGS_ARB 0x2094
|
||||
#define GLX_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB 0x00000002
|
||||
#define GLX_CONTEXT_MAJOR_VERSION_ARB 0x2091
|
||||
#define GLX_CONTEXT_MINOR_VERSION_ARB 0x2092
|
||||
|
||||
#define GLX_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB 0x00000002
|
||||
#define GLX_CONTEXT_CORE_PROFILE_BIT_ARB 0x00000001
|
||||
#define GLX_CONTEXT_PROFILE_MASK_ARB 0x9126
|
||||
|
||||
#ifndef GLX_EXT_swap_control
|
||||
#define GLX_EXT_swap_control 1
|
||||
extern void (CODEGEN_FUNCPTR *sf_ptrc_glXSwapIntervalEXT)(Display *, GLXDrawable, int);
|
||||
#define glXSwapIntervalEXT sf_ptrc_glXSwapIntervalEXT
|
||||
#endif /*GLX_EXT_swap_control*/
|
||||
|
||||
|
||||
#ifndef GLX_ARB_create_context
|
||||
#define GLX_ARB_create_context 1
|
||||
extern GLXContext (CODEGEN_FUNCPTR *sf_ptrc_glXCreateContextAttribsARB)(Display *, GLXFBConfig, GLXContext, Bool, const int *);
|
||||
#define glXCreateContextAttribsARB sf_ptrc_glXCreateContextAttribsARB
|
||||
#endif /*GLX_ARB_create_context*/
|
||||
|
||||
|
||||
enum sfglx_LoadStatus
|
||||
{
|
||||
sfglx_LOAD_FAILED = 0,
|
||||
sfglx_LOAD_SUCCEEDED = 1
|
||||
};
|
||||
|
||||
int sfglx_LoadFunctions(Display *display, int screen);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /*__cplusplus*/
|
||||
|
||||
#endif /* SF_POINTER_C_GENERATED_HEADER_GLXWIN_HPP */
|
9
src/SFML/Window/Unix/GlxExtensions.txt
Normal file
9
src/SFML/Window/Unix/GlxExtensions.txt
Normal file
@ -0,0 +1,9 @@
|
||||
// Created with:
|
||||
// https://bitbucket.org/Anteru/glloadgen-reloaded
|
||||
// Commit 20f19482b7a844d20b9785c3e3fd1f16419f6e0a
|
||||
// lua LoadGen.lua -style=pointer_c -spec=glX -indent=space -prefix=sf -extfile=GlxExtensions.txt GlxExtensions
|
||||
|
||||
EXT_swap_control
|
||||
GLX_ARB_multisample
|
||||
GLX_ARB_create_context
|
||||
GLX_ARB_create_context_profile
|
@ -27,16 +27,49 @@
|
||||
////////////////////////////////////////////////////////////
|
||||
#include <SFML/Window/WindowImpl.hpp> // included first to avoid a warning about macro redefinition
|
||||
#include <SFML/Window/Win32/WglContext.hpp>
|
||||
#include <SFML/Window/glext/wglext.h>
|
||||
#include <SFML/Window/Win32/WglExtensions.hpp>
|
||||
#include <SFML/System/Lock.hpp>
|
||||
#include <SFML/System/Mutex.hpp>
|
||||
#include <SFML/System/Err.hpp>
|
||||
#include <sstream>
|
||||
|
||||
|
||||
namespace sf
|
||||
{
|
||||
namespace priv
|
||||
{
|
||||
////////////////////////////////////////////////////////////
|
||||
void ensureExtensionsInit(HDC deviceContext)
|
||||
{
|
||||
static bool initialized = false;
|
||||
if (!initialized)
|
||||
{
|
||||
int loaded = sfwgl_LoadFunctions(deviceContext);
|
||||
if (loaded == sfwgl_LOAD_FAILED)
|
||||
{
|
||||
err() << "Failed to initialize WglExtensions" << std::endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
initialized = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
String getErrorString(DWORD errorCode)
|
||||
{
|
||||
std::basic_ostringstream<TCHAR, std::char_traits<TCHAR> > ss;
|
||||
TCHAR errBuff[256];
|
||||
FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, NULL, errorCode, 0, errBuff, sizeof(errBuff), NULL);
|
||||
ss << errBuff;
|
||||
String errMsg(ss.str());
|
||||
|
||||
return errMsg;
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
WglContext::WglContext(WglContext* shared) :
|
||||
m_window (NULL),
|
||||
@ -138,9 +171,16 @@ void WglContext::display()
|
||||
////////////////////////////////////////////////////////////
|
||||
void WglContext::setVerticalSyncEnabled(bool enabled)
|
||||
{
|
||||
PFNWGLSWAPINTERVALEXTPROC wglSwapIntervalEXT = reinterpret_cast<PFNWGLSWAPINTERVALEXTPROC>(wglGetProcAddress("wglSwapIntervalEXT"));
|
||||
if (wglSwapIntervalEXT)
|
||||
// Make sure that extensions are initialized
|
||||
ensureExtensionsInit(m_deviceContext);
|
||||
|
||||
if (sfwgl_ext_EXT_swap_control == sfwgl_LOAD_SUCCEEDED)
|
||||
wglSwapIntervalEXT(enabled ? 1 : 0);
|
||||
else
|
||||
{
|
||||
// wglSwapIntervalEXT not supported
|
||||
err() << "Setting vertical sync not supported" << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -150,13 +190,16 @@ void WglContext::createContext(WglContext* shared, unsigned int bitsPerPixel, co
|
||||
// Save the creation settings
|
||||
m_settings = settings;
|
||||
|
||||
// Make sure that extensions are initialized if this is not the shared context
|
||||
// The shared context is the context used to initialize the extensions
|
||||
if (shared)
|
||||
ensureExtensionsInit(m_deviceContext);
|
||||
|
||||
// Let's find a suitable pixel format -- first try with antialiasing
|
||||
int bestFormat = 0;
|
||||
if (m_settings.antialiasingLevel > 0)
|
||||
{
|
||||
// Get the wglChoosePixelFormatARB function (it is an extension)
|
||||
PFNWGLCHOOSEPIXELFORMATARBPROC wglChoosePixelFormatARB = reinterpret_cast<PFNWGLCHOOSEPIXELFORMATARBPROC>(wglGetProcAddress("wglChoosePixelFormatARB"));
|
||||
if (wglChoosePixelFormatARB)
|
||||
if ((sfwgl_ext_ARB_pixel_format == sfwgl_LOAD_SUCCEEDED) && (sfwgl_ext_ARB_multisample == sfwgl_LOAD_SUCCEEDED))
|
||||
{
|
||||
// Define the basic attributes we want for our window
|
||||
int intAttributes[] =
|
||||
@ -165,7 +208,7 @@ void WglContext::createContext(WglContext* shared, unsigned int bitsPerPixel, co
|
||||
WGL_SUPPORT_OPENGL_ARB, GL_TRUE,
|
||||
WGL_ACCELERATION_ARB, WGL_FULL_ACCELERATION_ARB,
|
||||
WGL_DOUBLE_BUFFER_ARB, GL_TRUE,
|
||||
WGL_SAMPLE_BUFFERS_ARB, (m_settings.antialiasingLevel ? GL_TRUE : GL_FALSE),
|
||||
WGL_SAMPLE_BUFFERS_ARB, (m_settings.antialiasingLevel ? 1 : 0),
|
||||
WGL_SAMPLES_ARB, static_cast<int>(m_settings.antialiasingLevel),
|
||||
0, 0
|
||||
};
|
||||
@ -236,7 +279,8 @@ void WglContext::createContext(WglContext* shared, unsigned int bitsPerPixel, co
|
||||
bestFormat = ChoosePixelFormat(m_deviceContext, &descriptor);
|
||||
if (bestFormat == 0)
|
||||
{
|
||||
err() << "Failed to find a suitable pixel format for device context -- cannot create OpenGL context" << std::endl;
|
||||
err() << "Failed to find a suitable pixel format for device context: " << getErrorString(GetLastError()).toAnsiString() << std::endl
|
||||
<< "Cannot create OpenGL context" << std::endl;
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -252,58 +296,97 @@ void WglContext::createContext(WglContext* shared, unsigned int bitsPerPixel, co
|
||||
// Set the chosen pixel format
|
||||
if (!SetPixelFormat(m_deviceContext, bestFormat, &actualFormat))
|
||||
{
|
||||
err() << "Failed to set pixel format for device context -- cannot create OpenGL context" << std::endl;
|
||||
err() << "Failed to set pixel format for device context: " << getErrorString(GetLastError()).toAnsiString() << std::endl
|
||||
<< "Cannot create OpenGL context" << std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
// Get the context to share display lists with
|
||||
HGLRC sharedContext = shared ? shared->m_context : NULL;
|
||||
|
||||
// Create the OpenGL context -- first try context versions >= 3.0 if it is requested (they require special code)
|
||||
while (!m_context && (m_settings.majorVersion >= 3))
|
||||
// Create the OpenGL context -- first try using wglCreateContextAttribsARB
|
||||
while (!m_context && m_settings.majorVersion)
|
||||
{
|
||||
PFNWGLCREATECONTEXTATTRIBSARBPROC wglCreateContextAttribsARB = reinterpret_cast<PFNWGLCREATECONTEXTATTRIBSARBPROC>(wglGetProcAddress("wglCreateContextAttribsARB"));
|
||||
if (wglCreateContextAttribsARB)
|
||||
if (sfwgl_ext_ARB_create_context == sfwgl_LOAD_SUCCEEDED)
|
||||
{
|
||||
int attributes[] =
|
||||
// Check if setting the profile is supported
|
||||
if (sfwgl_ext_ARB_create_context_profile == sfwgl_LOAD_SUCCEEDED)
|
||||
{
|
||||
WGL_CONTEXT_MAJOR_VERSION_ARB, static_cast<int>(m_settings.majorVersion),
|
||||
WGL_CONTEXT_MINOR_VERSION_ARB, static_cast<int>(m_settings.minorVersion),
|
||||
WGL_CONTEXT_PROFILE_MASK_ARB, WGL_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB,
|
||||
0, 0
|
||||
};
|
||||
m_context = wglCreateContextAttribsARB(m_deviceContext, sharedContext, attributes);
|
||||
int profile = (m_settings.attributeFlags & ContextSettings::Core) ? WGL_CONTEXT_CORE_PROFILE_BIT_ARB : WGL_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB;
|
||||
int debug = (m_settings.attributeFlags & ContextSettings::Debug) ? WGL_CONTEXT_DEBUG_BIT_ARB : 0;
|
||||
|
||||
int attributes[] =
|
||||
{
|
||||
WGL_CONTEXT_MAJOR_VERSION_ARB, static_cast<int>(m_settings.majorVersion),
|
||||
WGL_CONTEXT_MINOR_VERSION_ARB, static_cast<int>(m_settings.minorVersion),
|
||||
WGL_CONTEXT_PROFILE_MASK_ARB, profile,
|
||||
WGL_CONTEXT_FLAGS_ARB, debug,
|
||||
0, 0
|
||||
};
|
||||
m_context = wglCreateContextAttribsARB(m_deviceContext, sharedContext, attributes);
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((m_settings.attributeFlags & ContextSettings::Core) || (m_settings.attributeFlags & ContextSettings::Debug))
|
||||
err() << "Selecting a profile during context creation is not supported,"
|
||||
<< "disabling comptibility and debug" << std::endl;
|
||||
|
||||
m_settings.attributeFlags = ContextSettings::Default;
|
||||
|
||||
int attributes[] =
|
||||
{
|
||||
WGL_CONTEXT_MAJOR_VERSION_ARB, static_cast<int>(m_settings.majorVersion),
|
||||
WGL_CONTEXT_MINOR_VERSION_ARB, static_cast<int>(m_settings.minorVersion),
|
||||
0, 0
|
||||
};
|
||||
m_context = wglCreateContextAttribsARB(m_deviceContext, sharedContext, attributes);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// If wglCreateContextAttribsARB is not supported, there is no need to keep trying
|
||||
break;
|
||||
}
|
||||
|
||||
// If we couldn't create the context, lower the version number and try again -- stop at 3.0
|
||||
// If we couldn't create the context, first try disabling flags,
|
||||
// then lower the version number and try again -- stop at 0.0
|
||||
// Invalid version numbers will be generated by this algorithm (like 3.9), but we really don't care
|
||||
if (!m_context)
|
||||
{
|
||||
if (m_settings.minorVersion > 0)
|
||||
if (m_settings.attributeFlags != ContextSettings::Default)
|
||||
{
|
||||
m_settings.attributeFlags = ContextSettings::Default;
|
||||
}
|
||||
else if (m_settings.minorVersion > 0)
|
||||
{
|
||||
// If the minor version is not 0, we decrease it and try again
|
||||
m_settings.minorVersion--;
|
||||
|
||||
m_settings.attributeFlags = settings.attributeFlags;
|
||||
}
|
||||
else
|
||||
{
|
||||
// If the minor version is 0, we decrease the major version
|
||||
m_settings.majorVersion--;
|
||||
m_settings.minorVersion = 9;
|
||||
|
||||
m_settings.attributeFlags = settings.attributeFlags;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// If the OpenGL >= 3.0 context failed or if we don't want one, create a regular OpenGL 1.x/2.x context
|
||||
// If wglCreateContextAttribsARB failed, use wglCreateContext
|
||||
if (!m_context)
|
||||
{
|
||||
// set the context version to 2.0 (arbitrary)
|
||||
// set the context version to 2.1 (arbitrary) and disable flags
|
||||
m_settings.majorVersion = 2;
|
||||
m_settings.minorVersion = 0;
|
||||
m_settings.minorVersion = 1;
|
||||
m_settings.attributeFlags = ContextSettings::Default;
|
||||
|
||||
m_context = wglCreateContext(m_deviceContext);
|
||||
if (!m_context)
|
||||
{
|
||||
err() << "Failed to create an OpenGL context for this window" << std::endl;
|
||||
err() << "Failed to create an OpenGL context for this window: " << getErrorString(GetLastError()).toAnsiString() << std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
@ -315,7 +398,7 @@ void WglContext::createContext(WglContext* shared, unsigned int bitsPerPixel, co
|
||||
Lock lock(mutex);
|
||||
|
||||
if (!wglShareLists(sharedContext, m_context))
|
||||
err() << "Failed to share the OpenGL context" << std::endl;
|
||||
err() << "Failed to share the OpenGL context: " << getErrorString(GetLastError()).toAnsiString() << std::endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
186
src/SFML/Window/Win32/WglExtensions.cpp
Normal file
186
src/SFML/Window/Win32/WglExtensions.cpp
Normal file
@ -0,0 +1,186 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stddef.h>
|
||||
#include <SFML/Window/Win32/WglExtensions.hpp>
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(disable: 4055)
|
||||
#pragma warning(disable: 4054)
|
||||
#pragma warning(disable: 4996)
|
||||
#endif
|
||||
|
||||
static PROC WinGetProcAddress(const char *name)
|
||||
{
|
||||
static HMODULE glMod = NULL;
|
||||
PROC pFunc = wglGetProcAddress((LPCSTR)name);
|
||||
|
||||
if (pFunc) return pFunc;
|
||||
|
||||
if (NULL == glMod)
|
||||
glMod = GetModuleHandleA("OpenGL32.dll");
|
||||
|
||||
return (PROC)GetProcAddress(glMod, (LPCSTR)name);
|
||||
}
|
||||
|
||||
#define IntGetProcAddress(name) WinGetProcAddress(name)
|
||||
|
||||
int sfwgl_ext_EXT_swap_control = sfwgl_LOAD_FAILED;
|
||||
int sfwgl_ext_ARB_multisample = sfwgl_LOAD_FAILED;
|
||||
int sfwgl_ext_ARB_pixel_format = sfwgl_LOAD_FAILED;
|
||||
int sfwgl_ext_ARB_create_context = sfwgl_LOAD_FAILED;
|
||||
int sfwgl_ext_ARB_create_context_profile = sfwgl_LOAD_FAILED;
|
||||
|
||||
int (CODEGEN_FUNCPTR *sf_ptrc_wglGetSwapIntervalEXT)(void) = NULL;
|
||||
BOOL (CODEGEN_FUNCPTR *sf_ptrc_wglSwapIntervalEXT)(int) = NULL;
|
||||
|
||||
static int Load_EXT_swap_control(void)
|
||||
{
|
||||
int numFailed = 0;
|
||||
sf_ptrc_wglGetSwapIntervalEXT = (int (CODEGEN_FUNCPTR *)(void))IntGetProcAddress("wglGetSwapIntervalEXT");
|
||||
if(!sf_ptrc_wglGetSwapIntervalEXT) numFailed++;
|
||||
sf_ptrc_wglSwapIntervalEXT = (BOOL (CODEGEN_FUNCPTR *)(int))IntGetProcAddress("wglSwapIntervalEXT");
|
||||
if(!sf_ptrc_wglSwapIntervalEXT) numFailed++;
|
||||
return numFailed;
|
||||
}
|
||||
|
||||
BOOL (CODEGEN_FUNCPTR *sf_ptrc_wglChoosePixelFormatARB)(HDC, const int *, const FLOAT *, UINT, int *, UINT *) = NULL;
|
||||
BOOL (CODEGEN_FUNCPTR *sf_ptrc_wglGetPixelFormatAttribfvARB)(HDC, int, int, UINT, const int *, FLOAT *) = NULL;
|
||||
BOOL (CODEGEN_FUNCPTR *sf_ptrc_wglGetPixelFormatAttribivARB)(HDC, int, int, UINT, const int *, int *) = NULL;
|
||||
|
||||
static int Load_ARB_pixel_format(void)
|
||||
{
|
||||
int numFailed = 0;
|
||||
sf_ptrc_wglChoosePixelFormatARB = (BOOL (CODEGEN_FUNCPTR *)(HDC, const int *, const FLOAT *, UINT, int *, UINT *))IntGetProcAddress("wglChoosePixelFormatARB");
|
||||
if(!sf_ptrc_wglChoosePixelFormatARB) numFailed++;
|
||||
sf_ptrc_wglGetPixelFormatAttribfvARB = (BOOL (CODEGEN_FUNCPTR *)(HDC, int, int, UINT, const int *, FLOAT *))IntGetProcAddress("wglGetPixelFormatAttribfvARB");
|
||||
if(!sf_ptrc_wglGetPixelFormatAttribfvARB) numFailed++;
|
||||
sf_ptrc_wglGetPixelFormatAttribivARB = (BOOL (CODEGEN_FUNCPTR *)(HDC, int, int, UINT, const int *, int *))IntGetProcAddress("wglGetPixelFormatAttribivARB");
|
||||
if(!sf_ptrc_wglGetPixelFormatAttribivARB) numFailed++;
|
||||
return numFailed;
|
||||
}
|
||||
|
||||
HGLRC (CODEGEN_FUNCPTR *sf_ptrc_wglCreateContextAttribsARB)(HDC, HGLRC, const int *) = NULL;
|
||||
|
||||
static int Load_ARB_create_context(void)
|
||||
{
|
||||
int numFailed = 0;
|
||||
sf_ptrc_wglCreateContextAttribsARB = (HGLRC (CODEGEN_FUNCPTR *)(HDC, HGLRC, const int *))IntGetProcAddress("wglCreateContextAttribsARB");
|
||||
if(!sf_ptrc_wglCreateContextAttribsARB) numFailed++;
|
||||
return numFailed;
|
||||
}
|
||||
|
||||
|
||||
static const char * (CODEGEN_FUNCPTR *sf_ptrc_wglGetExtensionsStringARB)(HDC) = NULL;
|
||||
|
||||
typedef int (*PFN_LOADFUNCPOINTERS)(void);
|
||||
typedef struct sfwgl_StrToExtMap_s
|
||||
{
|
||||
const char *extensionName;
|
||||
int *extensionVariable;
|
||||
PFN_LOADFUNCPOINTERS LoadExtension;
|
||||
} sfwgl_StrToExtMap;
|
||||
|
||||
static sfwgl_StrToExtMap ExtensionMap[5] = {
|
||||
{"WGL_EXT_swap_control", &sfwgl_ext_EXT_swap_control, Load_EXT_swap_control},
|
||||
{"WGL_ARB_multisample", &sfwgl_ext_ARB_multisample, NULL},
|
||||
{"WGL_ARB_pixel_format", &sfwgl_ext_ARB_pixel_format, Load_ARB_pixel_format},
|
||||
{"WGL_ARB_create_context", &sfwgl_ext_ARB_create_context, Load_ARB_create_context},
|
||||
{"WGL_ARB_create_context_profile", &sfwgl_ext_ARB_create_context_profile, NULL},
|
||||
};
|
||||
|
||||
static int g_extensionMapSize = 5;
|
||||
|
||||
static sfwgl_StrToExtMap *FindExtEntry(const char *extensionName)
|
||||
{
|
||||
int loop;
|
||||
sfwgl_StrToExtMap *currLoc = ExtensionMap;
|
||||
for(loop = 0; loop < g_extensionMapSize; ++loop, ++currLoc)
|
||||
{
|
||||
if(strcmp(extensionName, currLoc->extensionName) == 0)
|
||||
return currLoc;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void ClearExtensionVars(void)
|
||||
{
|
||||
sfwgl_ext_EXT_swap_control = sfwgl_LOAD_FAILED;
|
||||
sfwgl_ext_ARB_multisample = sfwgl_LOAD_FAILED;
|
||||
sfwgl_ext_ARB_pixel_format = sfwgl_LOAD_FAILED;
|
||||
sfwgl_ext_ARB_create_context = sfwgl_LOAD_FAILED;
|
||||
sfwgl_ext_ARB_create_context_profile = sfwgl_LOAD_FAILED;
|
||||
}
|
||||
|
||||
|
||||
static void LoadExtByName(const char *extensionName)
|
||||
{
|
||||
sfwgl_StrToExtMap *entry = NULL;
|
||||
entry = FindExtEntry(extensionName);
|
||||
if(entry)
|
||||
{
|
||||
if(entry->LoadExtension)
|
||||
{
|
||||
int numFailed = entry->LoadExtension();
|
||||
if(numFailed == 0)
|
||||
{
|
||||
*(entry->extensionVariable) = sfwgl_LOAD_SUCCEEDED;
|
||||
}
|
||||
else
|
||||
{
|
||||
*(entry->extensionVariable) = sfwgl_LOAD_SUCCEEDED + numFailed;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
*(entry->extensionVariable) = sfwgl_LOAD_SUCCEEDED;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void ProcExtsFromExtString(const char *strExtList)
|
||||
{
|
||||
size_t iExtListLen = strlen(strExtList);
|
||||
const char *strExtListEnd = strExtList + iExtListLen;
|
||||
const char *strCurrPos = strExtList;
|
||||
char strWorkBuff[256];
|
||||
|
||||
while(*strCurrPos)
|
||||
{
|
||||
/*Get the extension at our position.*/
|
||||
int iStrLen = 0;
|
||||
const char *strEndStr = strchr(strCurrPos, ' ');
|
||||
int iStop = 0;
|
||||
if(strEndStr == NULL)
|
||||
{
|
||||
strEndStr = strExtListEnd;
|
||||
iStop = 1;
|
||||
}
|
||||
|
||||
iStrLen = (int)((ptrdiff_t)strEndStr - (ptrdiff_t)strCurrPos);
|
||||
|
||||
if(iStrLen > 255)
|
||||
return;
|
||||
|
||||
strncpy(strWorkBuff, strCurrPos, iStrLen);
|
||||
strWorkBuff[iStrLen] = '\0';
|
||||
|
||||
LoadExtByName(strWorkBuff);
|
||||
|
||||
strCurrPos = strEndStr + 1;
|
||||
if(iStop) break;
|
||||
}
|
||||
}
|
||||
|
||||
int sfwgl_LoadFunctions(HDC hdc)
|
||||
{
|
||||
ClearExtensionVars();
|
||||
|
||||
sf_ptrc_wglGetExtensionsStringARB = (const char * (CODEGEN_FUNCPTR *)(HDC))IntGetProcAddress("wglGetExtensionsStringARB");
|
||||
if(!sf_ptrc_wglGetExtensionsStringARB) return sfwgl_LOAD_FAILED;
|
||||
|
||||
ProcExtsFromExtString((const char *)sf_ptrc_wglGetExtensionsStringARB(hdc));
|
||||
return sfwgl_LOAD_SUCCEEDED;
|
||||
}
|
||||
|
182
src/SFML/Window/Win32/WglExtensions.hpp
Normal file
182
src/SFML/Window/Win32/WglExtensions.hpp
Normal file
@ -0,0 +1,182 @@
|
||||
#ifndef SF_POINTER_C_GENERATED_HEADER_WINDOWSGL_HPP
|
||||
#define SF_POINTER_C_GENERATED_HEADER_WINDOWSGL_HPP
|
||||
|
||||
#ifdef __wglext_h_
|
||||
#error Attempt to include auto-generated WGL header after wglext.h
|
||||
#endif
|
||||
|
||||
#define __wglext_h_
|
||||
|
||||
#ifndef WIN32_LEAN_AND_MEAN
|
||||
#define WIN32_LEAN_AND_MEAN 1
|
||||
#endif
|
||||
#ifndef NOMINMAX
|
||||
#define NOMINMAX
|
||||
#endif
|
||||
#include <windows.h>
|
||||
|
||||
#ifdef CODEGEN_FUNCPTR
|
||||
#undef CODEGEN_FUNCPTR
|
||||
#endif /*CODEGEN_FUNCPTR*/
|
||||
#define CODEGEN_FUNCPTR WINAPI
|
||||
|
||||
#ifndef GL_LOAD_GEN_BASIC_OPENGL_TYPEDEFS
|
||||
#define GL_LOAD_GEN_BASIC_OPENGL_TYPEDEFS
|
||||
|
||||
typedef unsigned int GLenum;
|
||||
typedef unsigned char GLboolean;
|
||||
typedef unsigned int GLbitfield;
|
||||
typedef signed char GLbyte;
|
||||
typedef short GLshort;
|
||||
typedef int GLint;
|
||||
typedef int GLsizei;
|
||||
typedef unsigned char GLubyte;
|
||||
typedef unsigned short GLushort;
|
||||
typedef unsigned int GLuint;
|
||||
typedef float GLfloat;
|
||||
typedef float GLclampf;
|
||||
typedef double GLdouble;
|
||||
typedef double GLclampd;
|
||||
#define GLvoid void
|
||||
|
||||
#endif /*GL_LOAD_GEN_BASIC_OPENGL_TYPEDEFS*/
|
||||
|
||||
|
||||
#ifndef GL_LOAD_GEN_BASIC_OPENGL_TYPEDEFS
|
||||
#define GL_LOAD_GEN_BASIC_OPENGL_TYPEDEFS
|
||||
|
||||
|
||||
#endif /*GL_LOAD_GEN_BASIC_OPENGL_TYPEDEFS*/
|
||||
|
||||
|
||||
struct _GPU_DEVICE {
|
||||
DWORD cb;
|
||||
CHAR DeviceName[32];
|
||||
CHAR DeviceString[128];
|
||||
DWORD Flags;
|
||||
RECT rcVirtualScreen;
|
||||
};
|
||||
DECLARE_HANDLE(HPBUFFERARB);
|
||||
DECLARE_HANDLE(HPBUFFEREXT);
|
||||
DECLARE_HANDLE(HVIDEOOUTPUTDEVICENV);
|
||||
DECLARE_HANDLE(HPVIDEODEV);
|
||||
DECLARE_HANDLE(HGPUNV);
|
||||
DECLARE_HANDLE(HVIDEOINPUTDEVICENV);
|
||||
typedef struct _GPU_DEVICE *PGPU_DEVICE;
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /*__cplusplus*/
|
||||
|
||||
extern int sfwgl_ext_EXT_swap_control;
|
||||
extern int sfwgl_ext_ARB_multisample;
|
||||
extern int sfwgl_ext_ARB_pixel_format;
|
||||
extern int sfwgl_ext_ARB_create_context;
|
||||
extern int sfwgl_ext_ARB_create_context_profile;
|
||||
|
||||
#define WGL_SAMPLES_ARB 0x2042
|
||||
#define WGL_SAMPLE_BUFFERS_ARB 0x2041
|
||||
|
||||
#define WGL_ACCELERATION_ARB 0x2003
|
||||
#define WGL_ACCUM_ALPHA_BITS_ARB 0x2021
|
||||
#define WGL_ACCUM_BITS_ARB 0x201D
|
||||
#define WGL_ACCUM_BLUE_BITS_ARB 0x2020
|
||||
#define WGL_ACCUM_GREEN_BITS_ARB 0x201F
|
||||
#define WGL_ACCUM_RED_BITS_ARB 0x201E
|
||||
#define WGL_ALPHA_BITS_ARB 0x201B
|
||||
#define WGL_ALPHA_SHIFT_ARB 0x201C
|
||||
#define WGL_AUX_BUFFERS_ARB 0x2024
|
||||
#define WGL_BLUE_BITS_ARB 0x2019
|
||||
#define WGL_BLUE_SHIFT_ARB 0x201A
|
||||
#define WGL_COLOR_BITS_ARB 0x2014
|
||||
#define WGL_DEPTH_BITS_ARB 0x2022
|
||||
#define WGL_DOUBLE_BUFFER_ARB 0x2011
|
||||
#define WGL_DRAW_TO_BITMAP_ARB 0x2002
|
||||
#define WGL_DRAW_TO_WINDOW_ARB 0x2001
|
||||
#define WGL_FULL_ACCELERATION_ARB 0x2027
|
||||
#define WGL_GENERIC_ACCELERATION_ARB 0x2026
|
||||
#define WGL_GREEN_BITS_ARB 0x2017
|
||||
#define WGL_GREEN_SHIFT_ARB 0x2018
|
||||
#define WGL_NEED_PALETTE_ARB 0x2004
|
||||
#define WGL_NEED_SYSTEM_PALETTE_ARB 0x2005
|
||||
#define WGL_NO_ACCELERATION_ARB 0x2025
|
||||
#define WGL_NUMBER_OVERLAYS_ARB 0x2008
|
||||
#define WGL_NUMBER_PIXEL_FORMATS_ARB 0x2000
|
||||
#define WGL_NUMBER_UNDERLAYS_ARB 0x2009
|
||||
#define WGL_PIXEL_TYPE_ARB 0x2013
|
||||
#define WGL_RED_BITS_ARB 0x2015
|
||||
#define WGL_RED_SHIFT_ARB 0x2016
|
||||
#define WGL_SHARE_ACCUM_ARB 0x200E
|
||||
#define WGL_SHARE_DEPTH_ARB 0x200C
|
||||
#define WGL_SHARE_STENCIL_ARB 0x200D
|
||||
#define WGL_STENCIL_BITS_ARB 0x2023
|
||||
#define WGL_STEREO_ARB 0x2012
|
||||
#define WGL_SUPPORT_GDI_ARB 0x200F
|
||||
#define WGL_SUPPORT_OPENGL_ARB 0x2010
|
||||
#define WGL_SWAP_COPY_ARB 0x2029
|
||||
#define WGL_SWAP_EXCHANGE_ARB 0x2028
|
||||
#define WGL_SWAP_LAYER_BUFFERS_ARB 0x2006
|
||||
#define WGL_SWAP_METHOD_ARB 0x2007
|
||||
#define WGL_SWAP_UNDEFINED_ARB 0x202A
|
||||
#define WGL_TRANSPARENT_ALPHA_VALUE_ARB 0x203A
|
||||
#define WGL_TRANSPARENT_ARB 0x200A
|
||||
#define WGL_TRANSPARENT_BLUE_VALUE_ARB 0x2039
|
||||
#define WGL_TRANSPARENT_GREEN_VALUE_ARB 0x2038
|
||||
#define WGL_TRANSPARENT_INDEX_VALUE_ARB 0x203B
|
||||
#define WGL_TRANSPARENT_RED_VALUE_ARB 0x2037
|
||||
#define WGL_TYPE_COLORINDEX_ARB 0x202C
|
||||
#define WGL_TYPE_RGBA_ARB 0x202B
|
||||
|
||||
#define WGL_CONTEXT_DEBUG_BIT_ARB 0x00000001
|
||||
#define WGL_CONTEXT_FLAGS_ARB 0x2094
|
||||
#define WGL_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB 0x00000002
|
||||
#define WGL_CONTEXT_LAYER_PLANE_ARB 0x2093
|
||||
#define WGL_CONTEXT_MAJOR_VERSION_ARB 0x2091
|
||||
#define WGL_CONTEXT_MINOR_VERSION_ARB 0x2092
|
||||
#define WGL_ERROR_INVALID_VERSION_ARB 0x2095
|
||||
|
||||
#define WGL_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB 0x00000002
|
||||
#define WGL_CONTEXT_CORE_PROFILE_BIT_ARB 0x00000001
|
||||
#define WGL_CONTEXT_PROFILE_MASK_ARB 0x9126
|
||||
#define WGL_ERROR_INVALID_PROFILE_ARB 0x2096
|
||||
|
||||
#ifndef WGL_EXT_swap_control
|
||||
#define WGL_EXT_swap_control 1
|
||||
extern int (CODEGEN_FUNCPTR *sf_ptrc_wglGetSwapIntervalEXT)(void);
|
||||
#define wglGetSwapIntervalEXT sf_ptrc_wglGetSwapIntervalEXT
|
||||
extern BOOL (CODEGEN_FUNCPTR *sf_ptrc_wglSwapIntervalEXT)(int);
|
||||
#define wglSwapIntervalEXT sf_ptrc_wglSwapIntervalEXT
|
||||
#endif /*WGL_EXT_swap_control*/
|
||||
|
||||
|
||||
#ifndef WGL_ARB_pixel_format
|
||||
#define WGL_ARB_pixel_format 1
|
||||
extern BOOL (CODEGEN_FUNCPTR *sf_ptrc_wglChoosePixelFormatARB)(HDC, const int *, const FLOAT *, UINT, int *, UINT *);
|
||||
#define wglChoosePixelFormatARB sf_ptrc_wglChoosePixelFormatARB
|
||||
extern BOOL (CODEGEN_FUNCPTR *sf_ptrc_wglGetPixelFormatAttribfvARB)(HDC, int, int, UINT, const int *, FLOAT *);
|
||||
#define wglGetPixelFormatAttribfvARB sf_ptrc_wglGetPixelFormatAttribfvARB
|
||||
extern BOOL (CODEGEN_FUNCPTR *sf_ptrc_wglGetPixelFormatAttribivARB)(HDC, int, int, UINT, const int *, int *);
|
||||
#define wglGetPixelFormatAttribivARB sf_ptrc_wglGetPixelFormatAttribivARB
|
||||
#endif /*WGL_ARB_pixel_format*/
|
||||
|
||||
#ifndef WGL_ARB_create_context
|
||||
#define WGL_ARB_create_context 1
|
||||
extern HGLRC (CODEGEN_FUNCPTR *sf_ptrc_wglCreateContextAttribsARB)(HDC, HGLRC, const int *);
|
||||
#define wglCreateContextAttribsARB sf_ptrc_wglCreateContextAttribsARB
|
||||
#endif /*WGL_ARB_create_context*/
|
||||
|
||||
|
||||
enum sfwgl_LoadStatus
|
||||
{
|
||||
sfwgl_LOAD_FAILED = 0,
|
||||
sfwgl_LOAD_SUCCEEDED = 1
|
||||
};
|
||||
|
||||
int sfwgl_LoadFunctions(HDC hdc);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /*__cplusplus*/
|
||||
|
||||
#endif /* SF_POINTER_C_GENERATED_HEADER_WINDOWSGL_HPP */
|
10
src/SFML/Window/Win32/WglExtensions.txt
Normal file
10
src/SFML/Window/Win32/WglExtensions.txt
Normal file
@ -0,0 +1,10 @@
|
||||
// Created with:
|
||||
// https://bitbucket.org/Anteru/glloadgen-reloaded
|
||||
// Commit 20f19482b7a844d20b9785c3e3fd1f16419f6e0a
|
||||
// lua LoadGen.lua -style=pointer_c -spec=wgl -indent=space -prefix=sf -extfile=WglExtensions.txt WglExtensions
|
||||
|
||||
EXT_swap_control
|
||||
WGL_ARB_multisample
|
||||
WGL_ARB_pixel_format
|
||||
WGL_ARB_create_context
|
||||
WGL_ARB_create_context_profile
|
File diff suppressed because it is too large
Load Diff
@ -1,833 +0,0 @@
|
||||
#ifndef __wglext_h_
|
||||
#define __wglext_h_ 1
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
** Copyright (c) 2013-2014 The Khronos Group Inc.
|
||||
**
|
||||
** Permission is hereby granted, free of charge, to any person obtaining a
|
||||
** copy of this software and/or associated documentation files (the
|
||||
** "Materials"), to deal in the Materials without restriction, including
|
||||
** without limitation the rights to use, copy, modify, merge, publish,
|
||||
** distribute, sublicense, and/or sell copies of the Materials, and to
|
||||
** permit persons to whom the Materials are furnished to do so, subject to
|
||||
** the following conditions:
|
||||
**
|
||||
** The above copyright notice and this permission notice shall be included
|
||||
** in all copies or substantial portions of the Materials.
|
||||
**
|
||||
** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
|
||||
*/
|
||||
/*
|
||||
** This header is generated from the Khronos OpenGL / OpenGL ES XML
|
||||
** API Registry. The current version of the Registry, generator scripts
|
||||
** used to make the header, and the header can be found at
|
||||
** http://www.opengl.org/registry/
|
||||
**
|
||||
** Khronos $Revision: 26290 $ on $Date: 2014-04-16 05:35:38 -0700 (Wed, 16 Apr 2014) $
|
||||
*/
|
||||
|
||||
#if defined(_WIN32) && !defined(APIENTRY) && !defined(__CYGWIN__) && !defined(__SCITECH_SNAP__)
|
||||
#define WIN32_LEAN_AND_MEAN 1
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
#define WGL_WGLEXT_VERSION 20140416
|
||||
|
||||
/* Generated C header for:
|
||||
* API: wgl
|
||||
* Versions considered: .*
|
||||
* Versions emitted: _nomatch_^
|
||||
* Default extensions included: wgl
|
||||
* Additional extensions included: _nomatch_^
|
||||
* Extensions removed: _nomatch_^
|
||||
*/
|
||||
|
||||
#ifndef WGL_ARB_buffer_region
|
||||
#define WGL_ARB_buffer_region 1
|
||||
#define WGL_FRONT_COLOR_BUFFER_BIT_ARB 0x00000001
|
||||
#define WGL_BACK_COLOR_BUFFER_BIT_ARB 0x00000002
|
||||
#define WGL_DEPTH_BUFFER_BIT_ARB 0x00000004
|
||||
#define WGL_STENCIL_BUFFER_BIT_ARB 0x00000008
|
||||
typedef HANDLE (WINAPI * PFNWGLCREATEBUFFERREGIONARBPROC) (HDC hDC, int iLayerPlane, UINT uType);
|
||||
typedef VOID (WINAPI * PFNWGLDELETEBUFFERREGIONARBPROC) (HANDLE hRegion);
|
||||
typedef BOOL (WINAPI * PFNWGLSAVEBUFFERREGIONARBPROC) (HANDLE hRegion, int x, int y, int width, int height);
|
||||
typedef BOOL (WINAPI * PFNWGLRESTOREBUFFERREGIONARBPROC) (HANDLE hRegion, int x, int y, int width, int height, int xSrc, int ySrc);
|
||||
#ifdef WGL_WGLEXT_PROTOTYPES
|
||||
HANDLE WINAPI wglCreateBufferRegionARB (HDC hDC, int iLayerPlane, UINT uType);
|
||||
VOID WINAPI wglDeleteBufferRegionARB (HANDLE hRegion);
|
||||
BOOL WINAPI wglSaveBufferRegionARB (HANDLE hRegion, int x, int y, int width, int height);
|
||||
BOOL WINAPI wglRestoreBufferRegionARB (HANDLE hRegion, int x, int y, int width, int height, int xSrc, int ySrc);
|
||||
#endif
|
||||
#endif /* WGL_ARB_buffer_region */
|
||||
|
||||
#ifndef WGL_ARB_create_context
|
||||
#define WGL_ARB_create_context 1
|
||||
#define WGL_CONTEXT_DEBUG_BIT_ARB 0x00000001
|
||||
#define WGL_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB 0x00000002
|
||||
#define WGL_CONTEXT_MAJOR_VERSION_ARB 0x2091
|
||||
#define WGL_CONTEXT_MINOR_VERSION_ARB 0x2092
|
||||
#define WGL_CONTEXT_LAYER_PLANE_ARB 0x2093
|
||||
#define WGL_CONTEXT_FLAGS_ARB 0x2094
|
||||
#define ERROR_INVALID_VERSION_ARB 0x2095
|
||||
typedef HGLRC (WINAPI * PFNWGLCREATECONTEXTATTRIBSARBPROC) (HDC hDC, HGLRC hShareContext, const int *attribList);
|
||||
#ifdef WGL_WGLEXT_PROTOTYPES
|
||||
HGLRC WINAPI wglCreateContextAttribsARB (HDC hDC, HGLRC hShareContext, const int *attribList);
|
||||
#endif
|
||||
#endif /* WGL_ARB_create_context */
|
||||
|
||||
#ifndef WGL_ARB_create_context_profile
|
||||
#define WGL_ARB_create_context_profile 1
|
||||
#define WGL_CONTEXT_PROFILE_MASK_ARB 0x9126
|
||||
#define WGL_CONTEXT_CORE_PROFILE_BIT_ARB 0x00000001
|
||||
#define WGL_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB 0x00000002
|
||||
#define ERROR_INVALID_PROFILE_ARB 0x2096
|
||||
#endif /* WGL_ARB_create_context_profile */
|
||||
|
||||
#ifndef WGL_ARB_create_context_robustness
|
||||
#define WGL_ARB_create_context_robustness 1
|
||||
#define WGL_CONTEXT_ROBUST_ACCESS_BIT_ARB 0x00000004
|
||||
#define WGL_LOSE_CONTEXT_ON_RESET_ARB 0x8252
|
||||
#define WGL_CONTEXT_RESET_NOTIFICATION_STRATEGY_ARB 0x8256
|
||||
#define WGL_NO_RESET_NOTIFICATION_ARB 0x8261
|
||||
#endif /* WGL_ARB_create_context_robustness */
|
||||
|
||||
#ifndef WGL_ARB_extensions_string
|
||||
#define WGL_ARB_extensions_string 1
|
||||
typedef const char *(WINAPI * PFNWGLGETEXTENSIONSSTRINGARBPROC) (HDC hdc);
|
||||
#ifdef WGL_WGLEXT_PROTOTYPES
|
||||
const char *WINAPI wglGetExtensionsStringARB (HDC hdc);
|
||||
#endif
|
||||
#endif /* WGL_ARB_extensions_string */
|
||||
|
||||
#ifndef WGL_ARB_framebuffer_sRGB
|
||||
#define WGL_ARB_framebuffer_sRGB 1
|
||||
#define WGL_FRAMEBUFFER_SRGB_CAPABLE_ARB 0x20A9
|
||||
#endif /* WGL_ARB_framebuffer_sRGB */
|
||||
|
||||
#ifndef WGL_ARB_make_current_read
|
||||
#define WGL_ARB_make_current_read 1
|
||||
#define ERROR_INVALID_PIXEL_TYPE_ARB 0x2043
|
||||
#define ERROR_INCOMPATIBLE_DEVICE_CONTEXTS_ARB 0x2054
|
||||
typedef BOOL (WINAPI * PFNWGLMAKECONTEXTCURRENTARBPROC) (HDC hDrawDC, HDC hReadDC, HGLRC hglrc);
|
||||
typedef HDC (WINAPI * PFNWGLGETCURRENTREADDCARBPROC) (void);
|
||||
#ifdef WGL_WGLEXT_PROTOTYPES
|
||||
BOOL WINAPI wglMakeContextCurrentARB (HDC hDrawDC, HDC hReadDC, HGLRC hglrc);
|
||||
HDC WINAPI wglGetCurrentReadDCARB (void);
|
||||
#endif
|
||||
#endif /* WGL_ARB_make_current_read */
|
||||
|
||||
#ifndef WGL_ARB_multisample
|
||||
#define WGL_ARB_multisample 1
|
||||
#define WGL_SAMPLE_BUFFERS_ARB 0x2041
|
||||
#define WGL_SAMPLES_ARB 0x2042
|
||||
#endif /* WGL_ARB_multisample */
|
||||
|
||||
#ifndef WGL_ARB_pbuffer
|
||||
#define WGL_ARB_pbuffer 1
|
||||
DECLARE_HANDLE(HPBUFFERARB);
|
||||
#define WGL_DRAW_TO_PBUFFER_ARB 0x202D
|
||||
#define WGL_MAX_PBUFFER_PIXELS_ARB 0x202E
|
||||
#define WGL_MAX_PBUFFER_WIDTH_ARB 0x202F
|
||||
#define WGL_MAX_PBUFFER_HEIGHT_ARB 0x2030
|
||||
#define WGL_PBUFFER_LARGEST_ARB 0x2033
|
||||
#define WGL_PBUFFER_WIDTH_ARB 0x2034
|
||||
#define WGL_PBUFFER_HEIGHT_ARB 0x2035
|
||||
#define WGL_PBUFFER_LOST_ARB 0x2036
|
||||
typedef HPBUFFERARB (WINAPI * PFNWGLCREATEPBUFFERARBPROC) (HDC hDC, int iPixelFormat, int iWidth, int iHeight, const int *piAttribList);
|
||||
typedef HDC (WINAPI * PFNWGLGETPBUFFERDCARBPROC) (HPBUFFERARB hPbuffer);
|
||||
typedef int (WINAPI * PFNWGLRELEASEPBUFFERDCARBPROC) (HPBUFFERARB hPbuffer, HDC hDC);
|
||||
typedef BOOL (WINAPI * PFNWGLDESTROYPBUFFERARBPROC) (HPBUFFERARB hPbuffer);
|
||||
typedef BOOL (WINAPI * PFNWGLQUERYPBUFFERARBPROC) (HPBUFFERARB hPbuffer, int iAttribute, int *piValue);
|
||||
#ifdef WGL_WGLEXT_PROTOTYPES
|
||||
HPBUFFERARB WINAPI wglCreatePbufferARB (HDC hDC, int iPixelFormat, int iWidth, int iHeight, const int *piAttribList);
|
||||
HDC WINAPI wglGetPbufferDCARB (HPBUFFERARB hPbuffer);
|
||||
int WINAPI wglReleasePbufferDCARB (HPBUFFERARB hPbuffer, HDC hDC);
|
||||
BOOL WINAPI wglDestroyPbufferARB (HPBUFFERARB hPbuffer);
|
||||
BOOL WINAPI wglQueryPbufferARB (HPBUFFERARB hPbuffer, int iAttribute, int *piValue);
|
||||
#endif
|
||||
#endif /* WGL_ARB_pbuffer */
|
||||
|
||||
#ifndef WGL_ARB_pixel_format
|
||||
#define WGL_ARB_pixel_format 1
|
||||
#define WGL_NUMBER_PIXEL_FORMATS_ARB 0x2000
|
||||
#define WGL_DRAW_TO_WINDOW_ARB 0x2001
|
||||
#define WGL_DRAW_TO_BITMAP_ARB 0x2002
|
||||
#define WGL_ACCELERATION_ARB 0x2003
|
||||
#define WGL_NEED_PALETTE_ARB 0x2004
|
||||
#define WGL_NEED_SYSTEM_PALETTE_ARB 0x2005
|
||||
#define WGL_SWAP_LAYER_BUFFERS_ARB 0x2006
|
||||
#define WGL_SWAP_METHOD_ARB 0x2007
|
||||
#define WGL_NUMBER_OVERLAYS_ARB 0x2008
|
||||
#define WGL_NUMBER_UNDERLAYS_ARB 0x2009
|
||||
#define WGL_TRANSPARENT_ARB 0x200A
|
||||
#define WGL_TRANSPARENT_RED_VALUE_ARB 0x2037
|
||||
#define WGL_TRANSPARENT_GREEN_VALUE_ARB 0x2038
|
||||
#define WGL_TRANSPARENT_BLUE_VALUE_ARB 0x2039
|
||||
#define WGL_TRANSPARENT_ALPHA_VALUE_ARB 0x203A
|
||||
#define WGL_TRANSPARENT_INDEX_VALUE_ARB 0x203B
|
||||
#define WGL_SHARE_DEPTH_ARB 0x200C
|
||||
#define WGL_SHARE_STENCIL_ARB 0x200D
|
||||
#define WGL_SHARE_ACCUM_ARB 0x200E
|
||||
#define WGL_SUPPORT_GDI_ARB 0x200F
|
||||
#define WGL_SUPPORT_OPENGL_ARB 0x2010
|
||||
#define WGL_DOUBLE_BUFFER_ARB 0x2011
|
||||
#define WGL_STEREO_ARB 0x2012
|
||||
#define WGL_PIXEL_TYPE_ARB 0x2013
|
||||
#define WGL_COLOR_BITS_ARB 0x2014
|
||||
#define WGL_RED_BITS_ARB 0x2015
|
||||
#define WGL_RED_SHIFT_ARB 0x2016
|
||||
#define WGL_GREEN_BITS_ARB 0x2017
|
||||
#define WGL_GREEN_SHIFT_ARB 0x2018
|
||||
#define WGL_BLUE_BITS_ARB 0x2019
|
||||
#define WGL_BLUE_SHIFT_ARB 0x201A
|
||||
#define WGL_ALPHA_BITS_ARB 0x201B
|
||||
#define WGL_ALPHA_SHIFT_ARB 0x201C
|
||||
#define WGL_ACCUM_BITS_ARB 0x201D
|
||||
#define WGL_ACCUM_RED_BITS_ARB 0x201E
|
||||
#define WGL_ACCUM_GREEN_BITS_ARB 0x201F
|
||||
#define WGL_ACCUM_BLUE_BITS_ARB 0x2020
|
||||
#define WGL_ACCUM_ALPHA_BITS_ARB 0x2021
|
||||
#define WGL_DEPTH_BITS_ARB 0x2022
|
||||
#define WGL_STENCIL_BITS_ARB 0x2023
|
||||
#define WGL_AUX_BUFFERS_ARB 0x2024
|
||||
#define WGL_NO_ACCELERATION_ARB 0x2025
|
||||
#define WGL_GENERIC_ACCELERATION_ARB 0x2026
|
||||
#define WGL_FULL_ACCELERATION_ARB 0x2027
|
||||
#define WGL_SWAP_EXCHANGE_ARB 0x2028
|
||||
#define WGL_SWAP_COPY_ARB 0x2029
|
||||
#define WGL_SWAP_UNDEFINED_ARB 0x202A
|
||||
#define WGL_TYPE_RGBA_ARB 0x202B
|
||||
#define WGL_TYPE_COLORINDEX_ARB 0x202C
|
||||
typedef BOOL (WINAPI * PFNWGLGETPIXELFORMATATTRIBIVARBPROC) (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, const int *piAttributes, int *piValues);
|
||||
typedef BOOL (WINAPI * PFNWGLGETPIXELFORMATATTRIBFVARBPROC) (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, const int *piAttributes, FLOAT *pfValues);
|
||||
typedef BOOL (WINAPI * PFNWGLCHOOSEPIXELFORMATARBPROC) (HDC hdc, const int *piAttribIList, const FLOAT *pfAttribFList, UINT nMaxFormats, int *piFormats, UINT *nNumFormats);
|
||||
#ifdef WGL_WGLEXT_PROTOTYPES
|
||||
BOOL WINAPI wglGetPixelFormatAttribivARB (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, const int *piAttributes, int *piValues);
|
||||
BOOL WINAPI wglGetPixelFormatAttribfvARB (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, const int *piAttributes, FLOAT *pfValues);
|
||||
BOOL WINAPI wglChoosePixelFormatARB (HDC hdc, const int *piAttribIList, const FLOAT *pfAttribFList, UINT nMaxFormats, int *piFormats, UINT *nNumFormats);
|
||||
#endif
|
||||
#endif /* WGL_ARB_pixel_format */
|
||||
|
||||
#ifndef WGL_ARB_pixel_format_float
|
||||
#define WGL_ARB_pixel_format_float 1
|
||||
#define WGL_TYPE_RGBA_FLOAT_ARB 0x21A0
|
||||
#endif /* WGL_ARB_pixel_format_float */
|
||||
|
||||
#ifndef WGL_ARB_render_texture
|
||||
#define WGL_ARB_render_texture 1
|
||||
#define WGL_BIND_TO_TEXTURE_RGB_ARB 0x2070
|
||||
#define WGL_BIND_TO_TEXTURE_RGBA_ARB 0x2071
|
||||
#define WGL_TEXTURE_FORMAT_ARB 0x2072
|
||||
#define WGL_TEXTURE_TARGET_ARB 0x2073
|
||||
#define WGL_MIPMAP_TEXTURE_ARB 0x2074
|
||||
#define WGL_TEXTURE_RGB_ARB 0x2075
|
||||
#define WGL_TEXTURE_RGBA_ARB 0x2076
|
||||
#define WGL_NO_TEXTURE_ARB 0x2077
|
||||
#define WGL_TEXTURE_CUBE_MAP_ARB 0x2078
|
||||
#define WGL_TEXTURE_1D_ARB 0x2079
|
||||
#define WGL_TEXTURE_2D_ARB 0x207A
|
||||
#define WGL_MIPMAP_LEVEL_ARB 0x207B
|
||||
#define WGL_CUBE_MAP_FACE_ARB 0x207C
|
||||
#define WGL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB 0x207D
|
||||
#define WGL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB 0x207E
|
||||
#define WGL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB 0x207F
|
||||
#define WGL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB 0x2080
|
||||
#define WGL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB 0x2081
|
||||
#define WGL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB 0x2082
|
||||
#define WGL_FRONT_LEFT_ARB 0x2083
|
||||
#define WGL_FRONT_RIGHT_ARB 0x2084
|
||||
#define WGL_BACK_LEFT_ARB 0x2085
|
||||
#define WGL_BACK_RIGHT_ARB 0x2086
|
||||
#define WGL_AUX0_ARB 0x2087
|
||||
#define WGL_AUX1_ARB 0x2088
|
||||
#define WGL_AUX2_ARB 0x2089
|
||||
#define WGL_AUX3_ARB 0x208A
|
||||
#define WGL_AUX4_ARB 0x208B
|
||||
#define WGL_AUX5_ARB 0x208C
|
||||
#define WGL_AUX6_ARB 0x208D
|
||||
#define WGL_AUX7_ARB 0x208E
|
||||
#define WGL_AUX8_ARB 0x208F
|
||||
#define WGL_AUX9_ARB 0x2090
|
||||
typedef BOOL (WINAPI * PFNWGLBINDTEXIMAGEARBPROC) (HPBUFFERARB hPbuffer, int iBuffer);
|
||||
typedef BOOL (WINAPI * PFNWGLRELEASETEXIMAGEARBPROC) (HPBUFFERARB hPbuffer, int iBuffer);
|
||||
typedef BOOL (WINAPI * PFNWGLSETPBUFFERATTRIBARBPROC) (HPBUFFERARB hPbuffer, const int *piAttribList);
|
||||
#ifdef WGL_WGLEXT_PROTOTYPES
|
||||
BOOL WINAPI wglBindTexImageARB (HPBUFFERARB hPbuffer, int iBuffer);
|
||||
BOOL WINAPI wglReleaseTexImageARB (HPBUFFERARB hPbuffer, int iBuffer);
|
||||
BOOL WINAPI wglSetPbufferAttribARB (HPBUFFERARB hPbuffer, const int *piAttribList);
|
||||
#endif
|
||||
#endif /* WGL_ARB_render_texture */
|
||||
|
||||
#ifndef WGL_ARB_robustness_application_isolation
|
||||
#define WGL_ARB_robustness_application_isolation 1
|
||||
#define WGL_CONTEXT_RESET_ISOLATION_BIT_ARB 0x00000008
|
||||
#endif /* WGL_ARB_robustness_application_isolation */
|
||||
|
||||
#ifndef WGL_ARB_robustness_share_group_isolation
|
||||
#define WGL_ARB_robustness_share_group_isolation 1
|
||||
#endif /* WGL_ARB_robustness_share_group_isolation */
|
||||
|
||||
#ifndef WGL_3DFX_multisample
|
||||
#define WGL_3DFX_multisample 1
|
||||
#define WGL_SAMPLE_BUFFERS_3DFX 0x2060
|
||||
#define WGL_SAMPLES_3DFX 0x2061
|
||||
#endif /* WGL_3DFX_multisample */
|
||||
|
||||
#ifndef WGL_3DL_stereo_control
|
||||
#define WGL_3DL_stereo_control 1
|
||||
#define WGL_STEREO_EMITTER_ENABLE_3DL 0x2055
|
||||
#define WGL_STEREO_EMITTER_DISABLE_3DL 0x2056
|
||||
#define WGL_STEREO_POLARITY_NORMAL_3DL 0x2057
|
||||
#define WGL_STEREO_POLARITY_INVERT_3DL 0x2058
|
||||
typedef BOOL (WINAPI * PFNWGLSETSTEREOEMITTERSTATE3DLPROC) (HDC hDC, UINT uState);
|
||||
#ifdef WGL_WGLEXT_PROTOTYPES
|
||||
BOOL WINAPI wglSetStereoEmitterState3DL (HDC hDC, UINT uState);
|
||||
#endif
|
||||
#endif /* WGL_3DL_stereo_control */
|
||||
|
||||
#ifndef WGL_AMD_gpu_association
|
||||
#define WGL_AMD_gpu_association 1
|
||||
#define WGL_GPU_VENDOR_AMD 0x1F00
|
||||
#define WGL_GPU_RENDERER_STRING_AMD 0x1F01
|
||||
#define WGL_GPU_OPENGL_VERSION_STRING_AMD 0x1F02
|
||||
#define WGL_GPU_FASTEST_TARGET_GPUS_AMD 0x21A2
|
||||
#define WGL_GPU_RAM_AMD 0x21A3
|
||||
#define WGL_GPU_CLOCK_AMD 0x21A4
|
||||
#define WGL_GPU_NUM_PIPES_AMD 0x21A5
|
||||
#define WGL_GPU_NUM_SIMD_AMD 0x21A6
|
||||
#define WGL_GPU_NUM_RB_AMD 0x21A7
|
||||
#define WGL_GPU_NUM_SPI_AMD 0x21A8
|
||||
typedef UINT (WINAPI * PFNWGLGETGPUIDSAMDPROC) (UINT maxCount, UINT *ids);
|
||||
typedef INT (WINAPI * PFNWGLGETGPUINFOAMDPROC) (UINT id, int property, GLenum dataType, UINT size, void *data);
|
||||
typedef UINT (WINAPI * PFNWGLGETCONTEXTGPUIDAMDPROC) (HGLRC hglrc);
|
||||
typedef HGLRC (WINAPI * PFNWGLCREATEASSOCIATEDCONTEXTAMDPROC) (UINT id);
|
||||
typedef HGLRC (WINAPI * PFNWGLCREATEASSOCIATEDCONTEXTATTRIBSAMDPROC) (UINT id, HGLRC hShareContext, const int *attribList);
|
||||
typedef BOOL (WINAPI * PFNWGLDELETEASSOCIATEDCONTEXTAMDPROC) (HGLRC hglrc);
|
||||
typedef BOOL (WINAPI * PFNWGLMAKEASSOCIATEDCONTEXTCURRENTAMDPROC) (HGLRC hglrc);
|
||||
typedef HGLRC (WINAPI * PFNWGLGETCURRENTASSOCIATEDCONTEXTAMDPROC) (void);
|
||||
typedef VOID (WINAPI * PFNWGLBLITCONTEXTFRAMEBUFFERAMDPROC) (HGLRC dstCtx, GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);
|
||||
#ifdef WGL_WGLEXT_PROTOTYPES
|
||||
UINT WINAPI wglGetGPUIDsAMD (UINT maxCount, UINT *ids);
|
||||
INT WINAPI wglGetGPUInfoAMD (UINT id, int property, GLenum dataType, UINT size, void *data);
|
||||
UINT WINAPI wglGetContextGPUIDAMD (HGLRC hglrc);
|
||||
HGLRC WINAPI wglCreateAssociatedContextAMD (UINT id);
|
||||
HGLRC WINAPI wglCreateAssociatedContextAttribsAMD (UINT id, HGLRC hShareContext, const int *attribList);
|
||||
BOOL WINAPI wglDeleteAssociatedContextAMD (HGLRC hglrc);
|
||||
BOOL WINAPI wglMakeAssociatedContextCurrentAMD (HGLRC hglrc);
|
||||
HGLRC WINAPI wglGetCurrentAssociatedContextAMD (void);
|
||||
VOID WINAPI wglBlitContextFramebufferAMD (HGLRC dstCtx, GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);
|
||||
#endif
|
||||
#endif /* WGL_AMD_gpu_association */
|
||||
|
||||
#ifndef WGL_ATI_pixel_format_float
|
||||
#define WGL_ATI_pixel_format_float 1
|
||||
#define WGL_TYPE_RGBA_FLOAT_ATI 0x21A0
|
||||
#endif /* WGL_ATI_pixel_format_float */
|
||||
|
||||
#ifndef WGL_EXT_create_context_es2_profile
|
||||
#define WGL_EXT_create_context_es2_profile 1
|
||||
#define WGL_CONTEXT_ES2_PROFILE_BIT_EXT 0x00000004
|
||||
#endif /* WGL_EXT_create_context_es2_profile */
|
||||
|
||||
#ifndef WGL_EXT_create_context_es_profile
|
||||
#define WGL_EXT_create_context_es_profile 1
|
||||
#define WGL_CONTEXT_ES_PROFILE_BIT_EXT 0x00000004
|
||||
#endif /* WGL_EXT_create_context_es_profile */
|
||||
|
||||
#ifndef WGL_EXT_depth_float
|
||||
#define WGL_EXT_depth_float 1
|
||||
#define WGL_DEPTH_FLOAT_EXT 0x2040
|
||||
#endif /* WGL_EXT_depth_float */
|
||||
|
||||
#ifndef WGL_EXT_display_color_table
|
||||
#define WGL_EXT_display_color_table 1
|
||||
typedef GLboolean (WINAPI * PFNWGLCREATEDISPLAYCOLORTABLEEXTPROC) (GLushort id);
|
||||
typedef GLboolean (WINAPI * PFNWGLLOADDISPLAYCOLORTABLEEXTPROC) (const GLushort *table, GLuint length);
|
||||
typedef GLboolean (WINAPI * PFNWGLBINDDISPLAYCOLORTABLEEXTPROC) (GLushort id);
|
||||
typedef VOID (WINAPI * PFNWGLDESTROYDISPLAYCOLORTABLEEXTPROC) (GLushort id);
|
||||
#ifdef WGL_WGLEXT_PROTOTYPES
|
||||
GLboolean WINAPI wglCreateDisplayColorTableEXT (GLushort id);
|
||||
GLboolean WINAPI wglLoadDisplayColorTableEXT (const GLushort *table, GLuint length);
|
||||
GLboolean WINAPI wglBindDisplayColorTableEXT (GLushort id);
|
||||
VOID WINAPI wglDestroyDisplayColorTableEXT (GLushort id);
|
||||
#endif
|
||||
#endif /* WGL_EXT_display_color_table */
|
||||
|
||||
#ifndef WGL_EXT_extensions_string
|
||||
#define WGL_EXT_extensions_string 1
|
||||
typedef const char *(WINAPI * PFNWGLGETEXTENSIONSSTRINGEXTPROC) (void);
|
||||
#ifdef WGL_WGLEXT_PROTOTYPES
|
||||
const char *WINAPI wglGetExtensionsStringEXT (void);
|
||||
#endif
|
||||
#endif /* WGL_EXT_extensions_string */
|
||||
|
||||
#ifndef WGL_EXT_framebuffer_sRGB
|
||||
#define WGL_EXT_framebuffer_sRGB 1
|
||||
#define WGL_FRAMEBUFFER_SRGB_CAPABLE_EXT 0x20A9
|
||||
#endif /* WGL_EXT_framebuffer_sRGB */
|
||||
|
||||
#ifndef WGL_EXT_make_current_read
|
||||
#define WGL_EXT_make_current_read 1
|
||||
#define ERROR_INVALID_PIXEL_TYPE_EXT 0x2043
|
||||
typedef BOOL (WINAPI * PFNWGLMAKECONTEXTCURRENTEXTPROC) (HDC hDrawDC, HDC hReadDC, HGLRC hglrc);
|
||||
typedef HDC (WINAPI * PFNWGLGETCURRENTREADDCEXTPROC) (void);
|
||||
#ifdef WGL_WGLEXT_PROTOTYPES
|
||||
BOOL WINAPI wglMakeContextCurrentEXT (HDC hDrawDC, HDC hReadDC, HGLRC hglrc);
|
||||
HDC WINAPI wglGetCurrentReadDCEXT (void);
|
||||
#endif
|
||||
#endif /* WGL_EXT_make_current_read */
|
||||
|
||||
#ifndef WGL_EXT_multisample
|
||||
#define WGL_EXT_multisample 1
|
||||
#define WGL_SAMPLE_BUFFERS_EXT 0x2041
|
||||
#define WGL_SAMPLES_EXT 0x2042
|
||||
#endif /* WGL_EXT_multisample */
|
||||
|
||||
#ifndef WGL_EXT_pbuffer
|
||||
#define WGL_EXT_pbuffer 1
|
||||
DECLARE_HANDLE(HPBUFFEREXT);
|
||||
#define WGL_DRAW_TO_PBUFFER_EXT 0x202D
|
||||
#define WGL_MAX_PBUFFER_PIXELS_EXT 0x202E
|
||||
#define WGL_MAX_PBUFFER_WIDTH_EXT 0x202F
|
||||
#define WGL_MAX_PBUFFER_HEIGHT_EXT 0x2030
|
||||
#define WGL_OPTIMAL_PBUFFER_WIDTH_EXT 0x2031
|
||||
#define WGL_OPTIMAL_PBUFFER_HEIGHT_EXT 0x2032
|
||||
#define WGL_PBUFFER_LARGEST_EXT 0x2033
|
||||
#define WGL_PBUFFER_WIDTH_EXT 0x2034
|
||||
#define WGL_PBUFFER_HEIGHT_EXT 0x2035
|
||||
typedef HPBUFFEREXT (WINAPI * PFNWGLCREATEPBUFFEREXTPROC) (HDC hDC, int iPixelFormat, int iWidth, int iHeight, const int *piAttribList);
|
||||
typedef HDC (WINAPI * PFNWGLGETPBUFFERDCEXTPROC) (HPBUFFEREXT hPbuffer);
|
||||
typedef int (WINAPI * PFNWGLRELEASEPBUFFERDCEXTPROC) (HPBUFFEREXT hPbuffer, HDC hDC);
|
||||
typedef BOOL (WINAPI * PFNWGLDESTROYPBUFFEREXTPROC) (HPBUFFEREXT hPbuffer);
|
||||
typedef BOOL (WINAPI * PFNWGLQUERYPBUFFEREXTPROC) (HPBUFFEREXT hPbuffer, int iAttribute, int *piValue);
|
||||
#ifdef WGL_WGLEXT_PROTOTYPES
|
||||
HPBUFFEREXT WINAPI wglCreatePbufferEXT (HDC hDC, int iPixelFormat, int iWidth, int iHeight, const int *piAttribList);
|
||||
HDC WINAPI wglGetPbufferDCEXT (HPBUFFEREXT hPbuffer);
|
||||
int WINAPI wglReleasePbufferDCEXT (HPBUFFEREXT hPbuffer, HDC hDC);
|
||||
BOOL WINAPI wglDestroyPbufferEXT (HPBUFFEREXT hPbuffer);
|
||||
BOOL WINAPI wglQueryPbufferEXT (HPBUFFEREXT hPbuffer, int iAttribute, int *piValue);
|
||||
#endif
|
||||
#endif /* WGL_EXT_pbuffer */
|
||||
|
||||
#ifndef WGL_EXT_pixel_format
|
||||
#define WGL_EXT_pixel_format 1
|
||||
#define WGL_NUMBER_PIXEL_FORMATS_EXT 0x2000
|
||||
#define WGL_DRAW_TO_WINDOW_EXT 0x2001
|
||||
#define WGL_DRAW_TO_BITMAP_EXT 0x2002
|
||||
#define WGL_ACCELERATION_EXT 0x2003
|
||||
#define WGL_NEED_PALETTE_EXT 0x2004
|
||||
#define WGL_NEED_SYSTEM_PALETTE_EXT 0x2005
|
||||
#define WGL_SWAP_LAYER_BUFFERS_EXT 0x2006
|
||||
#define WGL_SWAP_METHOD_EXT 0x2007
|
||||
#define WGL_NUMBER_OVERLAYS_EXT 0x2008
|
||||
#define WGL_NUMBER_UNDERLAYS_EXT 0x2009
|
||||
#define WGL_TRANSPARENT_EXT 0x200A
|
||||
#define WGL_TRANSPARENT_VALUE_EXT 0x200B
|
||||
#define WGL_SHARE_DEPTH_EXT 0x200C
|
||||
#define WGL_SHARE_STENCIL_EXT 0x200D
|
||||
#define WGL_SHARE_ACCUM_EXT 0x200E
|
||||
#define WGL_SUPPORT_GDI_EXT 0x200F
|
||||
#define WGL_SUPPORT_OPENGL_EXT 0x2010
|
||||
#define WGL_DOUBLE_BUFFER_EXT 0x2011
|
||||
#define WGL_STEREO_EXT 0x2012
|
||||
#define WGL_PIXEL_TYPE_EXT 0x2013
|
||||
#define WGL_COLOR_BITS_EXT 0x2014
|
||||
#define WGL_RED_BITS_EXT 0x2015
|
||||
#define WGL_RED_SHIFT_EXT 0x2016
|
||||
#define WGL_GREEN_BITS_EXT 0x2017
|
||||
#define WGL_GREEN_SHIFT_EXT 0x2018
|
||||
#define WGL_BLUE_BITS_EXT 0x2019
|
||||
#define WGL_BLUE_SHIFT_EXT 0x201A
|
||||
#define WGL_ALPHA_BITS_EXT 0x201B
|
||||
#define WGL_ALPHA_SHIFT_EXT 0x201C
|
||||
#define WGL_ACCUM_BITS_EXT 0x201D
|
||||
#define WGL_ACCUM_RED_BITS_EXT 0x201E
|
||||
#define WGL_ACCUM_GREEN_BITS_EXT 0x201F
|
||||
#define WGL_ACCUM_BLUE_BITS_EXT 0x2020
|
||||
#define WGL_ACCUM_ALPHA_BITS_EXT 0x2021
|
||||
#define WGL_DEPTH_BITS_EXT 0x2022
|
||||
#define WGL_STENCIL_BITS_EXT 0x2023
|
||||
#define WGL_AUX_BUFFERS_EXT 0x2024
|
||||
#define WGL_NO_ACCELERATION_EXT 0x2025
|
||||
#define WGL_GENERIC_ACCELERATION_EXT 0x2026
|
||||
#define WGL_FULL_ACCELERATION_EXT 0x2027
|
||||
#define WGL_SWAP_EXCHANGE_EXT 0x2028
|
||||
#define WGL_SWAP_COPY_EXT 0x2029
|
||||
#define WGL_SWAP_UNDEFINED_EXT 0x202A
|
||||
#define WGL_TYPE_RGBA_EXT 0x202B
|
||||
#define WGL_TYPE_COLORINDEX_EXT 0x202C
|
||||
typedef BOOL (WINAPI * PFNWGLGETPIXELFORMATATTRIBIVEXTPROC) (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, int *piAttributes, int *piValues);
|
||||
typedef BOOL (WINAPI * PFNWGLGETPIXELFORMATATTRIBFVEXTPROC) (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, int *piAttributes, FLOAT *pfValues);
|
||||
typedef BOOL (WINAPI * PFNWGLCHOOSEPIXELFORMATEXTPROC) (HDC hdc, const int *piAttribIList, const FLOAT *pfAttribFList, UINT nMaxFormats, int *piFormats, UINT *nNumFormats);
|
||||
#ifdef WGL_WGLEXT_PROTOTYPES
|
||||
BOOL WINAPI wglGetPixelFormatAttribivEXT (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, int *piAttributes, int *piValues);
|
||||
BOOL WINAPI wglGetPixelFormatAttribfvEXT (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, int *piAttributes, FLOAT *pfValues);
|
||||
BOOL WINAPI wglChoosePixelFormatEXT (HDC hdc, const int *piAttribIList, const FLOAT *pfAttribFList, UINT nMaxFormats, int *piFormats, UINT *nNumFormats);
|
||||
#endif
|
||||
#endif /* WGL_EXT_pixel_format */
|
||||
|
||||
#ifndef WGL_EXT_pixel_format_packed_float
|
||||
#define WGL_EXT_pixel_format_packed_float 1
|
||||
#define WGL_TYPE_RGBA_UNSIGNED_FLOAT_EXT 0x20A8
|
||||
#endif /* WGL_EXT_pixel_format_packed_float */
|
||||
|
||||
#ifndef WGL_EXT_swap_control
|
||||
#define WGL_EXT_swap_control 1
|
||||
typedef BOOL (WINAPI * PFNWGLSWAPINTERVALEXTPROC) (int interval);
|
||||
typedef int (WINAPI * PFNWGLGETSWAPINTERVALEXTPROC) (void);
|
||||
#ifdef WGL_WGLEXT_PROTOTYPES
|
||||
BOOL WINAPI wglSwapIntervalEXT (int interval);
|
||||
int WINAPI wglGetSwapIntervalEXT (void);
|
||||
#endif
|
||||
#endif /* WGL_EXT_swap_control */
|
||||
|
||||
#ifndef WGL_EXT_swap_control_tear
|
||||
#define WGL_EXT_swap_control_tear 1
|
||||
#endif /* WGL_EXT_swap_control_tear */
|
||||
|
||||
#ifndef WGL_I3D_digital_video_control
|
||||
#define WGL_I3D_digital_video_control 1
|
||||
#define WGL_DIGITAL_VIDEO_CURSOR_ALPHA_FRAMEBUFFER_I3D 0x2050
|
||||
#define WGL_DIGITAL_VIDEO_CURSOR_ALPHA_VALUE_I3D 0x2051
|
||||
#define WGL_DIGITAL_VIDEO_CURSOR_INCLUDED_I3D 0x2052
|
||||
#define WGL_DIGITAL_VIDEO_GAMMA_CORRECTED_I3D 0x2053
|
||||
typedef BOOL (WINAPI * PFNWGLGETDIGITALVIDEOPARAMETERSI3DPROC) (HDC hDC, int iAttribute, int *piValue);
|
||||
typedef BOOL (WINAPI * PFNWGLSETDIGITALVIDEOPARAMETERSI3DPROC) (HDC hDC, int iAttribute, const int *piValue);
|
||||
#ifdef WGL_WGLEXT_PROTOTYPES
|
||||
BOOL WINAPI wglGetDigitalVideoParametersI3D (HDC hDC, int iAttribute, int *piValue);
|
||||
BOOL WINAPI wglSetDigitalVideoParametersI3D (HDC hDC, int iAttribute, const int *piValue);
|
||||
#endif
|
||||
#endif /* WGL_I3D_digital_video_control */
|
||||
|
||||
#ifndef WGL_I3D_gamma
|
||||
#define WGL_I3D_gamma 1
|
||||
#define WGL_GAMMA_TABLE_SIZE_I3D 0x204E
|
||||
#define WGL_GAMMA_EXCLUDE_DESKTOP_I3D 0x204F
|
||||
typedef BOOL (WINAPI * PFNWGLGETGAMMATABLEPARAMETERSI3DPROC) (HDC hDC, int iAttribute, int *piValue);
|
||||
typedef BOOL (WINAPI * PFNWGLSETGAMMATABLEPARAMETERSI3DPROC) (HDC hDC, int iAttribute, const int *piValue);
|
||||
typedef BOOL (WINAPI * PFNWGLGETGAMMATABLEI3DPROC) (HDC hDC, int iEntries, USHORT *puRed, USHORT *puGreen, USHORT *puBlue);
|
||||
typedef BOOL (WINAPI * PFNWGLSETGAMMATABLEI3DPROC) (HDC hDC, int iEntries, const USHORT *puRed, const USHORT *puGreen, const USHORT *puBlue);
|
||||
#ifdef WGL_WGLEXT_PROTOTYPES
|
||||
BOOL WINAPI wglGetGammaTableParametersI3D (HDC hDC, int iAttribute, int *piValue);
|
||||
BOOL WINAPI wglSetGammaTableParametersI3D (HDC hDC, int iAttribute, const int *piValue);
|
||||
BOOL WINAPI wglGetGammaTableI3D (HDC hDC, int iEntries, USHORT *puRed, USHORT *puGreen, USHORT *puBlue);
|
||||
BOOL WINAPI wglSetGammaTableI3D (HDC hDC, int iEntries, const USHORT *puRed, const USHORT *puGreen, const USHORT *puBlue);
|
||||
#endif
|
||||
#endif /* WGL_I3D_gamma */
|
||||
|
||||
#ifndef WGL_I3D_genlock
|
||||
#define WGL_I3D_genlock 1
|
||||
#define WGL_GENLOCK_SOURCE_MULTIVIEW_I3D 0x2044
|
||||
#define WGL_GENLOCK_SOURCE_EXTERNAL_SYNC_I3D 0x2045
|
||||
#define WGL_GENLOCK_SOURCE_EXTERNAL_FIELD_I3D 0x2046
|
||||
#define WGL_GENLOCK_SOURCE_EXTERNAL_TTL_I3D 0x2047
|
||||
#define WGL_GENLOCK_SOURCE_DIGITAL_SYNC_I3D 0x2048
|
||||
#define WGL_GENLOCK_SOURCE_DIGITAL_FIELD_I3D 0x2049
|
||||
#define WGL_GENLOCK_SOURCE_EDGE_FALLING_I3D 0x204A
|
||||
#define WGL_GENLOCK_SOURCE_EDGE_RISING_I3D 0x204B
|
||||
#define WGL_GENLOCK_SOURCE_EDGE_BOTH_I3D 0x204C
|
||||
typedef BOOL (WINAPI * PFNWGLENABLEGENLOCKI3DPROC) (HDC hDC);
|
||||
typedef BOOL (WINAPI * PFNWGLDISABLEGENLOCKI3DPROC) (HDC hDC);
|
||||
typedef BOOL (WINAPI * PFNWGLISENABLEDGENLOCKI3DPROC) (HDC hDC, BOOL *pFlag);
|
||||
typedef BOOL (WINAPI * PFNWGLGENLOCKSOURCEI3DPROC) (HDC hDC, UINT uSource);
|
||||
typedef BOOL (WINAPI * PFNWGLGETGENLOCKSOURCEI3DPROC) (HDC hDC, UINT *uSource);
|
||||
typedef BOOL (WINAPI * PFNWGLGENLOCKSOURCEEDGEI3DPROC) (HDC hDC, UINT uEdge);
|
||||
typedef BOOL (WINAPI * PFNWGLGETGENLOCKSOURCEEDGEI3DPROC) (HDC hDC, UINT *uEdge);
|
||||
typedef BOOL (WINAPI * PFNWGLGENLOCKSAMPLERATEI3DPROC) (HDC hDC, UINT uRate);
|
||||
typedef BOOL (WINAPI * PFNWGLGETGENLOCKSAMPLERATEI3DPROC) (HDC hDC, UINT *uRate);
|
||||
typedef BOOL (WINAPI * PFNWGLGENLOCKSOURCEDELAYI3DPROC) (HDC hDC, UINT uDelay);
|
||||
typedef BOOL (WINAPI * PFNWGLGETGENLOCKSOURCEDELAYI3DPROC) (HDC hDC, UINT *uDelay);
|
||||
typedef BOOL (WINAPI * PFNWGLQUERYGENLOCKMAXSOURCEDELAYI3DPROC) (HDC hDC, UINT *uMaxLineDelay, UINT *uMaxPixelDelay);
|
||||
#ifdef WGL_WGLEXT_PROTOTYPES
|
||||
BOOL WINAPI wglEnableGenlockI3D (HDC hDC);
|
||||
BOOL WINAPI wglDisableGenlockI3D (HDC hDC);
|
||||
BOOL WINAPI wglIsEnabledGenlockI3D (HDC hDC, BOOL *pFlag);
|
||||
BOOL WINAPI wglGenlockSourceI3D (HDC hDC, UINT uSource);
|
||||
BOOL WINAPI wglGetGenlockSourceI3D (HDC hDC, UINT *uSource);
|
||||
BOOL WINAPI wglGenlockSourceEdgeI3D (HDC hDC, UINT uEdge);
|
||||
BOOL WINAPI wglGetGenlockSourceEdgeI3D (HDC hDC, UINT *uEdge);
|
||||
BOOL WINAPI wglGenlockSampleRateI3D (HDC hDC, UINT uRate);
|
||||
BOOL WINAPI wglGetGenlockSampleRateI3D (HDC hDC, UINT *uRate);
|
||||
BOOL WINAPI wglGenlockSourceDelayI3D (HDC hDC, UINT uDelay);
|
||||
BOOL WINAPI wglGetGenlockSourceDelayI3D (HDC hDC, UINT *uDelay);
|
||||
BOOL WINAPI wglQueryGenlockMaxSourceDelayI3D (HDC hDC, UINT *uMaxLineDelay, UINT *uMaxPixelDelay);
|
||||
#endif
|
||||
#endif /* WGL_I3D_genlock */
|
||||
|
||||
#ifndef WGL_I3D_image_buffer
|
||||
#define WGL_I3D_image_buffer 1
|
||||
#define WGL_IMAGE_BUFFER_MIN_ACCESS_I3D 0x00000001
|
||||
#define WGL_IMAGE_BUFFER_LOCK_I3D 0x00000002
|
||||
typedef LPVOID (WINAPI * PFNWGLCREATEIMAGEBUFFERI3DPROC) (HDC hDC, DWORD dwSize, UINT uFlags);
|
||||
typedef BOOL (WINAPI * PFNWGLDESTROYIMAGEBUFFERI3DPROC) (HDC hDC, LPVOID pAddress);
|
||||
typedef BOOL (WINAPI * PFNWGLASSOCIATEIMAGEBUFFEREVENTSI3DPROC) (HDC hDC, const HANDLE *pEvent, const LPVOID *pAddress, const DWORD *pSize, UINT count);
|
||||
typedef BOOL (WINAPI * PFNWGLRELEASEIMAGEBUFFEREVENTSI3DPROC) (HDC hDC, const LPVOID *pAddress, UINT count);
|
||||
#ifdef WGL_WGLEXT_PROTOTYPES
|
||||
LPVOID WINAPI wglCreateImageBufferI3D (HDC hDC, DWORD dwSize, UINT uFlags);
|
||||
BOOL WINAPI wglDestroyImageBufferI3D (HDC hDC, LPVOID pAddress);
|
||||
BOOL WINAPI wglAssociateImageBufferEventsI3D (HDC hDC, const HANDLE *pEvent, const LPVOID *pAddress, const DWORD *pSize, UINT count);
|
||||
BOOL WINAPI wglReleaseImageBufferEventsI3D (HDC hDC, const LPVOID *pAddress, UINT count);
|
||||
#endif
|
||||
#endif /* WGL_I3D_image_buffer */
|
||||
|
||||
#ifndef WGL_I3D_swap_frame_lock
|
||||
#define WGL_I3D_swap_frame_lock 1
|
||||
typedef BOOL (WINAPI * PFNWGLENABLEFRAMELOCKI3DPROC) (void);
|
||||
typedef BOOL (WINAPI * PFNWGLDISABLEFRAMELOCKI3DPROC) (void);
|
||||
typedef BOOL (WINAPI * PFNWGLISENABLEDFRAMELOCKI3DPROC) (BOOL *pFlag);
|
||||
typedef BOOL (WINAPI * PFNWGLQUERYFRAMELOCKMASTERI3DPROC) (BOOL *pFlag);
|
||||
#ifdef WGL_WGLEXT_PROTOTYPES
|
||||
BOOL WINAPI wglEnableFrameLockI3D (void);
|
||||
BOOL WINAPI wglDisableFrameLockI3D (void);
|
||||
BOOL WINAPI wglIsEnabledFrameLockI3D (BOOL *pFlag);
|
||||
BOOL WINAPI wglQueryFrameLockMasterI3D (BOOL *pFlag);
|
||||
#endif
|
||||
#endif /* WGL_I3D_swap_frame_lock */
|
||||
|
||||
#ifndef WGL_I3D_swap_frame_usage
|
||||
#define WGL_I3D_swap_frame_usage 1
|
||||
typedef BOOL (WINAPI * PFNWGLGETFRAMEUSAGEI3DPROC) (float *pUsage);
|
||||
typedef BOOL (WINAPI * PFNWGLBEGINFRAMETRACKINGI3DPROC) (void);
|
||||
typedef BOOL (WINAPI * PFNWGLENDFRAMETRACKINGI3DPROC) (void);
|
||||
typedef BOOL (WINAPI * PFNWGLQUERYFRAMETRACKINGI3DPROC) (DWORD *pFrameCount, DWORD *pMissedFrames, float *pLastMissedUsage);
|
||||
#ifdef WGL_WGLEXT_PROTOTYPES
|
||||
BOOL WINAPI wglGetFrameUsageI3D (float *pUsage);
|
||||
BOOL WINAPI wglBeginFrameTrackingI3D (void);
|
||||
BOOL WINAPI wglEndFrameTrackingI3D (void);
|
||||
BOOL WINAPI wglQueryFrameTrackingI3D (DWORD *pFrameCount, DWORD *pMissedFrames, float *pLastMissedUsage);
|
||||
#endif
|
||||
#endif /* WGL_I3D_swap_frame_usage */
|
||||
|
||||
#ifndef WGL_NV_DX_interop
|
||||
#define WGL_NV_DX_interop 1
|
||||
#define WGL_ACCESS_READ_ONLY_NV 0x00000000
|
||||
#define WGL_ACCESS_READ_WRITE_NV 0x00000001
|
||||
#define WGL_ACCESS_WRITE_DISCARD_NV 0x00000002
|
||||
typedef BOOL (WINAPI * PFNWGLDXSETRESOURCESHAREHANDLENVPROC) (void *dxObject, HANDLE shareHandle);
|
||||
typedef HANDLE (WINAPI * PFNWGLDXOPENDEVICENVPROC) (void *dxDevice);
|
||||
typedef BOOL (WINAPI * PFNWGLDXCLOSEDEVICENVPROC) (HANDLE hDevice);
|
||||
typedef HANDLE (WINAPI * PFNWGLDXREGISTEROBJECTNVPROC) (HANDLE hDevice, void *dxObject, GLuint name, GLenum type, GLenum access);
|
||||
typedef BOOL (WINAPI * PFNWGLDXUNREGISTEROBJECTNVPROC) (HANDLE hDevice, HANDLE hObject);
|
||||
typedef BOOL (WINAPI * PFNWGLDXOBJECTACCESSNVPROC) (HANDLE hObject, GLenum access);
|
||||
typedef BOOL (WINAPI * PFNWGLDXLOCKOBJECTSNVPROC) (HANDLE hDevice, GLint count, HANDLE *hObjects);
|
||||
typedef BOOL (WINAPI * PFNWGLDXUNLOCKOBJECTSNVPROC) (HANDLE hDevice, GLint count, HANDLE *hObjects);
|
||||
#ifdef WGL_WGLEXT_PROTOTYPES
|
||||
BOOL WINAPI wglDXSetResourceShareHandleNV (void *dxObject, HANDLE shareHandle);
|
||||
HANDLE WINAPI wglDXOpenDeviceNV (void *dxDevice);
|
||||
BOOL WINAPI wglDXCloseDeviceNV (HANDLE hDevice);
|
||||
HANDLE WINAPI wglDXRegisterObjectNV (HANDLE hDevice, void *dxObject, GLuint name, GLenum type, GLenum access);
|
||||
BOOL WINAPI wglDXUnregisterObjectNV (HANDLE hDevice, HANDLE hObject);
|
||||
BOOL WINAPI wglDXObjectAccessNV (HANDLE hObject, GLenum access);
|
||||
BOOL WINAPI wglDXLockObjectsNV (HANDLE hDevice, GLint count, HANDLE *hObjects);
|
||||
BOOL WINAPI wglDXUnlockObjectsNV (HANDLE hDevice, GLint count, HANDLE *hObjects);
|
||||
#endif
|
||||
#endif /* WGL_NV_DX_interop */
|
||||
|
||||
#ifndef WGL_NV_DX_interop2
|
||||
#define WGL_NV_DX_interop2 1
|
||||
#endif /* WGL_NV_DX_interop2 */
|
||||
|
||||
#ifndef WGL_NV_copy_image
|
||||
#define WGL_NV_copy_image 1
|
||||
typedef BOOL (WINAPI * PFNWGLCOPYIMAGESUBDATANVPROC) (HGLRC hSrcRC, GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, HGLRC hDstRC, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei width, GLsizei height, GLsizei depth);
|
||||
#ifdef WGL_WGLEXT_PROTOTYPES
|
||||
BOOL WINAPI wglCopyImageSubDataNV (HGLRC hSrcRC, GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, HGLRC hDstRC, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei width, GLsizei height, GLsizei depth);
|
||||
#endif
|
||||
#endif /* WGL_NV_copy_image */
|
||||
|
||||
#ifndef WGL_NV_delay_before_swap
|
||||
#define WGL_NV_delay_before_swap 1
|
||||
typedef BOOL (WINAPI * PFNWGLDELAYBEFORESWAPNVPROC) (HDC hDC, GLfloat seconds);
|
||||
#ifdef WGL_WGLEXT_PROTOTYPES
|
||||
BOOL WINAPI wglDelayBeforeSwapNV (HDC hDC, GLfloat seconds);
|
||||
#endif
|
||||
#endif /* WGL_NV_delay_before_swap */
|
||||
|
||||
#ifndef WGL_NV_float_buffer
|
||||
#define WGL_NV_float_buffer 1
|
||||
#define WGL_FLOAT_COMPONENTS_NV 0x20B0
|
||||
#define WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_R_NV 0x20B1
|
||||
#define WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_RG_NV 0x20B2
|
||||
#define WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_RGB_NV 0x20B3
|
||||
#define WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_RGBA_NV 0x20B4
|
||||
#define WGL_TEXTURE_FLOAT_R_NV 0x20B5
|
||||
#define WGL_TEXTURE_FLOAT_RG_NV 0x20B6
|
||||
#define WGL_TEXTURE_FLOAT_RGB_NV 0x20B7
|
||||
#define WGL_TEXTURE_FLOAT_RGBA_NV 0x20B8
|
||||
#endif /* WGL_NV_float_buffer */
|
||||
|
||||
#ifndef WGL_NV_gpu_affinity
|
||||
#define WGL_NV_gpu_affinity 1
|
||||
DECLARE_HANDLE(HGPUNV);
|
||||
struct _GPU_DEVICE {
|
||||
DWORD cb;
|
||||
CHAR DeviceName[32];
|
||||
CHAR DeviceString[128];
|
||||
DWORD Flags;
|
||||
RECT rcVirtualScreen;
|
||||
};
|
||||
typedef struct _GPU_DEVICE *PGPU_DEVICE;
|
||||
#define ERROR_INCOMPATIBLE_AFFINITY_MASKS_NV 0x20D0
|
||||
#define ERROR_MISSING_AFFINITY_MASK_NV 0x20D1
|
||||
typedef BOOL (WINAPI * PFNWGLENUMGPUSNVPROC) (UINT iGpuIndex, HGPUNV *phGpu);
|
||||
typedef BOOL (WINAPI * PFNWGLENUMGPUDEVICESNVPROC) (HGPUNV hGpu, UINT iDeviceIndex, PGPU_DEVICE lpGpuDevice);
|
||||
typedef HDC (WINAPI * PFNWGLCREATEAFFINITYDCNVPROC) (const HGPUNV *phGpuList);
|
||||
typedef BOOL (WINAPI * PFNWGLENUMGPUSFROMAFFINITYDCNVPROC) (HDC hAffinityDC, UINT iGpuIndex, HGPUNV *hGpu);
|
||||
typedef BOOL (WINAPI * PFNWGLDELETEDCNVPROC) (HDC hdc);
|
||||
#ifdef WGL_WGLEXT_PROTOTYPES
|
||||
BOOL WINAPI wglEnumGpusNV (UINT iGpuIndex, HGPUNV *phGpu);
|
||||
BOOL WINAPI wglEnumGpuDevicesNV (HGPUNV hGpu, UINT iDeviceIndex, PGPU_DEVICE lpGpuDevice);
|
||||
HDC WINAPI wglCreateAffinityDCNV (const HGPUNV *phGpuList);
|
||||
BOOL WINAPI wglEnumGpusFromAffinityDCNV (HDC hAffinityDC, UINT iGpuIndex, HGPUNV *hGpu);
|
||||
BOOL WINAPI wglDeleteDCNV (HDC hdc);
|
||||
#endif
|
||||
#endif /* WGL_NV_gpu_affinity */
|
||||
|
||||
#ifndef WGL_NV_multisample_coverage
|
||||
#define WGL_NV_multisample_coverage 1
|
||||
#define WGL_COVERAGE_SAMPLES_NV 0x2042
|
||||
#define WGL_COLOR_SAMPLES_NV 0x20B9
|
||||
#endif /* WGL_NV_multisample_coverage */
|
||||
|
||||
#ifndef WGL_NV_present_video
|
||||
#define WGL_NV_present_video 1
|
||||
DECLARE_HANDLE(HVIDEOOUTPUTDEVICENV);
|
||||
#define WGL_NUM_VIDEO_SLOTS_NV 0x20F0
|
||||
typedef int (WINAPI * PFNWGLENUMERATEVIDEODEVICESNVPROC) (HDC hDC, HVIDEOOUTPUTDEVICENV *phDeviceList);
|
||||
typedef BOOL (WINAPI * PFNWGLBINDVIDEODEVICENVPROC) (HDC hDC, unsigned int uVideoSlot, HVIDEOOUTPUTDEVICENV hVideoDevice, const int *piAttribList);
|
||||
typedef BOOL (WINAPI * PFNWGLQUERYCURRENTCONTEXTNVPROC) (int iAttribute, int *piValue);
|
||||
#ifdef WGL_WGLEXT_PROTOTYPES
|
||||
int WINAPI wglEnumerateVideoDevicesNV (HDC hDC, HVIDEOOUTPUTDEVICENV *phDeviceList);
|
||||
BOOL WINAPI wglBindVideoDeviceNV (HDC hDC, unsigned int uVideoSlot, HVIDEOOUTPUTDEVICENV hVideoDevice, const int *piAttribList);
|
||||
BOOL WINAPI wglQueryCurrentContextNV (int iAttribute, int *piValue);
|
||||
#endif
|
||||
#endif /* WGL_NV_present_video */
|
||||
|
||||
#ifndef WGL_NV_render_depth_texture
|
||||
#define WGL_NV_render_depth_texture 1
|
||||
#define WGL_BIND_TO_TEXTURE_DEPTH_NV 0x20A3
|
||||
#define WGL_BIND_TO_TEXTURE_RECTANGLE_DEPTH_NV 0x20A4
|
||||
#define WGL_DEPTH_TEXTURE_FORMAT_NV 0x20A5
|
||||
#define WGL_TEXTURE_DEPTH_COMPONENT_NV 0x20A6
|
||||
#define WGL_DEPTH_COMPONENT_NV 0x20A7
|
||||
#endif /* WGL_NV_render_depth_texture */
|
||||
|
||||
#ifndef WGL_NV_render_texture_rectangle
|
||||
#define WGL_NV_render_texture_rectangle 1
|
||||
#define WGL_BIND_TO_TEXTURE_RECTANGLE_RGB_NV 0x20A0
|
||||
#define WGL_BIND_TO_TEXTURE_RECTANGLE_RGBA_NV 0x20A1
|
||||
#define WGL_TEXTURE_RECTANGLE_NV 0x20A2
|
||||
#endif /* WGL_NV_render_texture_rectangle */
|
||||
|
||||
#ifndef WGL_NV_swap_group
|
||||
#define WGL_NV_swap_group 1
|
||||
typedef BOOL (WINAPI * PFNWGLJOINSWAPGROUPNVPROC) (HDC hDC, GLuint group);
|
||||
typedef BOOL (WINAPI * PFNWGLBINDSWAPBARRIERNVPROC) (GLuint group, GLuint barrier);
|
||||
typedef BOOL (WINAPI * PFNWGLQUERYSWAPGROUPNVPROC) (HDC hDC, GLuint *group, GLuint *barrier);
|
||||
typedef BOOL (WINAPI * PFNWGLQUERYMAXSWAPGROUPSNVPROC) (HDC hDC, GLuint *maxGroups, GLuint *maxBarriers);
|
||||
typedef BOOL (WINAPI * PFNWGLQUERYFRAMECOUNTNVPROC) (HDC hDC, GLuint *count);
|
||||
typedef BOOL (WINAPI * PFNWGLRESETFRAMECOUNTNVPROC) (HDC hDC);
|
||||
#ifdef WGL_WGLEXT_PROTOTYPES
|
||||
BOOL WINAPI wglJoinSwapGroupNV (HDC hDC, GLuint group);
|
||||
BOOL WINAPI wglBindSwapBarrierNV (GLuint group, GLuint barrier);
|
||||
BOOL WINAPI wglQuerySwapGroupNV (HDC hDC, GLuint *group, GLuint *barrier);
|
||||
BOOL WINAPI wglQueryMaxSwapGroupsNV (HDC hDC, GLuint *maxGroups, GLuint *maxBarriers);
|
||||
BOOL WINAPI wglQueryFrameCountNV (HDC hDC, GLuint *count);
|
||||
BOOL WINAPI wglResetFrameCountNV (HDC hDC);
|
||||
#endif
|
||||
#endif /* WGL_NV_swap_group */
|
||||
|
||||
#ifndef WGL_NV_vertex_array_range
|
||||
#define WGL_NV_vertex_array_range 1
|
||||
typedef void *(WINAPI * PFNWGLALLOCATEMEMORYNVPROC) (GLsizei size, GLfloat readfreq, GLfloat writefreq, GLfloat priority);
|
||||
typedef void (WINAPI * PFNWGLFREEMEMORYNVPROC) (void *pointer);
|
||||
#ifdef WGL_WGLEXT_PROTOTYPES
|
||||
void *WINAPI wglAllocateMemoryNV (GLsizei size, GLfloat readfreq, GLfloat writefreq, GLfloat priority);
|
||||
void WINAPI wglFreeMemoryNV (void *pointer);
|
||||
#endif
|
||||
#endif /* WGL_NV_vertex_array_range */
|
||||
|
||||
#ifndef WGL_NV_video_capture
|
||||
#define WGL_NV_video_capture 1
|
||||
DECLARE_HANDLE(HVIDEOINPUTDEVICENV);
|
||||
#define WGL_UNIQUE_ID_NV 0x20CE
|
||||
#define WGL_NUM_VIDEO_CAPTURE_SLOTS_NV 0x20CF
|
||||
typedef BOOL (WINAPI * PFNWGLBINDVIDEOCAPTUREDEVICENVPROC) (UINT uVideoSlot, HVIDEOINPUTDEVICENV hDevice);
|
||||
typedef UINT (WINAPI * PFNWGLENUMERATEVIDEOCAPTUREDEVICESNVPROC) (HDC hDc, HVIDEOINPUTDEVICENV *phDeviceList);
|
||||
typedef BOOL (WINAPI * PFNWGLLOCKVIDEOCAPTUREDEVICENVPROC) (HDC hDc, HVIDEOINPUTDEVICENV hDevice);
|
||||
typedef BOOL (WINAPI * PFNWGLQUERYVIDEOCAPTUREDEVICENVPROC) (HDC hDc, HVIDEOINPUTDEVICENV hDevice, int iAttribute, int *piValue);
|
||||
typedef BOOL (WINAPI * PFNWGLRELEASEVIDEOCAPTUREDEVICENVPROC) (HDC hDc, HVIDEOINPUTDEVICENV hDevice);
|
||||
#ifdef WGL_WGLEXT_PROTOTYPES
|
||||
BOOL WINAPI wglBindVideoCaptureDeviceNV (UINT uVideoSlot, HVIDEOINPUTDEVICENV hDevice);
|
||||
UINT WINAPI wglEnumerateVideoCaptureDevicesNV (HDC hDc, HVIDEOINPUTDEVICENV *phDeviceList);
|
||||
BOOL WINAPI wglLockVideoCaptureDeviceNV (HDC hDc, HVIDEOINPUTDEVICENV hDevice);
|
||||
BOOL WINAPI wglQueryVideoCaptureDeviceNV (HDC hDc, HVIDEOINPUTDEVICENV hDevice, int iAttribute, int *piValue);
|
||||
BOOL WINAPI wglReleaseVideoCaptureDeviceNV (HDC hDc, HVIDEOINPUTDEVICENV hDevice);
|
||||
#endif
|
||||
#endif /* WGL_NV_video_capture */
|
||||
|
||||
#ifndef WGL_NV_video_output
|
||||
#define WGL_NV_video_output 1
|
||||
DECLARE_HANDLE(HPVIDEODEV);
|
||||
#define WGL_BIND_TO_VIDEO_RGB_NV 0x20C0
|
||||
#define WGL_BIND_TO_VIDEO_RGBA_NV 0x20C1
|
||||
#define WGL_BIND_TO_VIDEO_RGB_AND_DEPTH_NV 0x20C2
|
||||
#define WGL_VIDEO_OUT_COLOR_NV 0x20C3
|
||||
#define WGL_VIDEO_OUT_ALPHA_NV 0x20C4
|
||||
#define WGL_VIDEO_OUT_DEPTH_NV 0x20C5
|
||||
#define WGL_VIDEO_OUT_COLOR_AND_ALPHA_NV 0x20C6
|
||||
#define WGL_VIDEO_OUT_COLOR_AND_DEPTH_NV 0x20C7
|
||||
#define WGL_VIDEO_OUT_FRAME 0x20C8
|
||||
#define WGL_VIDEO_OUT_FIELD_1 0x20C9
|
||||
#define WGL_VIDEO_OUT_FIELD_2 0x20CA
|
||||
#define WGL_VIDEO_OUT_STACKED_FIELDS_1_2 0x20CB
|
||||
#define WGL_VIDEO_OUT_STACKED_FIELDS_2_1 0x20CC
|
||||
typedef BOOL (WINAPI * PFNWGLGETVIDEODEVICENVPROC) (HDC hDC, int numDevices, HPVIDEODEV *hVideoDevice);
|
||||
typedef BOOL (WINAPI * PFNWGLRELEASEVIDEODEVICENVPROC) (HPVIDEODEV hVideoDevice);
|
||||
typedef BOOL (WINAPI * PFNWGLBINDVIDEOIMAGENVPROC) (HPVIDEODEV hVideoDevice, HPBUFFERARB hPbuffer, int iVideoBuffer);
|
||||
typedef BOOL (WINAPI * PFNWGLRELEASEVIDEOIMAGENVPROC) (HPBUFFERARB hPbuffer, int iVideoBuffer);
|
||||
typedef BOOL (WINAPI * PFNWGLSENDPBUFFERTOVIDEONVPROC) (HPBUFFERARB hPbuffer, int iBufferType, unsigned long *pulCounterPbuffer, BOOL bBlock);
|
||||
typedef BOOL (WINAPI * PFNWGLGETVIDEOINFONVPROC) (HPVIDEODEV hpVideoDevice, unsigned long *pulCounterOutputPbuffer, unsigned long *pulCounterOutputVideo);
|
||||
#ifdef WGL_WGLEXT_PROTOTYPES
|
||||
BOOL WINAPI wglGetVideoDeviceNV (HDC hDC, int numDevices, HPVIDEODEV *hVideoDevice);
|
||||
BOOL WINAPI wglReleaseVideoDeviceNV (HPVIDEODEV hVideoDevice);
|
||||
BOOL WINAPI wglBindVideoImageNV (HPVIDEODEV hVideoDevice, HPBUFFERARB hPbuffer, int iVideoBuffer);
|
||||
BOOL WINAPI wglReleaseVideoImageNV (HPBUFFERARB hPbuffer, int iVideoBuffer);
|
||||
BOOL WINAPI wglSendPbufferToVideoNV (HPBUFFERARB hPbuffer, int iBufferType, unsigned long *pulCounterPbuffer, BOOL bBlock);
|
||||
BOOL WINAPI wglGetVideoInfoNV (HPVIDEODEV hpVideoDevice, unsigned long *pulCounterOutputPbuffer, unsigned long *pulCounterOutputVideo);
|
||||
#endif
|
||||
#endif /* WGL_NV_video_output */
|
||||
|
||||
#ifndef WGL_OML_sync_control
|
||||
#define WGL_OML_sync_control 1
|
||||
typedef BOOL (WINAPI * PFNWGLGETSYNCVALUESOMLPROC) (HDC hdc, INT64 *ust, INT64 *msc, INT64 *sbc);
|
||||
typedef BOOL (WINAPI * PFNWGLGETMSCRATEOMLPROC) (HDC hdc, INT32 *numerator, INT32 *denominator);
|
||||
typedef INT64 (WINAPI * PFNWGLSWAPBUFFERSMSCOMLPROC) (HDC hdc, INT64 target_msc, INT64 divisor, INT64 remainder);
|
||||
typedef INT64 (WINAPI * PFNWGLSWAPLAYERBUFFERSMSCOMLPROC) (HDC hdc, int fuPlanes, INT64 target_msc, INT64 divisor, INT64 remainder);
|
||||
typedef BOOL (WINAPI * PFNWGLWAITFORMSCOMLPROC) (HDC hdc, INT64 target_msc, INT64 divisor, INT64 remainder, INT64 *ust, INT64 *msc, INT64 *sbc);
|
||||
typedef BOOL (WINAPI * PFNWGLWAITFORSBCOMLPROC) (HDC hdc, INT64 target_sbc, INT64 *ust, INT64 *msc, INT64 *sbc);
|
||||
#ifdef WGL_WGLEXT_PROTOTYPES
|
||||
BOOL WINAPI wglGetSyncValuesOML (HDC hdc, INT64 *ust, INT64 *msc, INT64 *sbc);
|
||||
BOOL WINAPI wglGetMscRateOML (HDC hdc, INT32 *numerator, INT32 *denominator);
|
||||
INT64 WINAPI wglSwapBuffersMscOML (HDC hdc, INT64 target_msc, INT64 divisor, INT64 remainder);
|
||||
INT64 WINAPI wglSwapLayerBuffersMscOML (HDC hdc, int fuPlanes, INT64 target_msc, INT64 divisor, INT64 remainder);
|
||||
BOOL WINAPI wglWaitForMscOML (HDC hdc, INT64 target_msc, INT64 divisor, INT64 remainder, INT64 *ust, INT64 *msc, INT64 *sbc);
|
||||
BOOL WINAPI wglWaitForSbcOML (HDC hdc, INT64 target_sbc, INT64 *ust, INT64 *msc, INT64 *sbc);
|
||||
#endif
|
||||
#endif /* WGL_OML_sync_control */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
Loading…
Reference in New Issue
Block a user