本文整理汇总了C++中ofMesh::draw方法的典型用法代码示例。如果您正苦于以下问题:C++ ofMesh::draw方法的具体用法?C++ ofMesh::draw怎么用?C++ ofMesh::draw使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ofMesh
的用法示例。
在下文中一共展示了ofMesh::draw方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: drawChunkyCloud
void drawChunkyCloud(ofMesh& mesh, ofColor color, int innerRadius = 1, int outerRadius = 3) {
ofPushStyle();
ofSetColor(0);
glPointSize(outerRadius);
mesh.draw();
ofSetColor(color);
glPointSize(innerRadius);
mesh.draw();
ofPopStyle();
}
示例2: draw
void draw() {
ofBackground(0);
glPointSize(2);
ofSetColor(32);
historyMesh.draw();
ofSetColor(255);
dataMesh.draw();
ofSetColor(255, 0, 0);
neighborsMesh.draw();
for(int i = 0; i < neighborsMesh.getNumVertices(); i++) {
ofLine(neighborsMesh.getVertex(i), ofVec2f(mouseX, mouseY));
}
ofDrawBitmapStringHighlight(ofToString(neighborsMesh.getNumVertices()), mouseX, mouseY);
drawFramerate();
}
示例3: ofDrawBitmapCharacterEnd
//---------------------------------------------------------------------
void ofDrawBitmapCharacterEnd(){
if( vC > 0 ){
charMesh.getVertices().resize(vC);
charMesh.getTexCoords().resize(vC);
bitmappedFontTexture.bind();
ofPtr<ofGLProgrammableRenderer> programmableRenderer = ofGetGLProgrammableRenderer();
if (!programmableRenderer){
#ifndef TARGET_OPENGLES
// this temporarily enables alpha testing,
// which discards pixels unless their alpha is 1.0f
glPushAttrib(GL_ENABLE_BIT | GL_COLOR_BUFFER_BIT);
glEnable(GL_ALPHA_TEST);
glAlphaFunc(GL_GREATER, 0);
#endif
}else{
// glPush/PopAttrib is deprecated + we are doing the alpha test through a shader
programmableRenderer->setAlphaBitmapText(true);
}
charMesh.draw();
if (!programmableRenderer){
#ifndef TARGET_OPENGLES
glPopAttrib();
#endif
}else{
programmableRenderer->setAlphaBitmapText(false);
}
bitmappedFontTexture.unbind();
}
}
示例4: ofxNDCircularGradient
void ofxNDCircularGradient(float radius, const ofColor & start, const ofColor & end)
{
int n = 32; // circular gradient resolution
static ofMesh _nd_cg_mesh;
_nd_cg_mesh.clear();
_nd_cg_mesh.setMode(OF_PRIMITIVE_TRIANGLE_FAN);
ofVec2f center(0,0);
_nd_cg_mesh.addVertex(center);
float angleBisector = TWO_PI / (n * 2);
float smallRadius = radius;
float bigRadius = smallRadius / cos(angleBisector);
for(int i = 0; i <= n; i++) {
float theta = i * TWO_PI / n;
_nd_cg_mesh.addVertex(center + ofVec2f(sin(theta), cos(theta)) * bigRadius);
}
_nd_cg_mesh.clearColors();
_nd_cg_mesh.addColor(start);
for(int i = 0; i <= n; i++) {
_nd_cg_mesh.addColor(end);
}
_nd_cg_mesh.draw();
}
示例5: draw
void draw()
{
ofEnableDepthTest();
cam.begin();
mesh.draw();
cam.end();
}
示例6: draw
//--------------------------------------------------------------
void testApp::draw(){
fbo.begin();
ofSetTextureWrap(GL_REPEAT,GL_REPEAT);
fbfbo.draw(0,2);
//cam.draw(0,0);
fbfbo.getTextureReference().bind();
trik2.draw();
fbfbo.getTextureReference().unbind();
ofSetColor(255,255,255);
if(tritimer>tritimerlimit){
float xpt, ypt,xtoff,ytoff;
//draw gradient splashes
ofMesh trik;
for(int b = 0;b<5;b++){
xtoff = ofRandomf()*0.5;
ytoff = ofRandomf()*0.5;
for(int i=0;i<3;i++){
xpt = ofRandomuf()*2+xtoff;
ypt = ofRandomuf()*2+ytoff;
trik.addVertex(ofVec3f(xpt*w,ypt*h,0));
trik.addColor(ofFloatColor(float(ofRandomuf()>0.5)*0.6+0.4,float(ofRandomuf()>0.5)*0.5+0.5,float(ofRandomuf()>0.5)*0.7+0.3));
}
}
trik.draw();
tritimer = 0;
tritimerlimit= ofRandom(20,200);
}
if(tritimer2>45){
//re-generate the feedback triangles
float xpt, ypt,xoff,yoff,xtoff,ytoff;
trik2.clear();
//ofEnableNormalizedTexCoords();
for(int b = 0;b<5;b++){
xoff = ofRandomf()*0.1;
yoff = ofRandomf()*0.1;
xtoff = ofRandomf()*0.5;
ytoff = ofRandomf()*0.5;
for(int i=0;i<3;i++){
xpt = ofRandomuf()+xtoff;
ypt = ofRandomuf()+ytoff;
trik2.addVertex(ofVec3f((xpt+xoff)*w,(ypt+yoff)*h,0));
trik2.addTexCoord(ofVec2f(xpt*w,ypt*h));
trik2.addColor(ofFloatColor(1,1,1));
}
}
tritimer2=0;
tritimer2limit= ofRandom(20,200);
//ofDisableNormalizedTexCoords();
}
fbo.end();
fbfbo.begin();
fbo.draw(0,0);
fbfbo.end();
fbo.draw(0,0);
}
示例7: drawBuffer
float Graph::drawBuffer(ofMesh& line, float threshold, ofRectangle& from, ofRectangle& to) {
ofPushMatrix();
glMap(from, to);
line.draw();
if(threshold != 0) {
float clampedThreshold = ofClamp(threshold, from.y, from.y + from.height);
ofLine(from.x, clampedThreshold, from.width, clampedThreshold);
}
ofPopMatrix();
}
示例8: draw
void draw() {
ofBackground(100);
cam.begin();
ofSetColor(ofRandom(255), ofRandom(255),ofRandom(255));
ofDrawBox(0, 0, 0, 200, 200, 200);
ofTranslate(-128, -128, -128);
mesh.draw();
cam.end();
}
示例9: draw
void draw() {
ofBackground(0);
cam.begin();
ofSetLineWidth(2);
ofSetColor(ofColor::red, 16);
mesh.drawWireframe();
glPointSize(4);
ofSetColor(ofColor::white);
controlPoints.draw();
cam.end();
}
示例10: draw
void draw()
{
ofEnableDepthTest();
cam.begin();
light0.enable();
light1.enable();
ofScale(0.3, 0.3, 0.3);
mesh.draw();
cam.end();
}
示例11: drawMesh
void ofApp::drawMesh(ofMesh& m, ofFloatColor color){
if(showFilled){
ofSetColor(color);
ofEnableDepthTest();
ofEnableLighting();
m.draw();
}
if(showWireframe){
ofDisableLighting();
ofSetColor(0);
glDepthFunc(GL_LEQUAL);
m.drawWireframe();
}
glDepthFunc(GL_LESS);
ofDisableLighting();
}
示例12: drawMesh
void BGGraphics::drawMesh(ofMesh & mesh, ofVec2f nodeLocation, float nodeRadius, float nodeDepth, bool isExternal, bool deform, ofVec2f surfaceNormal) {
if(depthTest)
ofEnableDepthTest();
else
ofDisableDepthTest();
float revealParam = 0.0;
float winParam = -1.0;
float flowStartTime = .1;
float assimilateStartTime = .4;
float burstStartTime = .8;
if(mRevealParameter < flowStartTime) {
revealParam = 0.0;
winParam = -1;
}
else if(mRevealParameter < assimilateStartTime) {
float t = (mRevealParameter - flowStartTime) / (assimilateStartTime - flowStartTime);
revealParam = .5 - .5 * cos(t * M_PI);
winParam = - 1;
}
else if(mRevealParameter < burstStartTime) {
float t = (mRevealParameter - assimilateStartTime) / (burstStartTime - assimilateStartTime);
revealParam = 1.0;
winParam = -1 + t;
}
else {
float t = (mRevealParameter - burstStartTime) / (1. - burstStartTime);
revealParam = 1.0;
winParam = t;
}
float minOffset = 10.0;
float maxOffset = 20.0 + 20.0 * revealParam + 40.0 * (1. + winParam);
float recalcOffset = minOffset;
if(drawMode == 0) {
//glow:
recalcOffset = maxOffset;
}
//sheen effect:
float t = winParam;/// pow(winParam, 3.);// MAX(0.0f, MIN(1.0f, 1.0 * winParam + 0));
ofVec2f sheenSource((1-t) * -0.981 + t * 1.182, (1-t) * -0.138 + t * .441);
ofVec2f sheenEnd((1-t) * -0.234 + t * 1.929, (1-t) * 0.37 + t * 0.949);
//transform to fit 'networkBounds'
ofPoint center = networkBounds.getCenter();
sheenSource.x = center.x + (sheenSource.x - .5) * networkBounds.width;
sheenSource.y = center.y + (sheenSource.y - .5) * networkBounds.height;
sheenEnd.x = center.x + (sheenEnd.x - .5) * networkBounds.width;
sheenEnd.y = center.y + (sheenEnd.y - .5) * networkBounds.height;
ofVec2f sheenUnitVector(sheenEnd.x - sheenSource.x, sheenEnd.y - sheenSource.y);
float sheenLength = sqrtf(sheenUnitVector.x * sheenUnitVector.x + sheenUnitVector.y * sheenUnitVector.y);
sheenUnitVector.x /= sheenLength;
sheenUnitVector.y /= sheenLength;
ofColor darkColor = bgResources.getColorSetting(NetworkDarkColorKey)->value;
ofColor lightColor = bgResources.getColorSetting(NetworkLightColorKey)->value;
mNetworkShader.begin();
mNetworkShader.setUniform1f("uTime", mTime);
mNetworkShader.setUniform2f("uResolution", 1024, 768);
mNetworkShader.setUniform1f("uMaxDepth", maxDepth);
mNetworkShader.setUniform1f("uRevealParameter", revealParam);
mNetworkShader.setUniform1f("uBaseHue", 0.3); //RED: 0.1 GREEN: 0.3 //vec3(0,3, 0.7, .7);
mNetworkShader.setUniform3f("uBaseRGBDark", darkColor.r / 255.0, darkColor.g / 255.0, darkColor.b / 255.0);
mNetworkShader.setUniform3f("uBaseRGBLight", lightColor.r / 255.0, lightColor.g / 255.0, lightColor.b / 255.0);
mNetworkShader.setUniform1i("uDrawMode", drawMode);
mNetworkShader.setUniform1f("uBoundOffset", recalcOffset);// boundOffset);
mNetworkShader.setUniform1f("uDepthOffset", nodeDepth);
mNetworkShader.setUniform1i("uDeformNode", deform ? 1 : 0);
mNetworkShader.setUniform2f("uSurfaceNormal", surfaceNormal.x, surfaceNormal.y);
mNetworkShader.setUniform1f("uMinGlowRad", minOffset / maxOffset);
mNetworkShader.setUniform1f("uWinAnimParameter", winParam);
mNetworkShader.setUniform2f("uSheenFrom", sheenSource.x, sheenSource.y);
mNetworkShader.setUniform2f("uSheenUnitVector", sheenUnitVector.x, sheenUnitVector.y);
mNetworkShader.setUniform1f("uSheenLength", sheenLength);
/*
uniform float uWinAnimParameter;
uniform vec2 uSheenFrom;
uniform vec2 uSheenUnitVector;
uniform float uSheenLength;
*/
//.........这里部分代码省略.........