本文整理汇总了C++中ofTexture::draw方法的典型用法代码示例。如果您正苦于以下问题:C++ ofTexture::draw方法的具体用法?C++ ofTexture::draw怎么用?C++ ofTexture::draw使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ofTexture
的用法示例。
在下文中一共展示了ofTexture::draw方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: render
void LayoutVerticalStripes::render(ofTexture texture, ColorChannel *colorChannel, Layer layer) {
float complexity = layer.complexity;
int nrows = (complexity * 128) + 1;
int ncols = 1;
int xSize = ofGetWidth() / nrows;
int ySize = ofGetHeight() / ncols;
for (int row=0; row<nrows; row++) {
for (int col=0; col<ncols; col++) {
ofColor selectedColor = colorChannel->selectColor(nrows * col + row + layoutFrame);
shader.begin(texture.getWidth(),
texture.getHeight(),
layer.masterScreenAlpha,
layer.alpha,
layer.contrast,
layer.luminance,
selectedColor.r,
selectedColor.g,
selectedColor.b);
int xOffset = row * xSize;
int yOffset = col * ySize;
texture.draw(xOffset, yOffset, xSize, ySize);
shader.end();
}
}
}
示例2: draw
void BulgeEffect::draw(ofTexture& tex, int x, int y) {
applyBulgeShader.begin();
applyBulgeShader.setUniformTexture("bulge", blendBulge.getTextureReference(), 1);
applyBulgeShader.setUniformTexture("tex", tex, 2);
tex.draw(x, y);
applyBulgeShader.end();
needToClear = true;
}
示例3: drawEffect
void ofxMask::drawEffect(ofTexture& maskedImage)
{
shader.begin();
shader.setUniformTexture("mask", fbo, 1);
shader.setUniform1i("tex", 0);
ofEnableAlphaBlending();
maskedImage.draw(0, 0);
shader.end();
}
示例4: update
void Clone::update(ofTexture& src, ofTexture& dst, ofTexture& mask) {
maskedBlur(src, mask, srcBlur);
maskedBlur(dst, mask, dstBlur);
buffer.begin();
ofPushStyle();
ofEnableAlphaBlending();
dst.draw(0, 0);
cloneShader.begin();
cloneShader.setUniformTexture("src", src, 1);
cloneShader.setUniformTexture("srcBlur", srcBlur, 2);
cloneShader.setUniformTexture("dstBlur", dstBlur, 3);
dst.draw(0, 0);
cloneShader.end();
ofDisableAlphaBlending();
ofPopStyle();
buffer.end();
}
示例5: setObstacle
void ftParticleFlow::setObstacle (ofTexture& _tex) {
ofPushStyle();
ofEnableBlendMode(OF_BLENDMODE_DISABLED);
obstacleBuffer.clear();
obstacleBuffer.begin();
_tex.draw(0,0,simulationWidth,simulationHeight);
obstacleBuffer.end();
ofPopStyle();
}
示例6: ofGetWidth
void tricks::gl::effects::OutputFilter::draw(ofTexture &tex) {
shader.begin();
shader.setUniformTexture("tex", tex, 0);
shader.setUniform1f("brightness", brightness);
shader.setUniform1f("contrast", contrast);
shader.setUniform1f("saturation", saturation);
tex.draw(0, 0, ofGetWidth(), ofGetHeight());
shader.end();
}
示例7: draw
void MaskTool::draw(ofTexture & dstTex)
{
if (getEnabled())
{
ofSetColor(255);
dstTex.draw(0, 0);
_frame.draw(0, 0);
}
}
示例8: spaceTime
void ofxImageTS::spaceTime(ofTexture texture, float depth, float density, float width, float height){
ofFbo buffer;
buffer.begin();
ofSetRectMode(OF_RECTMODE_CENTER);
for(float i = 0; i < depth; i += 1/density){
texture.draw(width/2,height/2,width/i,height/i);
}
buffer.end();
}
示例9: divider
void ofxImageTS::divider(ofTexture texture,float divW, float divH, float width, float height){
ofFbo buffer;
buffer.begin();
for(int i = 0; i < divW; i++) {
for(int j = 0; j < divH; j++) {
texture.draw((width/divW) * i,(height/divH) * j,width/divW,height/divH);
}
}
buffer.end();
}
示例10: TexLine
void TexLine(ofPoint& startpoint, ofPoint& endpoint, ofTexture& tex)
{
float dist = ofDist(startpoint.x, startpoint.y, endpoint.x, endpoint.y);
float angle = atan2(endpoint.y-startpoint.y,
endpoint.x-startpoint.x);;
glPushMatrix();
glTranslatef(startpoint.x, startpoint.y, 0.0);
glRotatef(angle*180.0/PI, 0, 0, 1.0);
tex.draw(style::lineHeight/2, -style::lineHeight/2,
dist - style::lineHeight, style::lineHeight);
glPopMatrix();
}
示例11: debugShader
void Clone::debugShader(ofTexture &tex, ofTexture &mask){
debugFbo.allocate(buffer.getWidth(), buffer.getHeight());
debugResultFbo.allocate(buffer.getWidth(), buffer.getHeight());
ofShader debugShader;
debugShader.load("shader/maskBlurShader");
setStrength(16);
debugFbo.begin();
// debugShader.begin();
//
// //maskBlurShader.setUniformTexture("tex", tex, 1);
// debugShader.setUniformTexture("tex0", tex, 1);
// debugShader.setUniformTexture("mask", mask, 2);
// debugShader.setUniform2f("direction", 0, 1);
// debugShader.setUniform1i("k", strength);
// mask.draw(0, 0);
//
// debugShader.end();
maskBlurShader.begin();
maskBlurShader.setUniformTexture("tex0", tex, 1);
maskBlurShader.setUniformTexture("mask", mask, 2);
//maskBlurShader.setUniform2f("direction", 0., 1./tex.getHeight());
maskBlurShader.setUniform2f("direction", 1./tex.getWidth(), 0.);
maskBlurShader.setUniform1i("k", strength);
tex.draw(0, 0);
maskBlurShader.end();
debugFbo.end();
// debugResultFbo.begin();
//
// maskBlurShader.setUniformTexture("tex0", debugFbo, 1);
// maskBlurShader.setUniformTexture("mask", mask, 2);
// maskBlurShader.setUniform2f("direction", 0., 1./tex.getHeight());
// maskBlurShader.setUniform1i("k", strength);
// debugFbo.draw(0, 0);
//
// debugResultFbo.end();
}
示例12: render
void imageMeltingPoint::render( const ofTexture& _tex){
if( !_tex.isAllocated() ) return;// false;
int radius = karmaSoundAnalyser::getInstance().getZeroCrossings()/400;
_tex.draw(position);
/*for(int x=position.x-radius; x<position.x+radius; x+=round(ofRandom(1,radius/10)) ){
if( x < 0 || x > _tex.getWidth() ) continue;
for(int y=position.y-radius; y<position.y+radius; y+=round(ofRandom(1,radius/10))){
if( y < 0 || y > _tex.getHeight() ) continue;
int offset = y*_tex.getWidth() + x;
offset /= _tex.getNumChannels()*2;
ofSetColor( (ofColor) _tex[offset] );
ofDrawCircle(x, y, 1);
}
}*/
}
示例13: draw
void ofxParticle::draw(ofTexture &tex){
float w = tex.getWidth();
float h = tex.getHeight();
if(w > h){
h = h/w*size;
w = size;
}
else{
w = w/h*size;
h = size;
}
ofSetColor(color);
ofPushMatrix();
ofTranslate(position);
ofRotateX(rotation.x);
ofRotateY(rotation.y);
ofRotateZ(rotation.z);
tex.draw(w*-0.5,h*-0.5,w,h);
ofPopMatrix();
}
示例14: update
void MaskTool::update(ofTexture& srcTex)
{
if (getEnabled())
{
ofSetColor(255, 255);
if (_bBrushDown)
{
_frameStack[_curUndoFrame]->begin();
_brushImg.draw(ofGetMouseX() - 25, ofGetMouseY() - 25, 50, 50);
_frameStack[_curUndoFrame]->end();
}
_maskFrame.begin();
ofClear(0, 0, 0, 255);
_maskFrame.end();
// combine all frames in _frameStack into _maskFrame
for (int i = 0; i < _frameStack.size(); i++)
{
if (!_frameStack[i]->isCleared())
{
_combineFrames(_maskFrame, _frameStack[i]->getTextureReference());
}
}
_frame.begin();
// Cleaning everthing with alpha mask on 0 in order to make it transparent for default
ofClear(0, 0, 0, 0);
_maskShader.begin();
_maskShader.setUniformTexture("maskTex", _maskFrame.getTextureReference(), 1);
srcTex.draw(0,0);
_maskShader.end();
_frame.end();
}
}
示例15: maskedBlur
void Clone::maskedBlur(ofTexture& tex, ofTexture& mask, ofFbo& result) {
int k = strength;
buffer.begin();
maskBlurShader.begin();
maskBlurShader.setUniformTexture("tex", tex, 1);
maskBlurShader.setUniformTexture("mask", mask, 2);
maskBlurShader.setUniform2f("direction", 1, 0);
maskBlurShader.setUniform1i("k", k);
tex.draw(0, 0);
maskBlurShader.end();
buffer.end();
result.begin();
maskBlurShader.begin();
maskBlurShader.setUniformTexture("tex", buffer, 1);
maskBlurShader.setUniformTexture("mask", mask, 2);
maskBlurShader.setUniform2f("direction", 0, 1);
maskBlurShader.setUniform1i("k", k);
buffer.draw(0, 0);
maskBlurShader.end();
result.end();
}