出现这个错误的原因主要是设置了opengl识别不了的uniform导致。比灯光,深度测试等等,关闭这些uniform可以消除这个错误。否则就得自己定义uniform,不要使用osg自带的uniform字段。
关闭打印
#include <osg\State>
osg::setNotifyLevel(osg::NotifySeverity::ALWAYS);
转发自:https://www.cnblogs.com/lyggqm/p/14558219.html
出现错误的地方;
转发自:https://blog.csdn.net/hankern/article/details/112552654
osg/Viewport.cpp
void Viewport::apply(State&) const
{
glViewport( static_cast<GLint>(_x),static_cast<GLint>(_y),
static_cast<GLsizei>(_width),static_cast<GLsizei>(_height) );
}
osg/State
enum CheckForGLErrors
{
/** NEVER_CHECK_GL_ERRORS hints that OpenGL need not be checked for, this
is the fastest option since checking for errors does incur a small overhead.*/
NEVER_CHECK_GL_ERRORS,
/** ONCE_PER_FRAME means that OpenGL errors will be checked for once per
frame, the overhead is still small, but at least OpenGL errors that are occurring
will be caught, the reporting isn't fine grained enough for debugging purposes.*/
ONCE_PER_FRAME,
/** ONCE_PER_ATTRIBUTE means that OpenGL errors will be checked for after
every attribute is applied, allow errors to be directly associated with
particular operations which makes debugging much easier.*/
ONCE_PER_ATTRIBUTE
};