From Marco Jez, addition of glw extension checking under Windows, and tweaks to
BlendEquation and RenderStage to correct the extensions being tested.
This commit is contained in:
@@ -108,8 +108,8 @@ void BlendEquation::Extensions::setupGLExtenions(unsigned int contextID)
|
||||
_isBlendEquationSupported = isGLExtensionSupported(contextID,"GL_EXT_blend_equation") ||
|
||||
strncmp((const char*)glGetString(GL_VERSION),"1.2",3)>=0;
|
||||
|
||||
_isSGIXMinMaxSupported = isGLExtensionSupported(contextID, "SGIX_blend_alpha_minmax");
|
||||
_isLogicOpSupported = isGLExtensionSupported(contextID, "EXT_blend_logic_op");
|
||||
_isSGIXMinMaxSupported = isGLExtensionSupported(contextID, "GL_SGIX_blend_alpha_minmax");
|
||||
_isLogicOpSupported = isGLExtensionSupported(contextID, "GL_EXT_blend_logic_op");
|
||||
|
||||
_glBlendEquation = getGLExtensionFuncPtr("glBlendEquation", "glBlendEquationEXT");
|
||||
}
|
||||
|
||||
@@ -24,6 +24,10 @@
|
||||
#include <vector>
|
||||
#include <set>
|
||||
|
||||
#if defined(WIN32)
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
bool osg::isGLExtensionSupported(unsigned int contextID, const char *extension)
|
||||
{
|
||||
typedef std::set<std::string> ExtensionSet;
|
||||
@@ -56,6 +60,44 @@ bool osg::isGLExtensionSupported(unsigned int contextID, const char *extension)
|
||||
startOfWord = endOfWord+1;
|
||||
}
|
||||
if (*startOfWord!=0) extensionSet.insert(std::string(startOfWord));
|
||||
|
||||
#if defined(WIN32)
|
||||
|
||||
// add WGL extensions to the list
|
||||
|
||||
typedef const char* WINAPI WGLGETEXTENSIONSSTRINGARB(HDC);
|
||||
WGLGETEXTENSIONSSTRINGARB* wglGetExtensionsStringARB =
|
||||
(WGLGETEXTENSIONSSTRINGARB*)getGLExtensionFuncPtr("wglGetExtensionsStringARB");
|
||||
|
||||
typedef const char* WINAPI WGLGETEXTENSIONSSTRINGEXT();
|
||||
WGLGETEXTENSIONSSTRINGEXT* wglGetExtensionsStringEXT =
|
||||
(WGLGETEXTENSIONSSTRINGEXT*)getGLExtensionFuncPtr("wglGetExtensionsStringEXT");
|
||||
|
||||
const char* wglextensions = 0;
|
||||
|
||||
if (wglGetExtensionsStringARB)
|
||||
{
|
||||
HDC dc = wglGetCurrentDC();
|
||||
wglextensions = wglGetExtensionsStringARB(dc);
|
||||
}
|
||||
else if (wglGetExtensionsStringEXT)
|
||||
{
|
||||
wglextensions = wglGetExtensionsStringEXT();
|
||||
}
|
||||
|
||||
if (wglextensions)
|
||||
{
|
||||
const char* startOfWord = wglextensions;
|
||||
const char* endOfWord;
|
||||
while ((endOfWord = strchr(startOfWord, ' ')))
|
||||
{
|
||||
extensionSet.insert(std::string(startOfWord, endOfWord));
|
||||
startOfWord = endOfWord+1;
|
||||
}
|
||||
if (*startOfWord != 0) extensionSet.insert(std::string(startOfWord));
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
osg::notify(INFO)<<"OpenGL extensions supported by installed OpenGL drivers are:"<<std::endl;
|
||||
for(ExtensionSet::iterator itr=extensionSet.begin();
|
||||
|
||||
@@ -373,7 +373,7 @@ void RenderStage::runCameraSetUp(osg::State& state)
|
||||
|
||||
// check whether PBuffer-RTT is supported or not
|
||||
if (renderTargetImplemntation==osg::CameraNode::PIXEL_BUFFER_RTT &&
|
||||
!osg::isGLExtensionSupported(state.getContextID(), "ARB_render_texture"))
|
||||
!osg::isGLExtensionSupported(state.getContextID(), "WGL_ARB_render_texture"))
|
||||
{
|
||||
if (renderTargetImplemntation<renderTargetFallback)
|
||||
renderTargetImplemntation = renderTargetFallback;
|
||||
|
||||
Reference in New Issue
Block a user