
Wed, 11/03/2021 - 13:43
Hello,
When I use the opengl primitives in opencascade based application, according to ViewerTest_OpenGlCommands.cxx file, Below is a snippet of the code.
He did draw what I wanted, but it was blocked by two triangle primitives , and I could see the following elements from the gap, such as the coordinate axis and the elements I drew, and an error occurred at the same time."FBO blitting has failed".
what should I do? Thanks a lot.
//Header
class UserDrawObj : public AIS_InteractiveObject
{
public:
UserDrawObj();
// Called by VUserDrawElement
void Render(const Handle(OpenGl_Workspace)& theWorkspace) const;
private:
NodeGroup* m_pRoot = nullptr
};
//Cpp
void UserDrawObj::Render(const Handle(OpenGl_Workspace)& theWorkspace) const
{
Handle(OpenGl_Context) aCtx = theWorkspace->GetGlContext();
aCtx->BindProgram(Handle(OpenGl_ShaderProgram)());
aCtx->ShaderManager()->PushState(Handle(OpenGl_ShaderProgram)());
if (nullptr != m_pRoot)
{
m_pRoot->display();
}
}
Error:
FBO blitting has failed [# 1280]
Please check your graphics driver settings or try updating driver.
MSAA settings should not be overridden by driver!
Wed, 11/03/2021 - 15:00
What does the following code?
Thu, 11/04/2021 - 06:22
Hi Kirill, thank you very much for your reply.
The main work done in "Display" is the drawing work of Opengl. Previously, it was drawn directly in QOpenGLWidget, and the display can run normally. Now I want to migrate to OCC, and the above problem occurs.
Problems have been found, mainly
glPolygonMode(GL_FRONT, GL_LINE);
glPolygonMode(GL_BACK, GL_FILL);
When I comment this code, it can be displayed normally.
Will this affect the drawing of Occ?
Mon, 11/08/2021 - 10:32
OpenGL context has a global state shared between OCCT renderer and your application. When important state modifications remain hidden to one of the sides, bad things may happen. The main steps to avoid such issues:
So that in particular case, at the end of you custom OpenGL rendering code you may revert glPolygonMode() state to OCCT state:
Note that OpenGl_Context caches many OpenGL states to reduce overall amount of low-level OpenGL calls, which could reduce performance otherwise.