本文整理汇总了C++中ofTexture::getHeight方法的典型用法代码示例。如果您正苦于以下问题:C++ ofTexture::getHeight方法的具体用法?C++ ofTexture::getHeight怎么用?C++ ofTexture::getHeight使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ofTexture
的用法示例。
在下文中一共展示了ofTexture::getHeight方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: generateFromTexture
void CloudsVisualSystemMemory::generateFromTexture(ofTexture &_tex){
ofPixels pixels;
_tex.readToPixels(pixels);
int xMargin = 0;
int yMargin = 0;
//MA: changed ofGetWidth() to getCanvasWidth() and ofGetHeight() to getCanvasHeight()
int width = getCanvasWidth()-xMargin*2.0;
int height = getCanvasHeight()-yMargin*2.0;
ofRectangle block;
block.width = blockWidth*blockScale;
block.height = blockHeight*blockScale;
xBlocks = (float)width/((blockWidth+margin)*blockScale);
yBlocks = (float)height/((blockHeight+margin)*blockScale);
outlineMesh.clear();
outlineMesh.setMode(OF_PRIMITIVE_LINES);
outlineMesh.setUsage(GL_STREAM_DRAW);
fillMesh.clear();
fillMesh.setMode(OF_PRIMITIVE_TRIANGLES);
outlineMesh.setUsage(GL_STATIC_DRAW);
blocks.clear();
for (int j = 0; j < yBlocks; j++) {
for (int i = 0; i < xBlocks; i++){
int x = xMargin + ((margin + blockWidth)*blockScale)*i ;
int y = xMargin + ((margin + blockHeight)*blockScale)*j ;
Block newBlock;
newBlock.set(block);
newBlock.x = x+block.width*0.5;
newBlock.y = y+block.height*0.5;
ofPoint st = ofPoint( ((float)i)/((float)xBlocks), ((float)j)/((float)yBlocks));
st *= ofPoint(_tex.getWidth(),_tex.getHeight());
newBlock.value = pixels.getColor( st.x, st.y ).getBrightness();
// newBlock.color = ofColor( newBlock.value)/brightnessOffset;
if(baseColorRange.min == baseColorRange.max){
newBlock.color = ofFloatColor(baseColorRange.min);
}
else{
newBlock.color = ofFloatColor(ofMap(newBlock.value, 0, 255,
baseColorRange.min,baseColorRange.max), 1.0);
}
newBlock.borderBase = borderBase;
newBlock.borderColor = borderColor;
newBlock.bSelected = false;
newBlock.outlineMesh = &outlineMesh;
newBlock.fillMesh = &fillMesh;
newBlock.setup();
blocks.push_back(newBlock);
}
}
}
示例2: AbstractFilter
TiltShiftFilter::TiltShiftFilter(ofTexture & texture, float focusPercent, float falloff) : AbstractFilter(texture.getWidth(), texture.getHeight()) {
_name = "Tilt Shift";
_texture = texture;
_focusPercent=ofClamp(focusPercent, 0, 1);
_gaussianBlurFilter = new GaussianBlurFilter(getWidth(), getHeight());
_addParameter(new ParameterF("topFocusLevel", focusPercent));
_addParameter(new ParameterF("bottomFocusLevel", 1.f - focusPercent));
_addParameter(new ParameterF("focusFallOffRate", falloff));
_addParameter(new ParameterT("inputImageTexture", _texture, 1));
_addParameter(new ParameterT("inputImageTexture2", _gaussianBlurFilter->getTextureReference(), 2));
_setupShader();
}
示例3: AbstractTwoInputFilter
MotionDetectionFilter::MotionDetectionFilter(ofTexture & texture, float intensity, bool showImage) : AbstractTwoInputFilter(texture.getWidth(), texture.getHeight()) {
_name = "Motion Detection";
_texture = texture;
_lowPassFilter = new LowPassFilter(getWidth(), getHeight(), 0.6);
setSecondTexture(_lowPassFilter->getTextureReference());
_addParameter(new ParameterF("intensity", intensity));
_addParameter(new ParameterF("showImage", (float)showImage));
_setupShader();
}
示例4: drawMask
void EasyMask::drawMask ( ofTexture contentTex , ofTexture maskTex , float xOffset , float yOffset , float contentAlpha )
{
/*
if ( contentTex.getWidth() < maskArea.width )
maskArea.width = contentTex.getWidth() ;
if ( contentTex.getHeight() < maskArea.height )
maskArea.height = contentTex.getHeight() ;
*/
//TEX0 = CONTENT
//TEX1 = M
//BEGIN MASK
ofEnableAlphaBlending( ) ;
//ofSetColor ( 255 , 255 , 255 ) ;
// contentTex.setTextureWrap( GL_CLAMP, GL_CLAMP ) ;
glActiveTexture(GL_TEXTURE0_ARB);
contentTex.bind();
glActiveTexture(GL_TEXTURE1_ARB);
maskTex.bind();
//prevents weird texture wrapping
// contentTex.setTextureWrap( GL_CLAMP_TO_BORDER_ARB, GL_CLAMP_TO_BORDER_ARB ) ;
contentTex.setTextureWrap( GL_CLAMP_TO_BORDER_ARB , GL_CLAMP_TO_BORDER_ARB ) ;
// texture1.setTextureWrap( GL_CLAMP , GL_CLAMP ) ;
//xOffset = sin ( ofGetElapsedTimef() ) * 500.0f ;
maskShader.begin();
maskShader.setUniformTexture("Tex0", contentTex , 0);
maskShader.setUniformTexture("Tex1", maskTex , 1);
maskShader.setUniform1f( "alpha" , contentAlpha ) ;
glBegin(GL_QUADS);
ofFill() ;
// ofSetColor ( 255 , 255 , 255 , 255 ) ;
// maskOffset = 0 ; //sin ( ofGetElapsedTimef() ) * 200.0f ;
glMultiTexCoord2d(GL_TEXTURE0_ARB, xOffset , yOffset );
glMultiTexCoord2d(GL_TEXTURE1_ARB, 0, contentAlpha );
glVertex2f( maskArea.x , maskArea.y );
glMultiTexCoord2d(GL_TEXTURE0_ARB, xOffset + contentTex.getWidth(), yOffset );
glMultiTexCoord2d(GL_TEXTURE1_ARB, maskTex.getWidth(), 0 );
glVertex2f( maskArea.x + maskArea.width , maskArea.y );
glMultiTexCoord2d(GL_TEXTURE0_ARB, xOffset + contentTex.getWidth() , contentTex.getHeight() + yOffset );
glMultiTexCoord2d(GL_TEXTURE1_ARB, maskTex.getWidth() , maskTex.getHeight() );
glVertex2f( maskArea.x + maskArea.width , maskArea.height + maskArea.y );
glMultiTexCoord2d(GL_TEXTURE0_ARB, xOffset , contentTex.getHeight() + yOffset );
glMultiTexCoord2d(GL_TEXTURE1_ARB, 0, maskTex.getHeight() );
glVertex2f( maskArea.x , maskArea.height + maskArea.y ) ;
glEnd();
maskShader.end() ;
//deactive and clean up
glActiveTexture(GL_TEXTURE1_ARB);
maskTex.unbind();
glActiveTexture(GL_TEXTURE0_ARB);
contentTex.unbind();
//maskArea = originalMaskArea ;
}