Hi Tobias,

sounds interesting :-) I think the nicest solutions is to not include any
CGChunk headers or link against it.

Andreas


I did something like this:

_current_cg =
StateChunkPtr::dcast(FieldContainerFactory::the()->createFieldContainer("CGChunk"));

if(_current_cg == NullFC) // no CGChunk compiled in OpenSG
    return;


string prg = "..." ; // shader program
unsigned int profile = ...;

BitVector mask =
_current_cg->getType().findFieldDescription("vertexProfile")->getFieldMask()
|
                
_current_cg->getType().findFieldDescription("vertexProgram")->getFieldMask();
    
    beginEditCP(_current_cg, mask);
    
        SFUInt32 *fui = dynamic_cast<SFUInt32
*>(_current_cg->getField("vertexProfile"));
        if(fui != NULL)
            fui->setValue(profile);
        
        SFString *fs = dynamic_cast<SFString
*>(_current_cg->getField("vertexProgram"));
        if(fs != NULL)
            fs->setValue(prg);

    endEditCP(_current_cg, mask);
}

...

BitVector mask =
_current_cg->getType().findFieldDescription("fragmentProfile")->getFieldMask()
|
                    
_current_cg->getType().findFieldDescription("fragmentProgram")->getFieldMask();
    
    
    beginEditCP(_current_cg, mask);
    
        SFUInt32 *fui = dynamic_cast<SFUInt32
*>(_current_cg->getField("fragmentProfile"));
        if(fui != NULL)
            fui->setValue(profile);
        
        SFString *fs = dynamic_cast<SFString
*>(_current_cg->getField("fragmentProgram"));
        if(fs != NULL)
            fs->setValue(prg);

    endEditCP(_current_cg, mask);


> Hi.
> 
> I'm messing around with the FileIO/WRL Loader and added some functionality
> to put Cg shaders into VRML files. I used the Contrib/CGChunk for that, 
> which (naturally) caused some errors with unlocateable header files 
> (OSGCGChunk.h, et al.) and will probably cause some linking errors due to 
> circular dependencies between libosgsystem and libosfcontrib (not sure 
> about that, though).
> 
> What do I have to do to make that compile nicely? To be honest, I'm 
> somewhat dumbstruck when I comes to OpenSGs build process. :)
> 
> Tobias
> 
> 
> 
> -------------------------------------------------------
> This SF.Net email is sponsored by: Oracle 10g
> Get certified on the hottest thing ever to hit the market... Oracle 10g. 
> Take an Oracle 10g class now, and we'll give you the exam FREE.
> http://ads.osdn.com/?ad_id=3149&alloc_id=8166&op=click
> _______________________________________________
> Opensg-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/opensg-users
> 

-- 
"Sie haben neue Mails!" - Die GMX Toolbar informiert Sie beim Surfen!
Jetzt aktivieren unter http://www.gmx.net/info



-------------------------------------------------------
This SF.Net email is sponsored by: Oracle 10g
Get certified on the hottest thing ever to hit the market... Oracle 10g. 
Take an Oracle 10g class now, and we'll give you the exam FREE.
http://ads.osdn.com/?ad_id=3149&alloc_id=8166&op=click
_______________________________________________
Opensg-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensg-users

Reply via email to