Commit c0fb21c3 authored by Tobias WEBER's avatar Tobias WEBER

some checks

parent 833d8831
......@@ -85,7 +85,7 @@ GlPlot_impl::~GlPlot_impl()
obj.m_pvertexbuf.reset();
obj.m_pnormalsbuf.reset();
obj.m_pcolorbuf.reset();
pGl->glDeleteVertexArrays(1, &obj.m_vertexarr);
if(pGl) pGl->glDeleteVertexArrays(1, &obj.m_vertexarr);
}
m_objs.clear();
......@@ -158,6 +158,7 @@ GlPlotObj GlPlot_impl::CreateTriangleObject(const std::vector<t_vec3_gl>& verts,
qgl_funcs* pGl = GetGlFunctions();
GLint attrVertex = m_attrVertex;
GLint attrVertexNormal = m_attrVertexNorm;
GLint attrVertexColor = m_attrVertexCol;
......@@ -773,7 +774,11 @@ void GlPlot_impl::resizeGL()
const int w = m_iScreenDims[0];
const int h = m_iScreenDims[1];
if(auto *pContext = ((QOpenGLWidget*)m_pPlot)->context(); !pContext) return;
if(auto *pContext = ((QOpenGLWidget*)m_pPlot)->context(); !pContext)
return;
auto *pGl = GetGlFunctions();
if(!pGl)
return;
m_matViewport = m::hom_viewport<t_mat_gl>(w, h, 0., 1.);
std::tie(m_matViewport_inv, std::ignore) = m::inv<t_mat_gl>(m_matViewport);
......@@ -782,7 +787,6 @@ void GlPlot_impl::resizeGL()
//m_matPerspective = m::hom_ortho<t_mat_gl>(0.01, 100., -t_real_gl(w)*0.0025, t_real_gl(w)*0.0025, -t_real_gl(h)*0.0025, t_real_gl(h)*0.0025);
std::tie(m_matPerspective_inv, std::ignore) = m::inv<t_mat_gl>(m_matPerspective);
auto *pGl = GetGlFunctions();
pGl->glViewport(0, 0, w, h);
pGl->glDepthRange(0, 1);
......@@ -1126,6 +1130,9 @@ void GlPlot_impl::tick(const std::chrono::milliseconds& ms)
*/
void GlPlot_impl::DoPaintGL(qgl_funcs *pGl)
{
if(!pGl)
return;
// clear
pGl->glClearColor(1., 1., 1., 1.);
pGl->glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
......@@ -1300,7 +1307,6 @@ void GlPlot_impl::paintGL()
auto *pGl = GetGlFunctions();
painter.beginNativePainting();
DoPaintGL(pGl);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment