rem: Image image2( Image::OSG_RGB_PF, 2, 2, 1, 1, 1, 0, imgdata2 );
add: Image *pImage2 = new Image(Image::OSG_RGB_PF, 2, 2, 1, 1, 1, 0, imgdata2);
context: int main( int argc, char *argv[] ){    osgInit(argc, argv);    glutInit(&argc, argv);    glutInitDisplayMode( GLUT_RGB | GLUT_DEPTH | GLUT_DOUBLE);    glutCreateWindow("OpenSG");    glutKeyboardFunc(key);    // glutReshapeFunc(resize);    glutDisplayFunc(display);    // glutMouseFunc(mouse);    // glutMotionFunc(motion);    glutIdleFunc(display);    // create the dummy structures    // the window is needed for the chunks that access GLObjects    win = GLUTWindow::create();    win->frameInit(); // test for preliminary calls not messing up GLexts    win->init();        dact = DrawAction::create();    dact->setWindow( win.getCPtr() );    win->init();    glMatrixMode( GL_PROJECTION );    glLoadIdentity();    gluPerspective( 60, 1, 0.1, 10 );    glMatrixMode( GL_MODELVIEW );    glLoadIdentity();    gluLookAt( 3, 3, 3,  0, 0, 0,   0, 1, 0 );    glEnable( GL_DEPTH_TEST );    glEnable( GL_LIGHTING );    glEnable( GL_LIGHT0 );    glPixelStorei( GL_UNPACK_ALIGNMENT, 1 );    dlid = glGenLists( 1 );    glNewList( dlid, GL_COMPILE );    glutSolidSphere( .8, 24, 24 );    glEndList();    dlid2 = glGenLists( 1 );    glNewList( dlid2, GL_COMPILE );    glBegin( GL_POLYGON );    glNormal3f( 0, 1, 0 );    glColor3f( 1, 1, 1 );    glTexCoord3f( 0, 0, 0 );    glVertex3f( -1.5, -1, -1.5 );    glTexCoord3f( 2, 0, 0 );    glVertex3f(  1.5, -1, -1.5 );    glTexCoord3f( 2, 2, 2 );    glVertex3f(  1.5, -1,  1.5 );    glTexCoord3f( 0, 2, 2 );    glVertex3f( -1.5, -1,  1.5 );    glEnd();    glEndList();    Matrix m;    tchunk1 = TransformChunk::create();    m.setTranslate( 0, 1, 0 );    tchunk1->setMatrix( m );    tchunk2 = TransformChunk::create();    tchunk2->setMatrix( Matrix::identity() );    mchunk1 = MaterialChunk::create();    mchunk1->setDiffuse( Color4f( 1,0,0,0 ) );    mchunk1->setAmbient( Color4f( 1,0,0,0 ) );    mchunk1->setShininess( 20 );    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 };    image.set( Image::OSG_RGB_PF, 2, 2, 1, 1, 1, 0, imgdata );    if ( argc > 1 )        image.read( argv[1] );    xchunk1 = TextureChunk::create();    beginEditCP(xchunk1);    xchunk1->setImage( &image );    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( &image );    endEditCP(xchunk1);    UChar8 imgdata2[] =    {  255,0,0,  0,255,0,  0,0,255,  255,255,255 };    Image image2( Image::OSG_RGB_PF, 2, 2, 1, 1, 1, 0, imgdata2 );    xchunk2 = TextureChunk::create();    beginEditCP(xchunk2);    xchunk2->setImage( &image2 );    xchunk2->setMinFilter( GL_LINEAR );    xchunk2->setMagFilter( GL_NEAREST );    xchunk2->setWrapS( GL_REPEAT );    xchunk2->setWrapT( GL_REPEAT );    xchunk2->setEnvMode( GL_MODULATE );    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 };        Image inegz( Image::OSG_RGB_PF, 2, 2, 1, 1, 1, 0, negz ),          iposz( Image::OSG_RGB_PF, 2, 2, 1, 1, 1, 0, posz ),          inegy( Image::OSG_RGB_PF, 2, 2, 1, 1, 1, 0, negy ),          iposy( Image::OSG_RGB_PF, 2, 2, 1, 1, 1, 0, posy ),          inegx( Image::OSG_RGB_PF, 2, 2, 1, 1, 1, 0, negx ),          iposx( Image::OSG_RGB_PF, 2, 2, 1, 1, 1, 0, posx );            cchunk1 = CubeTextureChunk::create();    beginEditCP(cchunk1);    cchunk1->setImage( &inegz );    cchunk1->setPosZImage( &iposz );    cchunk1->setPosYImage( &iposy );    cchunk1->setNegYImage( &inegy );    cchunk1->setPosXImage( &iposx );    cchunk1->setNegXImage( &inegx );    cchunk1->setMinFilter( GL_LINEAR );    cchunk1->setMagFilter( GL_NEAREST );    cchunk1->setWrapS( GL_REPEAT );    cchunk1->setWrapT( GL_REPEAT );    cchunk1->setEnvMode( GL_MODULATE );    endEditCP(cchunk1);        gchunk1 = TexGenChunk::create();    beginEditCP(gchunk1);    gchunk1->setGenFuncS(GL_REFLECTION_MAP_ARB);    gchunk1->setGenFuncT(GL_REFLECTION_MAP_ARB);    gchunk1->setGenFuncR(GL_REFLECTION_MAP_ARB);    endEditCP(gchunk1);        // blend chunk    blchunk = BlendChunk::create();#ifndef WIN32//    blchunk->setSrcFactor( GL_CONSTANT_ALPHA );//    blchunk->setDestFactor( GL_ONE_MINUS_CONSTANT_ALPHA );#endif    blchunk->setColor( Color4f( 1,1,1,0.1 ) );    // 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);    glutMainLoop();    return 0;}