本文整理汇总了C++中TextureChunkPtr::imageContentChanged方法的典型用法代码示例。如果您正苦于以下问题:C++ TextureChunkPtr::imageContentChanged方法的具体用法?C++ TextureChunkPtr::imageContentChanged怎么用?C++ TextureChunkPtr::imageContentChanged使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TextureChunkPtr
的用法示例。
在下文中一共展示了TextureChunkPtr::imageContentChanged方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: key
void key(unsigned char key, int , int)
{
switch ( key )
{
case 27: exit(0);
case 'a': UChar8 imgdata[32];
for ( int i = 0; i < 32; i++ )
imgdata[i] = static_cast<UChar8>(rand());
pImage->set( Image::OSG_RGB_PF, 2, 2, 2, 1, 1, 0, imgdata );
xchunk1->imageContentChanged();
break;
case 'b': {
UChar8 imgdata[16];
for ( int i = 0; i < 16; i++ )
imgdata[i] = static_cast<UChar8>(rand());
pImage->set( Image::OSG_RGBA_PF, 2, 2, 1, 1, 1, 0, imgdata );
beginEditCP( xchunk1 );
xchunk1->setImage( pImage );
endEditCP( xchunk1 );
}
break;
case 'c': {
beginEditCP( xchunk1 );
xchunk1->setMinFilter( GL_LINEAR_MIPMAP_LINEAR );
xchunk1->setMagFilter( GL_LINEAR );
endEditCP( xchunk1 );
}
break;
case 'd': {
beginEditCP( xchunk1 );
xchunk1->setMinFilter( GL_NEAREST );
xchunk1->setMagFilter( GL_NEAREST );
endEditCP( xchunk1 );
}
break;
case 'e': {
UChar8 imgdata[16];
for ( int i = 0; i < 16; i++ )
imgdata[i] = static_cast<UChar8>(rand());
pImage->set( Image::OSG_RGBA_PF, 2, 2, 1, 1, 1, 0, imgdata );
xchunk1->imageContentChanged(1,1,1,1);
}
break;
case 'f': {
UChar8 imgdata[16];
for ( int i = 0; i < 16; i++ )
imgdata[i] = static_cast<UChar8>(rand());
pImage->set( Image::OSG_RGBA_PF, 2, 2, 1, 1, 1, 0, imgdata );
xchunk1->imageContentChanged(0,1,0,0);
}
break;
}
}
示例2: main
//.........这里部分代码省略.........
mchunk2 = MaterialChunk::create();
mchunk2->setDiffuse( Color4f( 0,1,0,0 ) );
mchunk2->setAmbient( Color4f( 0,1,0,0 ) );
mchunk2->setShininess( 50 );
// Texture chunk
// UChar8 imgdata[] =
// { 255,0,0,0, 0,255,0,0, 0,0,255,255, 255,255,255,255 };
UChar8 imgdata[] =
{ 255,0,0, 255,0,0, 255,0,255,
255,0,0, 255,0,0, 255,0,255,
255,255,0, 255,255,0, 255,255,255,
255,255,0, 255,255,0, 255,255,255, };
// UChar8 limgdata[] =
// { 0, 128, 64, 255 };
pImage->set( Image::OSG_RGB_PF, 2, 2, 1, 1, 1, 0, imgdata );
if ( argc > 1 )
pImage->read( argv[1] );
xchunk1 = TextureChunk::create();
beginEditCP(xchunk1);
xchunk1->setImage( pImage );
xchunk1->setMinFilter( GL_LINEAR );
xchunk1->setMagFilter( GL_NEAREST );
xchunk1->setWrapS( GL_REPEAT );
xchunk1->setWrapT( GL_REPEAT );
xchunk1->setEnvMode( GL_REPLACE );
xchunk1->setScale( false );
endEditCP(xchunk1);
xchunk1->imageContentChanged();
beginEditCP(xchunk1);
xchunk1->setImage( pImage );
xchunk1->setLodBias( 10 );
endEditCP(xchunk1);
UChar8 imgdata2[] =
{ 255,0,0, 0,255,0, 0,0,255, 255,255,255 };
ImagePtr pImage2 = Image::create();
pImage2->set(Image::OSG_RGB_PF, 2, 2, 1, 1, 1, 0, imgdata2);
xchunk2 = TextureChunk::create();
beginEditCP(xchunk2);
xchunk2->setImage( pImage2 );
xchunk2->setMinFilter( GL_LINEAR );
xchunk2->setMagFilter( GL_NEAREST );
xchunk2->setWrapS( GL_REPEAT );
xchunk2->setWrapT( GL_REPEAT );
xchunk2->setEnvMode( GL_MODULATE );
xchunk2->setLodBias( 10 );
endEditCP(xchunk2);
// Cube Texture chunk
UChar8 negz[] = { 255,0,0, 128,0,0, 64,0,0, 255,255,255 },
posz[] = { 0,255,0, 0,128,0, 0,64,0, 255,255,255 },
negy[] = { 0,0,255, 0,0,128, 0,0,64, 255,255,255 },
posy[] = { 255,255,0, 128,128,0, 64,64,0, 255,255,255 },
negx[] = { 255,0,255, 128,0,128, 64,0,64, 255,255,255 },
posx[] = { 0,255,255, 0,128,128, 0,64,64, 255,255,255 };
示例3: main
//.........这里部分代码省略.........
// Texture chunk
// UChar8 imgdata[] =
// { 255,0,0,0, 0,255,0,0, 0,0,255,255, 255,255,255,255 };
UChar8 imgdata[] =
{ 255,0,0, 255,0,0, 255,0,255,
255,0,0, 255,0,0, 255,0,255,
255,255,0, 255,255,0, 255,255,255,
255,255,0, 255,255,0, 255,255,255, };
// UChar8 limgdata[] =
// { 0, 128, 64, 255 };
pImage->set( Image::OSG_RGB_PF, 2, 2, 1, 1, 1, 0, imgdata );
if ( argc > 1 )
pImage->read( argv[1] );
xchunk1 = TextureChunk::create();
beginEditCP(xchunk1);
xchunk1->setImage( pImage ); // NOTE: the image is NOT copied, the variable
// needs to be kept around as long as the
// texture is used
xchunk1->setMinFilter( GL_LINEAR );
xchunk1->setMagFilter( GL_NEAREST );
xchunk1->setWrapS( GL_REPEAT );
xchunk1->setWrapT( GL_REPEAT );
xchunk1->setEnvMode( GL_REPLACE );
xchunk1->setEnvColor( Color4f(.5,.5,.5,0) );
xchunk1->setScale( false );
// xchunk1->setShaderOperation(GL_PASS_THROUGH_NV);
endEditCP(xchunk1);
xchunk1->imageContentChanged();
beginEditCP(xchunk1);
xchunk1->setImage( pImage );
endEditCP(xchunk1);
// blend chunk
blchunk = BlendChunk::create();
#ifdef GL_EXT_blend_color
blchunk->setSrcFactor( GL_CONSTANT_ALPHA );
blchunk->setDestFactor( GL_ONE_MINUS_CONSTANT_ALPHA );
#endif
blchunk->setColor( Color4f( .5,.5,.5,0.1 ) );
blchunk->setEquation(GL_FUNC_SUBTRACT);
std::cout << "BlendChunk is trans:" << blchunk->isTransparent() << std::endl;
// texture transform chunk
txchunk = TextureTransformChunk::create();
beginEditCP(txchunk);
txchunk->setMatrix( Matrix(4,0,0,0, 0,1,0,0, 0,0,1,0, 0,0,0,1) );
endEditCP(txchunk);
// polygon chunk
pchunk1 = PolygonChunk::create();
{
UInt32 stipple[32] = {
0xffff0000, 0x0000ffff, 0xffff0000, 0x0000ffff,
0xffff0000, 0x0000ffff, 0xffff0000, 0x0000ffff,
0xffff0000, 0x0000ffff, 0xffff0000, 0x0000ffff,