本文整理汇总了C++中ofBaseHasTexture类的典型用法代码示例。如果您正苦于以下问题:C++ ofBaseHasTexture类的具体用法?C++ ofBaseHasTexture怎么用?C++ ofBaseHasTexture使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ofBaseHasTexture类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: drawNormalized
void testApp::drawNormalized(ofxFaceTracker& tracker, ofBaseHasTexture& tex, ofFbo& result) {
result.begin();
tex.getTextureReference().bind();
drawNormalized(tracker);
tex.getTextureReference().unbind();
result.end();
}
开发者ID:Mat-Loz,项目名称:FaceSubstitution,代码行数:7,代码来源:testApp.cpp
示例2: ofxQuadWarp
void ofxQuadWarp(ofBaseHasTexture &tex, ofPoint lt, ofPoint rt, ofPoint rb, ofPoint lb, int rows, int cols) {
float tw = tex.getTextureReference().getWidth();
float th = tex.getTextureReference().getHeight();
ofMesh mesh;
for (int x=0; x<=cols; x++) {
float f = float(x)/cols;
ofPoint vTop(ofxLerp(lt,rt,f));
ofPoint vBottom(ofxLerp(lb,rb,f));
ofPoint tTop(ofxLerp(ofPoint(0,0),ofPoint(tw,0),f));
ofPoint tBottom(ofxLerp(ofPoint(0,th),ofPoint(tw,th),f));
for (int y=0; y<=rows; y++) {
float f = float(y)/rows;
ofPoint v = ofxLerp(vTop,vBottom,f);
mesh.addVertex(v);
mesh.addTexCoord(ofxLerp(tTop,tBottom,f));
}
}
for (float y=0; y<rows; y++) {
for (float x=0; x<cols; x++) {
mesh.addTriangle(ofxIndex(x,y,cols+1), ofxIndex(x+1,y,cols+1), ofxIndex(x,y+1,cols+1));
mesh.addTriangle(ofxIndex(x+1,y,cols+1), ofxIndex(x+1,y+1,cols+1), ofxIndex(x,y+1,cols+1));
}
}
tex.getTextureReference().bind();
mesh.draw();
tex.getTextureReference().unbind();
mesh.drawVertices();
}
开发者ID:Bicicletorama,项目名称:Game,代码行数:33,代码来源:ofxExtras.cpp
示例3: maskBlur
void testApp::maskBlur(ofBaseHasTexture& tex, ofFbo& result) {
int k = ofMap(mouseX, 0, ofGetWidth(), 1, 128, true);
halfMaskBlur.begin();
ofClear(0, 0);
maskBlurShader.begin();
maskBlurShader.setUniformTexture("tex", tex, 1);
maskBlurShader.setUniformTexture("mask", faceMask, 2);
maskBlurShader.setUniform2f("direction", 1, 0);
maskBlurShader.setUniform1i("k", k);
tex.getTextureReference().draw(0, 0);
maskBlurShader.end();
halfMaskBlur.end();
result.begin();
ofClear(0, 0);
maskBlurShader.begin();
maskBlurShader.setUniformTexture("tex", halfMaskBlur, 1);
maskBlurShader.setUniformTexture("mask", faceMask, 2);
maskBlurShader.setUniform2f("direction", 0, 1);
maskBlurShader.setUniform1i("k", k);
halfMaskBlur.draw(0, 0);
maskBlurShader.end();
result.end();
}
开发者ID:Mat-Loz,项目名称:FaceSubstitution,代码行数:25,代码来源:testApp.cpp
示例4: ofxDrawDisk
void ofxDrawDisk(ofBaseHasTexture &img,float r, float slices) {
float cx = img.getTextureReference().getWidth()/2; //center of image
float cy = img.getTextureReference().getHeight()/2; //center of image
float step = TWO_PI/slices; //size of a slice in radians
img.getTextureReference().bind();
glBegin(GL_TRIANGLE_FAN);
for (float f=0; f<TWO_PI; f+=step) {
glTexCoord2f(cx,cy);
glVertex2f(0,0);
glTexCoord2f(cx+cx*sin(f), cy+cy*cos(f));
glVertex2f(r*sin(f), r*cos(f));
glTexCoord2f(cx+cx*sin(f+step), cy+cy*cos(f+step));
glVertex2f(r*sin(f+step), r*cos(f+step));
}
glEnd();
}
开发者ID:minusplusminus,项目名称:ofxExtras,代码行数:18,代码来源:ofxExtras.cpp
示例5: maskedDraw
void testApp::maskedDraw(ofBaseHasTexture& tex) {
ofTexture& texture = tex.getTextureReference();
ofEnableAlphaBlending();
maskShader.begin();
maskShader.setUniformTexture("tex", texture, 0);
ofSetMinMagFilters(GL_NEAREST, GL_NEAREST);
texture.draw((int) -texture.getWidth() / 2, (int) -texture.getHeight() / 2);
maskShader.end();
ofDisableAlphaBlending();
}
开发者ID:JoshBlake,项目名称:PolyPow,代码行数:10,代码来源:testApp.cpp
示例6: drawFullscreen
//----------
void Scene::drawFullscreen(ofBaseHasTexture & tex) {
glDisable(GL_DEPTH_TEST);
glMatrixMode(GL_MODELVIEW);
glPushMatrix();
glLoadIdentity();
glMatrixMode(GL_PROJECTION);
glPushMatrix();
glLoadIdentity();
//tex.getTextureReference().bind();
const float width = tex.getTextureReference().getWidth();
const float height = tex.getTextureReference().getHeight();
ofMesh quad;
quad.addVertex(ofVec3f(-1,-1,0));
quad.addTexCoord(ofVec2f(0,0));
quad.addVertex(ofVec3f(+1,-1,0));
quad.addTexCoord(ofVec2f(width,0));
quad.addVertex(ofVec3f(-1,+1,0));
quad.addTexCoord(ofVec2f(0,height));
quad.addVertex(ofVec3f(+1,+1,0));
quad.addTexCoord(ofVec2f(width,height));
quad.addIndex(0);
quad.addIndex(1);
quad.addIndex(3);
quad.addIndex(0);
quad.addIndex(3);
quad.addIndex(2);
quad.drawFaces();
//tex.getTextureReference().unbind();
glPopMatrix();
glMatrixMode(GL_MODELVIEW);
glPopMatrix();
glEnable(GL_DEPTH_TEST);
}
开发者ID:elliotwoods,项目名称:ofxGrabScene,代码行数:42,代码来源:Scene.cpp
示例7: alphaBlur
void testApp::alphaBlur(ofBaseHasTexture& tex, ofFbo& result) {
int k = ofMap(mouseY, 0, ofGetHeight(), 1, 25, true);
halfAlphaBlur.begin();
ofClear(0, 0);
blurAlphaShader.begin();
blurAlphaShader.setUniformTexture("tex", tex, 1);
blurAlphaShader.setUniform2f("direction", 1, 0);
blurAlphaShader.setUniform1i("k", k);
tex.getTextureReference().draw(0, 0);
blurAlphaShader.end();
halfAlphaBlur.end();
result.begin();
ofClear(0, 0);
blurAlphaShader.begin();
blurAlphaShader.setUniformTexture("tex", halfAlphaBlur, 1);
blurAlphaShader.setUniform2f("direction", 0, 1);
blurAlphaShader.setUniform1i("k", k);
halfAlphaBlur.draw(0, 0);
blurAlphaShader.end();
result.end();
}
开发者ID:Mat-Loz,项目名称:FaceSubstitution,代码行数:23,代码来源:testApp.cpp
示例8: setUniformTexture
//--------------------------------------------------------------
void ofShader::setUniformTexture(const string & name, const ofBaseHasTexture& img, int textureLocation) const{
setUniformTexture(name, img.getTexture(), textureLocation);
}
开发者ID:archerlulu,项目名称:openFrameworks,代码行数:4,代码来源:ofShader.cpp
示例9: setUniformTexture
void ofxShader::setUniformTexture(const char* name, ofBaseHasTexture& img, int textureLocation) {
setUniformTexture(name, img.getTextureReference(), textureLocation);
}
开发者ID:LeoPovoa,项目名称:openFrameworks,代码行数:3,代码来源:ofxShader.cpp
示例10: ofxSetTexture
void ofxSetTexture(ofBaseHasTexture &material) {
material.getTextureReference().bind();
}
开发者ID:Bicicletorama,项目名称:Game,代码行数:3,代码来源:ofxExtras.cpp
注:本文中的ofBaseHasTexture类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论