当前位置: 首页>>代码示例>>C++>>正文


C++ ofTexture::getHeight方法代码示例

本文整理汇总了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);
        }
    }
}
开发者ID:SethGibson,项目名称:CLOUDS,代码行数:64,代码来源:CloudsVisualSystemMemory.cpp

示例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();
}
开发者ID:Mat-Loz,项目名称:ofxFilterLibrary,代码行数:12,代码来源:TiltShiftFilter.cpp

示例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();
}
开发者ID:chewyishere,项目名称:DanceFlows,代码行数:9,代码来源:MotionDetectionFilter.cpp

示例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 ;
}
开发者ID:HeliosInteractive,项目名称:ofxHeliosLibs,代码行数:68,代码来源:EasyMask.cpp


注:本文中的ofTexture::getHeight方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。