Added support for injecting GL_VENDOR strings into GLSL shaders via the new #pragma(tic) shader composition

git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@15078 16af8721-9629-0410-8352-f15c8da7e697
This commit is contained in:
Robert Osfield 2015-08-10 17:42:05 +00:00
parent 8ab27a20d2
commit aff6e112ec
2 changed files with 15 additions and 1 deletions

View File

@ -1592,7 +1592,8 @@ class OSG_EXPORT State : public Referenced
{
typedef std::vector<StateSet::DefinePair> DefineVec;
DefineStack() {}
DefineStack():
changed(false) {}
void print(std::ostream& fout) const;

View File

@ -19,6 +19,7 @@
#include <osg/ApplicationUsage>
#include <sstream>
#include <algorithm>
#ifndef GL_MAX_TEXTURE_COORDS
#define GL_MAX_TEXTURE_COORDS 0x8871
@ -953,6 +954,18 @@ void State::setInterleavedArrays( GLenum format, GLsizei stride, const GLvoid* p
void State::initializeExtensionProcs()
{
if (_extensionProcsInitialized) return;
const char* vendor = (const char*) glGetString( GL_VENDOR );
if (vendor)
{
std::string str_vendor(vendor);
std::replace(str_vendor.begin(), str_vendor.end(), ' ', '_');
OSG_INFO<<"GL_VENDOR = ["<<str_vendor<<"]"<<std::endl;
_defineMap.map[str_vendor].defineVec.push_back(osg::StateSet::DefinePair("1",osg::StateAttribute::ON));
_defineMap.map[str_vendor].changed = true;
_defineMap.changed = true;
}
_glExtensions = new GLExtensions(_contextID);
GLExtensions::Set(_contextID, _glExtensions.get());