Make sure the functions won't be called if the extension is not supported. This also clears the main loop a bitsrc/Main/main.cxx.
This commit is contained in:
parent
fb6c04ec7f
commit
484bab7bc8
1 changed files with 7 additions and 5 deletions
|
@ -145,6 +145,7 @@ SG_USING_STD(endl);
|
||||||
|
|
||||||
glPointParameterfProc glPointParameterfPtr = 0;
|
glPointParameterfProc glPointParameterfPtr = 0;
|
||||||
glPointParameterfvProc glPointParameterfvPtr = 0;
|
glPointParameterfvProc glPointParameterfvPtr = 0;
|
||||||
|
bool glPointParameterIsSupported = false;
|
||||||
|
|
||||||
float default_attenuation[3] = {1.0, 0.0, 0.0};
|
float default_attenuation[3] = {1.0, 0.0, 0.0};
|
||||||
//Required for using GL_extensions
|
//Required for using GL_extensions
|
||||||
|
@ -768,8 +769,7 @@ void fgRenderFrame() {
|
||||||
glEnable(GL_POINT_SMOOTH);
|
glEnable(GL_POINT_SMOOTH);
|
||||||
|
|
||||||
if ( fgGetBool("/sim/rendering/distance-attenuation") &&
|
if ( fgGetBool("/sim/rendering/distance-attenuation") &&
|
||||||
( SGIsOpenGLExtensionSupported("GL_EXT_point_parameters") ||
|
glPointParameterIsSupported )
|
||||||
SGIsOpenGLExtensionSupported("GL_ARB_point_parameters") ) )
|
|
||||||
{
|
{
|
||||||
// Enable states for drawing points with GL_extension
|
// Enable states for drawing points with GL_extension
|
||||||
glEnable(GL_POINT_SMOOTH);
|
glEnable(GL_POINT_SMOOTH);
|
||||||
|
@ -823,8 +823,7 @@ void fgRenderFrame() {
|
||||||
|
|
||||||
if (fgGetBool("/sim/rendering/enhanced-lighting")) {
|
if (fgGetBool("/sim/rendering/enhanced-lighting")) {
|
||||||
if ( fgGetBool("/sim/rendering/distance-attenuation") &&
|
if ( fgGetBool("/sim/rendering/distance-attenuation") &&
|
||||||
( SGIsOpenGLExtensionSupported("GL_EXT_point_parameters") ||
|
glPointParameterIsSupported )
|
||||||
SGIsOpenGLExtensionSupported("GL_ARB_point_parameters") ) )
|
|
||||||
{
|
{
|
||||||
glPointParameterfvPtr(GL_DISTANCE_ATTENUATION_EXT,
|
glPointParameterfvPtr(GL_DISTANCE_ATTENUATION_EXT,
|
||||||
default_attenuation);
|
default_attenuation);
|
||||||
|
@ -1657,17 +1656,20 @@ static bool fgMainInit( int argc, char **argv ) {
|
||||||
if ( fgGetBool("/sim/rendering/distance-attenuation") )
|
if ( fgGetBool("/sim/rendering/distance-attenuation") )
|
||||||
{
|
{
|
||||||
if (SGIsOpenGLExtensionSupported("GL_EXT_point_parameters") ) {
|
if (SGIsOpenGLExtensionSupported("GL_EXT_point_parameters") ) {
|
||||||
|
glPointParameterIsSupported = true;
|
||||||
glPointParameterfPtr = (glPointParameterfProc)
|
glPointParameterfPtr = (glPointParameterfProc)
|
||||||
SGLookupFunction("glPointParameterfEXT");
|
SGLookupFunction("glPointParameterfEXT");
|
||||||
glPointParameterfvPtr = (glPointParameterfvProc)
|
glPointParameterfvPtr = (glPointParameterfvProc)
|
||||||
SGLookupFunction("glPointParameterfvEXT");
|
SGLookupFunction("glPointParameterfvEXT");
|
||||||
|
|
||||||
} else if ( SGIsOpenGLExtensionSupported("GL_ARB_point_parameters") ) {
|
} else if ( SGIsOpenGLExtensionSupported("GL_ARB_point_parameters") ) {
|
||||||
|
glPointParameterIsSupported = true;
|
||||||
glPointParameterfPtr = (glPointParameterfProc)
|
glPointParameterfPtr = (glPointParameterfProc)
|
||||||
SGLookupFunction("glPointParameterfARB");
|
SGLookupFunction("glPointParameterfARB");
|
||||||
glPointParameterfvPtr = (glPointParameterfvProc)
|
glPointParameterfvPtr = (glPointParameterfvProc)
|
||||||
SGLookupFunction("glPointParameterfvARB");
|
SGLookupFunction("glPointParameterfvARB");
|
||||||
}
|
} else
|
||||||
|
glPointParameterIsSupported = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// based on the requested presets, calculate the true starting
|
// based on the requested presets, calculate the true starting
|
||||||
|
|
Loading…
Add table
Reference in a new issue