Hi
here's some code that i'm using with OpenInventor
and it work hehehehehe
hope it may help you find what problem u have
/************Code*************/
int width=1600;
int height=1200;
SbViewportRegion vport(width,height);
SoOffscreenRenderer osr(vport);
osr.setBackgroundColor(SbColor(0,0,0));
osr.setColorDepth(8);// or 24
SbBool OK = osr.render(root);
if (!OK) {
printf("*** OffscreenRender failed...\n");
exit(1);
}
/*************End of Code*********//
Have a nice Day
Tarik Filali Ansary
>Hi,
>
>I have got segmentation fault when i use getBuffer() of SoOffscreenRenderer.
>Since i am new user to both C++ and open Inventor, i really do not know how to
>solve this problem. Here is my code:
>
>
> float width, height;
> SbViewportRegion viewPort(renderArea->getSize());
> SoOffscreenRenderer *renderer = new SoOffscreenRenderer(viewPort);
> unsigned char *buffer = (unsigned char *)NULL;
> ALLOCATE(buffer, unsigned char, 4*imageWidth*imageHeight);
> if(sceneGraphInitialised)
> {
> if (renderer)
> {
> buffer = renderer->getBuffer(); //this line causes fault.
> ...
>if i add 'if(renderer->render(root))' before the above line. I will be logged
>out of the computer.
>
>I am really frustrated. Do you have any idea what causes this problem?
>When you answer my question, can you please either email you reply to me or
>mail
>me the url so that i can read your reply.
>
>Thanks very much.
>
>Alison
|