Commit 21f7a420 by Kai Westerkamp

richtigen vertecies nehmen...

parent e56887c7
......@@ -213,7 +213,7 @@ void MainWidget::paintGL(){
rot.rotate(time/100.0*36/5,QVector3D(0,1,0));
}
if(subdivLevel>0){
regularShader->bind();
regularShader->setUniformValue("wireframe",wireframe);
regularShader->setUniformValue("colorTexture",0);
......@@ -224,6 +224,7 @@ void MainWidget::paintGL(){
regularShader->release();
}
subdevisionShader->bind();
......
......@@ -458,18 +458,22 @@ void Mesh::renderMesh(QOpenGLShaderProgram *shader, int index, int subdivision,
std::shared_ptr<SubdivEntry> entry = entries[index].buffers[subdivision];
// Draw Vertex Array
f->glBindBuffer(GL_ARRAY_BUFFER, entry->VB_handle);
f->glVertexAttribPointer(positionIndex, 3, GL_FLOAT, GL_FALSE, sizeof(Vertex), 0);
// qDebug()<<"Render"<<subdivision<<entry->indices;
if(regular){
f->glBindBuffer(GL_ARRAY_BUFFER, entries[index].buffers[subdivision-1]->VB_handle);
f->glVertexAttribPointer(positionIndex, 3, GL_FLOAT, GL_FALSE, sizeof(Vertex), 0);
f->glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, entry->IB_Regular);
f->glPatchParameteri(GL_PATCH_VERTICES, 12);
f->glDrawElements(GL_PATCHES, entry->indicesRegular.size(), GL_UNSIGNED_INT, 0);
} else{
f->glBindBuffer(GL_ARRAY_BUFFER, entry->VB_handle);
f->glVertexAttribPointer(positionIndex, 3, GL_FLOAT, GL_FALSE, sizeof(Vertex), 0);
f->glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, entry->IB_handle);
f->glPatchParameteri(GL_PATCH_VERTICES, 3);
f->glDrawElements(GL_PATCHES, entry->indices.size(), GL_UNSIGNED_INT, 0);
......
......@@ -12,7 +12,7 @@ void main()
tcPosition[gl_InvocationID] = vPosition[gl_InvocationID];
float tesselation = subdiv+6;
float tesselation = subdiv+15;
gl_TessLevelOuter[0] = tesselation;
gl_TessLevelOuter[1] = tesselation;
......
......@@ -59,11 +59,12 @@ void main()
vec3 newPos= a0*p0+a1*p1+a2*p2+a3*p3+a4*p4+a5*p5+a6*p6+a7*p7+a8*p8+a9*p9+a10*p10+a11*p11;
vec4 pos = vec4(newPos/12,1);
// vec3 d0 = gl_TessCoord.x * p3;
// vec3 d1 = gl_TessCoord.y * p6;
// vec3 d2 = gl_TessCoord.z * p7;
// pos = vec4((d0 + d1 + d2),1);
/*
vec3 d0 = gl_TessCoord.x * p3;
vec3 d1 = gl_TessCoord.y * p6;
vec3 d2 = gl_TessCoord.z * p7;
pos = vec4((d0 + d1 + d2),1);
*/
tePatchDistance = gl_TessCoord.xyz;
teCamPosition = vec4(MV*pos).xyz;
......
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