本文整理汇总了C++中ofShader::setAttribute3f方法的典型用法代码示例。如果您正苦于以下问题:C++ ofShader::setAttribute3f方法的具体用法?C++ ofShader::setAttribute3f怎么用?C++ ofShader::setAttribute3f使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ofShader
的用法示例。
在下文中一共展示了ofShader::setAttribute3f方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: drawCenteredForDOF
void helix::drawCenteredForDOF( ofShader & dofShader, bool bDrawInner, bool bDrawOuter ){
GLint sideLocation = dofShader.getAttributeLocation("side");
GLint nextLocation = dofShader.getAttributeLocation("next");
ofPoint midPt;
int count = 0;
for (int i = 0; i < helix0.size(); i++){
midPt += helix0[i];
count++;
}
for (int i = 0; i < helix1.size(); i++){
midPt += helix1[i];
count++;
}
for (int i = 0; i < lines.size(); i++){
midPt += lines[i].a;
midPt += lines[i].b;
count += 2;
}
midPt /= (float)count;
ofPushMatrix();
ofTranslate(-midPt.x, -midPt.y, -midPt.z);
if (bDrawOuter){
glBegin(GL_TRIANGLE_STRIP);
for (int i = 0; i < helix0.size()-1; i++){
ofPoint cur = helix0[i];
ofPoint next = helix0[i+1];
ofPoint temp0 = cur;
ofPoint temp1 = next;
temp0.normalize();
temp1.normalize();
ofPoint normal = temp0.cross(temp1).normalize();
dofShader.setAttribute1f(sideLocation, -.5);
dofShader.setAttribute3f(nextLocation, next.x, next.y, next.z);
//glNormal3f(normal.x, normal.y, normal.y);
glVertex3f(cur.x, cur.y, cur.z);
dofShader.setAttribute1f(sideLocation, +.5);
dofShader.setAttribute3f(nextLocation, next.x, next.y, next.z);
//glNormal3f(normal.x, normal.y, normal.y);
glVertex3f(cur.x, cur.y, cur.z);
}
glEnd();
glBegin(GL_TRIANGLE_STRIP);
for (int i = 0; i < helix1.size()-1; i++){
ofPoint cur = helix1[i];
ofPoint next = helix1[i+1];
ofPoint temp0 = cur;
ofPoint temp1 = next;
temp0.normalize();
temp1.normalize();
ofPoint normal = temp0.cross(temp1).normalize();
dofShader.setAttribute1f(sideLocation, -.5);
dofShader.setAttribute3f(nextLocation, next.x, next.y, next.z);
//glNormal3f(normal.x, normal.y, normal.y);
glVertex3f(cur.x, cur.y, cur.z);
dofShader.setAttribute1f(sideLocation, +.5);
dofShader.setAttribute3f(nextLocation, next.x, next.y, next.z);
//glNormal3f(normal.x, normal.y, normal.y);
glVertex3f(cur.x, cur.y, cur.z);
}
glEnd();
}
if (bDrawInner)
for (int i = 0; i < lines.size(); i++){
//.........这里部分代码省略.........