Windows fixes.
This commit is contained in:
parent
7795eb8239
commit
8ed96cad1d
@ -1648,12 +1648,24 @@ bool RenderTexture::_VerifyExtensions()
|
|||||||
if ( !fctPtrInited )
|
if ( !fctPtrInited )
|
||||||
{
|
{
|
||||||
fctPtrInited = true;
|
fctPtrInited = true;
|
||||||
if ( SGIsOpenGLExtensionSupported("WGL_ARB_pixel_format" ) )
|
wglGetExtensionsStringARBProc wglGetExtensionsStringARBPtr = (wglGetExtensionsStringARBProc)wglGetProcAddress( "wglGetExtensionsStringARB" );
|
||||||
|
if ( wglGetExtensionsStringARBPtr == 0 )
|
||||||
|
{
|
||||||
|
PrintExtensionError("WGL_ARB_extensions_string");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
string wglExtensionsString = wglGetExtensionsStringARBPtr( wglGetCurrentDC() );
|
||||||
|
if ( SGSearchExtensionsString( wglExtensionsString.c_str(), "WGL_ARB_pixel_format" ) )
|
||||||
{
|
{
|
||||||
wglChoosePixelFormatARBPtr = (wglChoosePixelFormatARBProc)SGLookupFunction("wglChoosePixelFormatARB");
|
wglChoosePixelFormatARBPtr = (wglChoosePixelFormatARBProc)SGLookupFunction("wglChoosePixelFormatARB");
|
||||||
wglGetPixelFormatAttribivARBPtr = (wglGetPixelFormatAttribivARBProc)SGLookupFunction("wglGetPixelFormatAttribivARB");
|
wglGetPixelFormatAttribivARBPtr = (wglGetPixelFormatAttribivARBProc)SGLookupFunction("wglGetPixelFormatAttribivARB");
|
||||||
}
|
}
|
||||||
if ( SGIsOpenGLExtensionSupported("WGL_ARB_pbuffer" ) )
|
else
|
||||||
|
{
|
||||||
|
PrintExtensionError("WGL_ARB_pixel_format");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if ( SGSearchExtensionsString( wglExtensionsString.c_str(), "WGL_ARB_pbuffer" ) )
|
||||||
{
|
{
|
||||||
wglCreatePbufferARBPtr = (wglCreatePbufferARBProc)SGLookupFunction("wglCreatePbufferARB");
|
wglCreatePbufferARBPtr = (wglCreatePbufferARBProc)SGLookupFunction("wglCreatePbufferARB");
|
||||||
wglGetPbufferDCARBPtr = (wglGetPbufferDCARBProc)SGLookupFunction("wglGetPbufferDCARB");
|
wglGetPbufferDCARBPtr = (wglGetPbufferDCARBProc)SGLookupFunction("wglGetPbufferDCARB");
|
||||||
@ -1661,57 +1673,52 @@ bool RenderTexture::_VerifyExtensions()
|
|||||||
wglReleasePbufferDCARBPtr = (wglReleasePbufferDCARBProc)SGLookupFunction("wglReleasePbufferDCARB");
|
wglReleasePbufferDCARBPtr = (wglReleasePbufferDCARBProc)SGLookupFunction("wglReleasePbufferDCARB");
|
||||||
wglDestroyPbufferARBPtr = (wglDestroyPbufferARBProc)SGLookupFunction("wglDestroyPbufferARB");
|
wglDestroyPbufferARBPtr = (wglDestroyPbufferARBProc)SGLookupFunction("wglDestroyPbufferARB");
|
||||||
}
|
}
|
||||||
if ( SGIsOpenGLExtensionSupported("WGL_ARB_render_texture" ) )
|
else
|
||||||
|
{
|
||||||
|
PrintExtensionError("WGL_ARB_pbuffer");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if ( SGSearchExtensionsString( wglExtensionsString.c_str(), "WGL_ARB_render_texture" ) )
|
||||||
{
|
{
|
||||||
wglBindTexImageARBPtr = (wglBindTexImageARBProc)SGLookupFunction("wglBindTexImageARB");
|
wglBindTexImageARBPtr = (wglBindTexImageARBProc)SGLookupFunction("wglBindTexImageARB");
|
||||||
wglReleaseTexImageARBPtr = (wglReleaseTexImageARBProc)SGLookupFunction("wglReleaseTexImageARB");
|
wglReleaseTexImageARBPtr = (wglReleaseTexImageARBProc)SGLookupFunction("wglReleaseTexImageARB");
|
||||||
}
|
}
|
||||||
}
|
else if ( _bIsTexture )
|
||||||
if (!WGL_ARB_pbuffer)
|
{
|
||||||
{
|
PrintExtensionError("WGL_ARB_render_texture");
|
||||||
PrintExtensionError("WGL_ARB_pbuffer");
|
return false;
|
||||||
return false;
|
}
|
||||||
}
|
if (_bRectangle && !SGIsOpenGLExtensionSupported( "GL_NV_texture_rectangle" ))
|
||||||
if (!WGL_ARB_pixel_format)
|
{
|
||||||
{
|
PrintExtensionError("GL_NV_texture_rectangle");
|
||||||
PrintExtensionError("WGL_ARB_pixel_format");
|
return false;
|
||||||
return false;
|
}
|
||||||
}
|
if (_bFloat && !(SGIsOpenGLExtensionSupported( "GL_NV_float_buffer" ) || SGSearchExtensionsString( wglExtensionsString.c_str(), "WGL_ATI_pixel_format_float" )))
|
||||||
if (_bIsTexture && !WGL_ARB_render_texture)
|
{
|
||||||
{
|
PrintExtensionError("GL_NV_float_buffer or GL_ATI_pixel_format_float");
|
||||||
PrintExtensionError("WGL_ARB_render_texture");
|
return false;
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
if (_bRectangle && !GL_NV_texture_rectangle)
|
if (_bFloat && _bIsTexture && !(SGIsOpenGLExtensionSupported( "GL_NV_float_buffer" ) || SGIsOpenGLExtensionSupported( "GL_ATI_texture_float" )))
|
||||||
{
|
{
|
||||||
PrintExtensionError("GL_NV_texture_rectangle");
|
PrintExtensionError("NV_float_buffer or ATI_texture_float");
|
||||||
return false;
|
}
|
||||||
}
|
if (_bIsDepthTexture && !SGIsOpenGLExtensionSupported( "GL_ARB_depth_texture" ))
|
||||||
if (_bFloat && !(GL_NV_float_buffer || WGL_ATI_pixel_format_float))
|
{
|
||||||
{
|
// [Redge]
|
||||||
PrintExtensionError("GL_NV_float_buffer or GL_ATI_pixel_format_float");
|
|
||||||
return false;
|
|
||||||
|
|
||||||
}
|
|
||||||
if (_bFloat && _bIsTexture && !(GL_NV_float_buffer || GL_ATI_texture_float))
|
|
||||||
{
|
|
||||||
PrintExtensionError("NV_float_buffer or ATI_texture_float");
|
|
||||||
}
|
|
||||||
if (_bIsDepthTexture && !GL_ARB_depth_texture)
|
|
||||||
{
|
|
||||||
// [Redge]
|
|
||||||
#if defined(_DEBUG) | defined(DEBUG)
|
#if defined(_DEBUG) | defined(DEBUG)
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
"RenderTexture Warning: "
|
"RenderTexture Warning: "
|
||||||
"OpenGL extension GL_ARB_depth_texture not available.\n"
|
"OpenGL extension GL_ARB_depth_texture not available.\n"
|
||||||
" Using glReadPixels() to emulate behavior.\n");
|
" Using glReadPixels() to emulate behavior.\n");
|
||||||
#endif
|
#endif
|
||||||
_bHasARBDepthTexture = false;
|
_bHasARBDepthTexture = false;
|
||||||
//PrintExtensionError("GL_ARB_depth_texture");
|
//PrintExtensionError("GL_ARB_depth_texture");
|
||||||
//return false;
|
//return false;
|
||||||
// [/Redge]
|
// [/Redge]
|
||||||
|
}
|
||||||
|
SetLastError(0);
|
||||||
}
|
}
|
||||||
SetLastError(0);
|
|
||||||
#else
|
#else
|
||||||
if (!GLX_SGIX_pbuffer)
|
if (!GLX_SGIX_pbuffer)
|
||||||
{
|
{
|
||||||
|
@ -1,10 +1,18 @@
|
|||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
# include <simgear/simgear_config.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef HAVE_WINDOWS_H
|
||||||
|
# include <windows.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <simgear/compiler.h>
|
#include <simgear/compiler.h>
|
||||||
|
|
||||||
#include SG_GL_H
|
#include SG_GL_H
|
||||||
#include <GL/glut.h>
|
#include <GL/glut.h>
|
||||||
#include <simgear/screen/RenderTexture.h>
|
|
||||||
#include <simgear/screen/extensions.hxx>
|
#include <simgear/screen/extensions.hxx>
|
||||||
|
#include <simgear/screen/RenderTexture.h>
|
||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
@ -27,11 +27,11 @@
|
|||||||
#include "extensions.hxx"
|
#include "extensions.hxx"
|
||||||
#include <simgear/debug/logstream.hxx>
|
#include <simgear/debug/logstream.hxx>
|
||||||
|
|
||||||
static bool SGSearchExtensionsString(char *extString, char *extName) {
|
bool SGSearchExtensionsString(const char *extString, const char *extName) {
|
||||||
// Returns GL_TRUE if the *extName string appears in the *extString string,
|
// Returns GL_TRUE if the *extName string appears in the *extString string,
|
||||||
// surrounded by white spaces, or GL_FALSE otherwise.
|
// surrounded by white spaces, or GL_FALSE otherwise.
|
||||||
|
|
||||||
char *p, *end;
|
const char *p, *end;
|
||||||
int n, extNameLen;
|
int n, extNameLen;
|
||||||
|
|
||||||
if ((extString == NULL) || (extName == NULL))
|
if ((extString == NULL) || (extName == NULL))
|
||||||
@ -60,7 +60,7 @@ bool SGIsOpenGLExtensionSupported(char *extName) {
|
|||||||
// The *extName string must follow the OpenGL extensions naming scheme
|
// The *extName string must follow the OpenGL extensions naming scheme
|
||||||
// (ie: "GL_type_extension", like GL_EXT_convolution)
|
// (ie: "GL_type_extension", like GL_EXT_convolution)
|
||||||
|
|
||||||
return SGSearchExtensionsString((char *)glGetString(GL_EXTENSIONS),extName);
|
return SGSearchExtensionsString((const char *)glGetString(GL_EXTENSIONS),extName);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef __APPLE__
|
#ifdef __APPLE__
|
||||||
|
@ -49,7 +49,7 @@ extern "C" {
|
|||||||
#define APIENTRY
|
#define APIENTRY
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// static bool SGSearchExtensionsString(char *extString, char *extName);
|
bool SGSearchExtensionsString(const char *extString, const char *extName);
|
||||||
bool SGIsOpenGLExtensionSupported(char *extName);
|
bool SGIsOpenGLExtensionSupported(char *extName);
|
||||||
|
|
||||||
#ifdef __APPLE__
|
#ifdef __APPLE__
|
||||||
@ -266,13 +266,25 @@ typedef void (APIENTRY * glClientActiveTextureProc)(GLenum texture);
|
|||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef GL_SGIS_generate_mipmap
|
||||||
|
#define GL_SGIS_generate_mipmap 1
|
||||||
|
#define GL_GENERATE_MIPMAP_SGIS 0x8191
|
||||||
|
#define GL_GENERATE_MIPMAP_HINT_SGIS 0x8192
|
||||||
|
#endif
|
||||||
|
|
||||||
/* WGL spcific OpenGL extenstions */
|
/* WGL spcific OpenGL extenstions */
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* ARB_pbuffer
|
* WGL_ARB_extensions_string
|
||||||
|
*/
|
||||||
|
#ifndef WGL_ARB_extensions_string
|
||||||
|
#define WGL_ARB_extensions_string 1
|
||||||
|
typedef const char * (APIENTRY * wglGetExtensionsStringARBProc) (HDC hDC);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
* WGL_ARB_pbuffer
|
||||||
*/
|
*/
|
||||||
#ifndef WGL_ARB_pbuffer
|
#ifndef WGL_ARB_pbuffer
|
||||||
#define WGL_ARB_pbuffer 1
|
#define WGL_ARB_pbuffer 1
|
||||||
|
Loading…
Reference in New Issue
Block a user