Re: [osg-users] VBO and vertex attribute data

2012-10-04 Thread Sebastian Messerschmidt

Hi Janna,

can you provide the bits of your code where you setup the attributes in 
the c++ code and the GLSL part where you access it?
I've been using this feature for tangent-space attributes like forever 
and it simply works.

The only thing to keep in mind is the slot numbers and names you are using.

Hi,

I've tried to use gl_MultiTexCoord1 and do   geometry-setTexCoordArray(1, 
secondTexCoords);
  
instead of custom vertex attributes to pass my data and it seems to be working. Does anyone know if there is some kind of problem with using custom vertex attributes ( using methods like setVertexAttribArray ) and VBOs?


Cheers,
Janna

--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=50390#50390





___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] VBO and vertex attribute data

2012-10-04 Thread Janna Terde
Hi Sebastian,

I set the vertex attribute array this way: 

Code:

geometry-setVertexAttribArray(s_attributeIndex, m_vertexAttributes.get());
geometry-setVertexAttribBinding(s_attributeIndex, 
osg::Geometry::BIND_PER_VERTEX);
geometry-setVertexAttribNormalize(s_attributeIndex, GL_FALSE);




and then set up VBO

Code:

geometry-setUseVertexBufferObjects(true);




binding attribute

Code:
program-addBindAttribLocation(vxOSG_HeightFieldParams, 
VxOSG::VxHeightFieldDisplayNode::s_attributeIndex);



and in the update 

Code:

// set dirty on arrays for VBO update
vertices-dirty();
normals-dirty();
geometry-dirtyBound();



 
also I update custom attributes like this

Code:
(*m_vertexAttributes)[index][inEntryID] = inEntryValue;


s_attributeIndex = 15
maybe I am missing something?

I've tried to use tex coord array 2 and it seems to be working. But I would 
like to understand why custom vertex attribute is not working with vbo. 

I have a feeling that I need to set custom attribute array to dirty somehow.

Thank you! 
Janna

--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=50411#50411





___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] VBO and vertex attribute data

2012-10-04 Thread Janna Terde
Btw I am using osg 2.8.3-4, not sure if it could make any difference

--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=50412#50412





___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] VBO and vertex attribute data

2012-10-04 Thread Janna Terde
Ok I think it is working now with

eometry-getVertexAttribArray(s_attributeIndex)-dirty(); 

Thank you :)

--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=50413#50413





___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] VBO and vertex attribute data

2012-10-03 Thread Sebastian Messerschmidt

Hello Janna,

If you use a shader program you'll have to bind the attributes to the 
program:

const std::string name=v_tangent
program-addBindAttribLocation(name, index);

Then in the vertex shader you can access the attribute via:
attribute vec3 v_tangent;

hth
Sebastian


Hi,

I am working on optimizing existing code for height field. I've enabled VBO for 
height field geometry which seems to make draw time faster however it seems can 
not retrieve vertex attribute data in the vertex shader anymore.

Is there a special way of using VBO with geometry which has additional vertex 
attribute data set up? Data is set up on vertex attribute array with the index 
15.
  
Thank you!


Cheers,
Janna

--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=50382#50382





___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] VBO and vertex attribute data

2012-10-03 Thread Janna Terde
This is being done and as I mention it works fine unless I try to use vertex 
buffer object.

so lets say code like this works: 


Code:

geometry-setVertexAttribArray(s_attributeIndex, m_vertexAttributes.get());
geometry-setVertexAttribBinding(s_attributeIndex, 
osg::Geometry::BIND_PER_VERTEX);
geometry-setVertexAttribNormalize(s_attributeIndex, GL_FALSE);




but I can not access custom attribute in the shader anymore with the code like 
this:


Code:

geometry-setUseVertexBufferObjects(true);

geometry-setVertexAttribArray(s_attributeIndex, m_vertexAttributes.get());
geometry-setVertexAttribBinding(s_attributeIndex, 
osg::Geometry::BIND_PER_VERTEX);
geometry-setVertexAttribNormalize(s_attributeIndex, GL_FALSE);




s_attributeIndex is 15. 

Cheers,
Janna

--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=50388#50388





___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] VBO and vertex attribute data

2012-10-03 Thread Janna Terde
Hi,

I've tried to use gl_MultiTexCoord1 and do   geometry-setTexCoordArray(1, 
secondTexCoords); 
 
instead of custom vertex attributes to pass my data and it seems to be working. 
Does anyone know if there is some kind of problem with using custom vertex 
attributes ( using methods like setVertexAttribArray ) and VBOs? 

Cheers,
Janna

--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=50390#50390





___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org