Fixed warnings
This commit is contained in:
parent
33545ab332
commit
c85437e967
@ -78,6 +78,13 @@ inline void* getGLExtensionFuncPtr(const char *funcName,const char *fallbackFunc
|
||||
return getGLExtensionFuncPtr(fallbackFuncName);
|
||||
}
|
||||
|
||||
template<typename T, typename R>
|
||||
T convertPointerType(R src)
|
||||
{
|
||||
T dest;
|
||||
memcpy(&dest, &src, sizeof(src));
|
||||
return dest;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
bool setGLExtensionFuncPtr(T& t, const char* str1)
|
||||
|
@ -267,11 +267,17 @@ class OSG_EXPORT VertexProgram : public StateAttribute
|
||||
|
||||
bool _isVertexProgramSupported;
|
||||
|
||||
void* _glBindProgram;
|
||||
void* _glGenPrograms;
|
||||
void *_glDeletePrograms;
|
||||
void* _glProgramString;
|
||||
void* _glProgramLocalParameter4fv;
|
||||
typedef void (APIENTRY * BindProgramProc) (GLenum target, GLuint id);
|
||||
typedef void (APIENTRY * GenProgramsProc) (GLsizei n, GLuint *programs);
|
||||
typedef void (APIENTRY * DeleteProgramsProc) (GLsizei n, GLuint *programs);
|
||||
typedef void (APIENTRY * ProgramStringProc) (GLenum target, GLenum format, GLsizei len, const void *string);
|
||||
typedef void (APIENTRY * ProgramLocalParameter4fvProc) (GLenum target, GLuint index, const GLfloat *params);
|
||||
|
||||
BindProgramProc _glBindProgram;
|
||||
GenProgramsProc _glGenPrograms;
|
||||
DeleteProgramsProc _glDeletePrograms;
|
||||
ProgramStringProc _glProgramString;
|
||||
ProgramLocalParameter4fvProc _glProgramLocalParameter4fv;
|
||||
|
||||
};
|
||||
|
||||
|
@ -152,7 +152,7 @@ namespace osgAnimation
|
||||
enum State
|
||||
{
|
||||
Play,
|
||||
Stop,
|
||||
Stop
|
||||
};
|
||||
|
||||
State _state;
|
||||
@ -168,7 +168,7 @@ namespace osgAnimation
|
||||
enum State
|
||||
{
|
||||
Play,
|
||||
Stop,
|
||||
Stop
|
||||
};
|
||||
|
||||
|
||||
|
@ -29,7 +29,7 @@ struct GeometryHints
|
||||
{
|
||||
RESIZE_HEIGHT_TO_MAINTAINCE_ASPECT_RATIO,
|
||||
RESIZE_WIDTH_TO_MAINTAINCE_ASPECT_RATIO,
|
||||
IGNORE_DOCUMENT_ASPECT_RATIO,
|
||||
IGNORE_DOCUMENT_ASPECT_RATIO
|
||||
};
|
||||
|
||||
GeometryHints():
|
||||
|
@ -307,6 +307,7 @@ bool osg::isGLUExtensionSupported(unsigned int contextID, const char *extension)
|
||||
#include <dlfcn.h>
|
||||
#endif
|
||||
|
||||
|
||||
void* osg::getGLExtensionFuncPtr(const char *funcName)
|
||||
{
|
||||
#if defined(WIN32)
|
||||
@ -358,10 +359,10 @@ void* osg::getGLExtensionFuncPtr(const char *funcName)
|
||||
|
||||
typedef void (*__GLXextFuncPtr)(void);
|
||||
typedef __GLXextFuncPtr (*GetProcAddressARBProc)(const char*);
|
||||
static GetProcAddressARBProc s_glXGetProcAddressARB = (GetProcAddressARBProc)dlsym(0, "glXGetProcAddressARB");
|
||||
static GetProcAddressARBProc s_glXGetProcAddressARB = convertPointerType<GetProcAddressARBProc, void*>(dlsym(0, "glXGetProcAddressARB"));
|
||||
if (s_glXGetProcAddressARB)
|
||||
{
|
||||
return (void*) (s_glXGetProcAddressARB)(funcName);
|
||||
return convertPointerType<void*, __GLXextFuncPtr>((s_glXGetProcAddressARB)(funcName));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -745,14 +745,14 @@ void State::initializeExtensionProcs()
|
||||
{
|
||||
if (_extensionProcsInitialized) return;
|
||||
|
||||
_glClientActiveTexture = (ActiveTextureProc) osg::getGLExtensionFuncPtr("glClientActiveTexture","glClientActiveTextureARB");
|
||||
_glActiveTexture = (ActiveTextureProc) osg::getGLExtensionFuncPtr("glActiveTexture","glActiveTextureARB");
|
||||
_glFogCoordPointer = (FogCoordPointerProc) osg::getGLExtensionFuncPtr("glFogCoordPointer","glFogCoordPointerEXT");
|
||||
_glSecondaryColorPointer = (SecondaryColorPointerProc) osg::getGLExtensionFuncPtr("glSecondaryColorPointer","glSecondaryColorPointerEXT");
|
||||
_glVertexAttribPointer = (VertexAttribPointerProc) osg::getGLExtensionFuncPtr("glVertexAttribPointer","glVertexAttribPointerARB");
|
||||
_glEnableVertexAttribArray = (EnableVertexAttribProc) osg::getGLExtensionFuncPtr("glEnableVertexAttribArray","glEnableVertexAttribArrayARB");
|
||||
_glDisableVertexAttribArray = (DisableVertexAttribProc) osg::getGLExtensionFuncPtr("glDisableVertexAttribArray","glDisableVertexAttribArrayARB");
|
||||
_glBindBuffer = (BindBufferProc) osg::getGLExtensionFuncPtr("glBindBuffer","glBindBufferARB");
|
||||
setGLExtensionFuncPtr(_glClientActiveTexture,"glClientActiveTexture","glClientActiveTextureARB");
|
||||
setGLExtensionFuncPtr(_glActiveTexture, "glActiveTexture","glActiveTextureARB");
|
||||
setGLExtensionFuncPtr(_glFogCoordPointer, "glFogCoordPointer","glFogCoordPointerEXT");
|
||||
setGLExtensionFuncPtr(_glSecondaryColorPointer, "glSecondaryColorPointer","glSecondaryColorPointerEXT");
|
||||
setGLExtensionFuncPtr(_glVertexAttribPointer, "glVertexAttribPointer","glVertexAttribPointerARB");
|
||||
setGLExtensionFuncPtr(_glEnableVertexAttribArray, "glEnableVertexAttribArray","glEnableVertexAttribArrayARB");
|
||||
setGLExtensionFuncPtr(_glDisableVertexAttribArray, "glDisableVertexAttribArray","glDisableVertexAttribArrayARB");
|
||||
setGLExtensionFuncPtr(_glBindBuffer, "glBindBuffer","glBindBufferARB");
|
||||
|
||||
if ( osg::getGLVersionNumber() >= 2.0 || osg::isGLExtensionSupported(_contextID,"GL_ARB_vertex_shader") )
|
||||
{
|
||||
|
@ -257,19 +257,18 @@ void VertexProgram::Extensions::setupGLExtensions(unsigned int contextID)
|
||||
{
|
||||
_isVertexProgramSupported = isGLExtensionSupported(contextID,"GL_ARB_vertex_program");
|
||||
|
||||
_glBindProgram = osg::getGLExtensionFuncPtr("glBindProgramARB");
|
||||
_glGenPrograms = osg::getGLExtensionFuncPtr("glGenProgramsARB");
|
||||
_glDeletePrograms = osg::getGLExtensionFuncPtr("glDeleteProgramsARB");
|
||||
_glProgramString = osg::getGLExtensionFuncPtr("glProgramStringARB");
|
||||
_glProgramLocalParameter4fv = osg::getGLExtensionFuncPtr("glProgramLocalParameter4fvARB");
|
||||
setGLExtensionFuncPtr(_glBindProgram,"glBindProgramARB");
|
||||
setGLExtensionFuncPtr(_glGenPrograms, "glGenProgramsARB");
|
||||
setGLExtensionFuncPtr(_glDeletePrograms, "glDeleteProgramsARB");
|
||||
setGLExtensionFuncPtr(_glProgramString, "glProgramStringARB");
|
||||
setGLExtensionFuncPtr(_glProgramLocalParameter4fv, "glProgramLocalParameter4fvARB");
|
||||
}
|
||||
|
||||
void VertexProgram::Extensions::glBindProgram(GLenum target, GLuint id) const
|
||||
{
|
||||
if (_glBindProgram)
|
||||
{
|
||||
typedef void (APIENTRY * BindProgramProc) (GLenum target, GLuint id);
|
||||
((BindProgramProc)_glBindProgram)(target,id);
|
||||
_glBindProgram(target,id);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -281,8 +280,7 @@ void VertexProgram::Extensions::glGenPrograms(GLsizei n, GLuint *programs) const
|
||||
{
|
||||
if (_glGenPrograms)
|
||||
{
|
||||
typedef void (APIENTRY * GenProgramsProc) (GLsizei n, GLuint *programs);
|
||||
((GenProgramsProc)_glGenPrograms)(n,programs);
|
||||
_glGenPrograms(n,programs);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -294,8 +292,7 @@ void VertexProgram::Extensions::glDeletePrograms(GLsizei n, GLuint *programs) co
|
||||
{
|
||||
if (_glDeletePrograms)
|
||||
{
|
||||
typedef void (APIENTRY * DeleteProgramsProc) (GLsizei n, GLuint *programs);
|
||||
((DeleteProgramsProc)_glDeletePrograms)(n,programs);
|
||||
_glDeletePrograms(n,programs);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -307,8 +304,7 @@ void VertexProgram::Extensions::glProgramString(GLenum target, GLenum format, GL
|
||||
{
|
||||
if (_glProgramString)
|
||||
{
|
||||
typedef void (APIENTRY * ProgramStringProc) (GLenum target, GLenum format, GLsizei len, const void *string);
|
||||
((ProgramStringProc)_glProgramString)(target,format, len, string);
|
||||
_glProgramString(target,format, len, string);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -320,8 +316,7 @@ void VertexProgram::Extensions::glProgramLocalParameter4fv(GLenum target, GLuint
|
||||
{
|
||||
if (_glProgramLocalParameter4fv)
|
||||
{
|
||||
typedef void (APIENTRY * ProgramLocalParameter4fvProc) (GLenum target, GLuint index, const GLfloat *params);
|
||||
((ProgramLocalParameter4fvProc)_glProgramLocalParameter4fv)(target, index, params);
|
||||
_glProgramLocalParameter4fv(target, index, params);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -57,6 +57,7 @@ bool HDRLoader::isHDRFile(const char *_fileName)
|
||||
|
||||
char str[10];
|
||||
fread(str, 10, 1, file);
|
||||
|
||||
fclose(file);
|
||||
|
||||
if (memcmp(str, "#?RADIANCE", 10) && memcmp(str, "#?RGBE", 6))
|
||||
|
@ -42,12 +42,15 @@ void Input::_calculateSize(const XYCoord& size) {
|
||||
// An Input cannot currently set it's own size RELIABLY until the osgText implementation
|
||||
// is dratiscally improved. I'm getting wildly crazy results. :(
|
||||
// point_type height = size.y() > _cursor->getHeight() ? size.y() : _cursor->getHeight();
|
||||
|
||||
#if 0
|
||||
point_type width = size.x() + _cursor->getWidth();
|
||||
point_type height = _cursor->getHeight();
|
||||
|
||||
// if(width > getWidth()) setWidth(osg::round(width));
|
||||
if(width > getWidth()) setWidth(osg::round(width));
|
||||
|
||||
// if(height > getHeight()) setHeight(osg::round(height));
|
||||
if(height > getHeight()) setHeight(osg::round(height));
|
||||
#endif
|
||||
}
|
||||
|
||||
void Input::_calculateCursorOffsets() {
|
||||
@ -99,10 +102,7 @@ void Input::positioned() {
|
||||
|
||||
ln = ln == 0.0f ? 1.0f : ln;
|
||||
|
||||
point_type th =
|
||||
(_text->getCharacterHeight() * ln) +
|
||||
(_text->getLineSpacing() * (ln - 1.0f))
|
||||
;
|
||||
// point_type th = (_text->getCharacterHeight() * ln) + (_text->getLineSpacing() * (ln - 1.0f));
|
||||
|
||||
point_type x = getX() + _xoff;
|
||||
point_type y = getY() + _yoff;
|
||||
|
Loading…
Reference in New Issue
Block a user