原因是什么?
这个错误只出现一次,并且是在第一帧时出现。
Warning: detected OpenGL error 'invalid operation' after applying attribute Viewport 04292398
应该是执行报错
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) );
}
https://osg-users.openscenegraph.narkive.com/WV8ZHDLd/debugging-warning-detected-opengl-error-invalid-value-after-renderbin-draw
pState->setCheckForGLErrors(osg::State::CheckForGLErrors::ONCE_PER_ATTRIBUTE)
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
};
默认为:ONCE_PER_FRAME