rem: image.set( Image::OSG_RGB_PF, 2, 2, 1, 1, 1, 0, imgdata );
add: pImage->set( Image::OSG_RGB_PF, 2, 2, 1, 1, 1, 0, imgdata );
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, 8, 8 );    glEndList();    dlid2 = glGenLists( 1 );    glNewList( dlid2, GL_COMPILE );    glBegin( GL_POLYGON );    glNormal3f( 0, 1, 0 );    glColor3f( 1, 1, 1 );    glTexCoord2f( 0, 0 );    glMultiTexCoord2fARB( GL_TEXTURE1_ARB, 0, 0 );    glVertex3f( -1.5, -1, -1.5 );    glTexCoord2f( 2, 0 );    glMultiTexCoord2fARB( GL_TEXTURE1_ARB, 2, 0 );    glVertex3f(  1.5, -1, -1.5 );    glTexCoord2f( 2, 2 );    glMultiTexCoord2fARB( GL_TEXTURE1_ARB, 2, 2 );    glVertex3f(  1.5, -1,  1.5 );    glTexCoord2f( 0, 2 );    glMultiTexCoord2fARB( GL_TEXTURE1_ARB, 0, 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 ); // 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->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_LINEAR );    xchunk2->setWrapS( GL_REPEAT );    xchunk2->setWrapT( GL_REPEAT );    xchunk2->setEnvMode( GL_MODULATE );    endEditCP(xchunk2);        // 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);    txchunk2 = TextureTransformChunk::create();    beginEditCP(txchunk2);    Quaternion q;    q.setValueAsAxisDeg(0,0,1, 45);    m.setTransform(q);    txchunk2->setMatrix(m);    endEditCP(txchunk2);    glutMainLoop();    return 0;}