Hi,

On Sun, 2010-09-26 at 11:55 +0200, Weiyu Yi wrote:
> Hello,
> 
> I am using OpenSG with CUDA together, now there are some problems.
> 
> Thanks
> 
> 1)*****************************************************
> 
> As I know, in OpenSG 1.8 there is a method getVBO(), with which the
> user can get the buffer object id of the geometry.
> 
> Is there any method like this in OpenSG 2.0? I have used roughly
> looked through the code from 2.0 , there are such methods like:
> 
> //-------------------
> virtual GLenum getBufferType(void); // buffer type for VBOs
> //-------------------
> 
> in class OSGGeoVectorProperty and OSGGeoIntergralProperty
> 
> but it offers only the type but no id
> 
> 2) ***************************************************
> 
> It's required that man has to explicitly make OpenSG use vbo or vbo is
> automaticly activated?

have a look at 

 http://github.com/vossg/OSGAddOnsGV

the Compute subfolder contains an example to use OpenSG 2.x with
VBO changing Cuda programms.

The test program in Compute/SimpleCuda also contains some more variants
to change the vbo data.

If you have further questions let me know. 

In general you should do something like:

    pWin->validateGLObject(pnts->getGLId(), pEnv);

    OSG::UInt32 uiPntsVBOId = pWin->getGLObjectId(pnts->getGLId());

    cRes = cudaGLRegisterBufferObject(uiPntsVBOId);

    if(cRes != cudaSuccess)
    {
        fprintf(stderr, "RegisterRes %d\n", OSG::UInt32(cRes));
    }

    void *pMappedPoints = NULL;

    cRes = cudaGLMapBufferObject(&pMappedPoints, uiPntsVBOId);   

    if(cRes != cudaSuccess)
    {
        fprintf(stderr, "MappedPtr, Res : %d\n", 
                OSG::UInt32(cRes));

    }

 .
 .

 your cuda computation here

 .
 .

    cRes = cudaGLUnmapBufferObject(uiPntsVBOId);

    if(cRes != cudaSuccess)
    {
        fprintf(stderr, "UnmapRes %d\n", OSG::UInt32(cRes));
    }

    cRes = cudaGLUnregisterBufferObject(uiPntsVBOId);

    if(cRes != cudaSuccess)
    {
        fprintf(stderr, "UnRegisterRes %d\n", OSG::UInt32(cRes));
    }


where pnts is the GeoPnt3f property pointer. The only trick is to get
this executed at the right place (you need the GL context). Check the
test program for some variants of how to place this sequence correctly.

Oh, and put     

  OSG::setVBOUsageOnPropertyProtos(true);

after your osgInit calls. This set the VBOUsage flags globally to on (the 
default
is IIRC still off) so you don't have to worry about this when creating the
properties.


> 3) ***************************************************
> 
> Is there any XML parser? In source code I have found XML tokenizer,
> but from API there isn't any.

Where in the source code ? IIRC, there should not be one in 2.x anymore,
the 1.8 xml parts were not taken over as libxml2 / expat should be
available either through the system installation (Linux) or the support
libs build (Windows). Would you need the 1.8 xml support or are either
libxml2 or expat ok for your needs.

kind regards
  gerrit


-- 

Gerrit Voß
盖瑞客
---------------------------------------------------
Centre for Advanced Media Technology (CAMTech)
南洋理工大学, Nanyang Technological University, (NTU)
新加坡,      Singapore
--------------------------------------------------
CAMTech is a joint centre of Fraunhofer-IGD & NTU
--------------------------------------------------

If we communicate everything we ever think, speech 
just becomes static. And all of us become bores.

J. Clarkson




------------------------------------------------------------------------------
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing.
http://p.sf.net/sfu/novell-sfdev2dev
_______________________________________________
Opensg-users mailing list
Opensg-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensg-users

Reply via email to