Commit 429de903 by Kai Westerkamp

workaround for deleting bug

parent 61f40d18
......@@ -220,10 +220,25 @@ void MainWidget::paintGL(){
mesh->render(subdevisionShader,cam->getMatrix()*rot, m_projection,subdivLevel,false);
//glEnable (GL_BLEND);
//glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
if(subdivLevel>0){
glEnable (GL_BLEND);
glDepthMask(GL_FALSE);
glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
subdevisionShader->setUniformValue("wireframe",false);
mesh->render(subdevisionShader,cam->getMatrix()*rot, m_projection,0,false);
glDisable(GL_BLEND);
glDepthMask(GL_TRUE);
}
subdevisionShader->release();
update();
}
......
......@@ -15,11 +15,11 @@ Mesh::SubdivEntry::SubdivEntry()
Mesh::SubdivEntry::~SubdivEntry()
{
f->glDeleteBuffers(1, &VB_handle);
qDebug()<<"FIXME: Delete Called: num vertex:"<<vertices.size();
/*f->glDeleteBuffers(1, &VB_handle);
f->glDeleteBuffers(1, &IB_handle);
f->glDeleteBuffers(1, &IB_Regular);
*/
}
......@@ -103,7 +103,8 @@ void Mesh::MeshEntry::init(QOpenGLFunctions_4_3_Core *f,QVector<Vertex>& Vertice
void Mesh::MeshEntry::update(GLuint VB, QVector<Vertex>& Vertices, QVector<unsigned int>& Indices){
buffers.resize(buffers.size()+1);
buffers[buffers.size()-1].init(f,VB,Vertices,Indices);
SubdivEntry *entry = &buffers[buffers.size()-1];
entry->init(f,VB,Vertices,Indices);
}
Mesh::MeshEntry::~MeshEntry()
......
#version 430
layout(location = 0) out vec3 color;
#define ALPHA 0.15
layout(location = 0) out vec4 color;
in vec3 gCamPosition;
in vec3 gCamNormal;
......@@ -48,12 +51,12 @@ void addWireframe(){
if( wireframe == true){
float d = min(gTriDistance.x,min(gTriDistance.y,gTriDistance.z));
if(d < 0.02){
color = vec3(0.0,1.0,0.0);
color = vec4(0.0,1.0,0.0,ALPHA);
}
float d2 = min(gPatchDistance.x,min(gPatchDistance.y,gPatchDistance.z));
if(d2 < 0.01){
color = vec3(0.0,0.0,1.0);
color = vec4(0.0,0.0,1.0,ALPHA);
}
}
}
......@@ -62,7 +65,7 @@ void addWireframe(){
void main()
{
color = phong(LightPos);
color = vec4(phong(LightPos),ALPHA);
//color = abs(normalize(gCamNormal));
addWireframe();
......
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