本文整理汇总了C++中ofTexture::setTextureWrap方法的典型用法代码示例。如果您正苦于以下问题:C++ ofTexture::setTextureWrap方法的具体用法?C++ ofTexture::setTextureWrap怎么用?C++ ofTexture::setTextureWrap使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ofTexture
的用法示例。
在下文中一共展示了ofTexture::setTextureWrap方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: drawMask
void ofxSimpleMask::drawMask ( ofTexture contentTex , ofTexture maskTex ,
float xOffset , float yOffset , float contentAlpha , float width , float height )
{
if ( width == 0 ) width = maskArea.width ;
if ( height == 0 ) height = maskArea.height ;
//BEGIN MASK
ofEnableAlphaBlending( ) ;
glActiveTexture(GL_TEXTURE0_ARB);
contentTex.bind();
glActiveTexture(GL_TEXTURE1_ARB);
maskTex.bind();
//prevents weird texture wrapping , otherwise the last or first pixel is repeated to infinity
contentTex.setTextureWrap( GL_CLAMP_TO_BORDER_ARB , GL_CLAMP_TO_BORDER_ARB ) ;
//contentTex.setTextureWrap( GL_CLAMP , GL_CLAMP ) ;
maskShader->begin();
maskShader->setUniformTexture("Tex0", contentTex , 0);
maskShader->setUniformTexture("Tex1", maskTex , 1);
maskShader->setUniform1f( "alpha" , contentAlpha ) ;
glBegin(GL_QUADS);
ofFill() ;
glMultiTexCoord2d(GL_TEXTURE0_ARB, xOffset , yOffset );
glMultiTexCoord2d(GL_TEXTURE1_ARB, 0, 0 );
glVertex2f( maskArea.x , maskArea.y );
glMultiTexCoord2d(GL_TEXTURE0_ARB, xOffset + contentTex.getWidth(), yOffset );
glMultiTexCoord2d(GL_TEXTURE1_ARB, maskTex.getWidth(), 0 );
glVertex2f( maskArea.x + width , maskArea.y );
glMultiTexCoord2d(GL_TEXTURE0_ARB, xOffset + contentTex.getWidth() , contentTex.getHeight() + yOffset );
glMultiTexCoord2d(GL_TEXTURE1_ARB, maskTex.getWidth() , maskTex.getHeight() );
glVertex2f( maskArea.x + width , height + maskArea.y );
glMultiTexCoord2d(GL_TEXTURE0_ARB, xOffset , contentTex.getHeight() + yOffset );
glMultiTexCoord2d(GL_TEXTURE1_ARB, 0, maskTex.getHeight() );
glVertex2f( maskArea.x , height + maskArea.y ) ;
glEnd();
maskShader->end() ;
//deactive and clean up
glActiveTexture(GL_TEXTURE1_ARB);
maskTex.unbind();
glActiveTexture(GL_TEXTURE0_ARB);
contentTex.unbind();
//maskArea = originalMaskArea ;
}
示例2: drawScrollingMask
void ofxSimpleMask::drawScrollingMask( ofTexture content , ofTexture mask , float scrolling , float contentAlpha )
{
content.setTextureWrap( GL_CLAMP_TO_BORDER_ARB , GL_CLAMP_TO_BORDER_ARB ) ;
glActiveTexture(GL_TEXTURE0_ARB);
content.bind() ;
glActiveTexture(GL_TEXTURE1_ARB);
mask.bind() ;
//ofTranslate ( 0 , offset.y + 100 , 0 ) ;
//draw a quad the size of the frame
glBegin(GL_QUADS);
ofFill() ;
ofSetColor ( 255 , 255 , 255 , 255 ) ;
int fadeMaskOffset = 0 ;
//move the mask around with the mouse by modifying the texture coordinates
glMultiTexCoord2d(GL_TEXTURE0_ARB, 0, scrolling );
glMultiTexCoord2d(GL_TEXTURE1_ARB, 0, 0);
glVertex2f( 0 , fadeMaskOffset );
glMultiTexCoord2d(GL_TEXTURE0_ARB, content.getWidth(), scrolling );
glMultiTexCoord2d(GL_TEXTURE1_ARB, mask.getWidth(), 0 );
glVertex2f( maskArea.width , fadeMaskOffset );
glMultiTexCoord2d(GL_TEXTURE0_ARB, content.getWidth() , mask.getHeight() + scrolling );
glMultiTexCoord2d(GL_TEXTURE1_ARB, mask.getWidth() , mask.getHeight() );
glVertex2f( maskArea.width , maskArea.height + fadeMaskOffset );
glMultiTexCoord2d(GL_TEXTURE0_ARB, 0, mask.getHeight() + scrolling );
glMultiTexCoord2d(GL_TEXTURE1_ARB, 0, mask.getHeight() );
glVertex2f( 0 , maskArea.height + fadeMaskOffset ) ;
glEnd();
//deactive and clean up
glActiveTexture(GL_TEXTURE1_ARB);
mask.unbind() ;
glActiveTexture(GL_TEXTURE0_ARB);
content.unbind() ;
}
示例3: 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 ;
}