Re: [osg-users] Tessellation shaders not working with Radeon Cards

2013-01-16 Thread Alexandre Valdetaro
Just tested with Intel HD Graphics 4000 and it is not working as well. It seems 
to be a different problem than the AMD one though.
... 

Thank you!

Cheers,
Alexandre

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





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


Re: [osg-users] Tessellation shaders not working with Radeon Cards

2012-12-05 Thread Alexandre Valdetaro
Hi,

I have been trying to render using tessellation shaders with OSG in a Win7 x64 
with 2 different Radeon cards (obviously with support for hardware 
tessellation) but they are behaving very strangely. They show nothing in FILL 
mode but work in LINE or POINT mode. Also, even in these modes backface culling 
culls everything...

I have tested with NVidia cards and everything seemed to work normally.

The very osg example osgtessellationshaders is not working here. 

Tried with OSG 3.0.1 and 3.1.2, already updated the AMD drivers and none worked.

BTW, when i used OpenGL code inside an OSG node everything seems to work fine.

Has anyone successfuly executed the osgtessellationshaders in a win7 x64 with a 
radeon card?

EDIT:

After trying to isolate the problem, it seems that the first 2 vertices of 
every patch that is passed to osg are repeated for the rest of the patches. 
I.e. when passing an index array of (1,3,2,0) and a vertex array of (A,B,C,D), 
i expected to receive in the shader a primitive (B,D,C,A), but i receive 
(B,D,D,B). Htat is, the first to indices are always repeated.

I do not have much experience with osg, so I cannot investigate much further 
than that.

... 

Thank you!

Cheers,
Alexandre

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





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


Re: [osg-users] Tessellation

2012-06-05 Thread Bob Slobodan
Hi,


 
 You original asked for vertices... now you want triangles... is that
 because you now know how to get the vertices, or is it that you now
 know what you want more precisely??


I knew how to get the vertex array, but the problem is that I don't know how to 
get the vertices for each sub-polygon (triangles) generated by the tessellation.


 Is that you are asking how to get the primitive data from a
 PrimitiveSet


Basically yes. My problem is that I don't really get how the tesselation works 
and how to create new polygons using the geometry modified by the tessellation. 
I thought that the tesselation would simply add new PrimitiveSet such as 
DrawArrays and that I could have created my new polygons using the getFirst() 
and getCount() function of DrawArrays with my vertexArray. Unfortunately, when 
I look at my geometry after the tesselation, it only has DrawElementsUByte, and 
I don't see how I could get a list of triangles from this PrimitiveSet. I've 
looked at the DOC, the headers and the source but I don't see what to do.


 Might I also ask you for what purpose you want to know the
 vertices/primitive data? What are you trying to do with it?


For my project, I had to create a class that handles Surfaces (it displays 
anykind of polygon and it has some useful tools). And I have to implement a 
tool that triangulate the polygon and create new Surfaces with each triangle 
; so instead of trying to implement my own tessellation algo, I thought I would 
simply use the osg tessellation.

I'm really sorry for my lack of precision in my previous posts. And thank you a 
lot for taking the time to help me.

Cheers,
Bob

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





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


Re: [osg-users] Tessellation

2012-06-05 Thread Robert Osfield
Hi Bob,

The OSG's DrawElements*  encapsulate OpenGL's glDrawElements call, so
it might be best if you just looked up OpenGL documentation online in
books to see how the indices in the DrawElementsUByte/UShort map to
triangles.

Another alternative to looking at the low level primitives is to use a
functor like the TriangleIndexFunctor or TriangleFunctor.  Have a
search through the OSG code base to see places where this used.

Robert.

On 5 June 2012 10:50, Bob Slobodan qgalv...@msn.com wrote:
 Hi,



 You original asked for vertices... now you want triangles... is that
 because you now know how to get the vertices, or is it that you now
 know what you want more precisely??


 I knew how to get the vertex array, but the problem is that I don't know how 
 to get the vertices for each sub-polygon (triangles) generated by the 
 tessellation.


 Is that you are asking how to get the primitive data from a
 PrimitiveSet


 Basically yes. My problem is that I don't really get how the tesselation 
 works and how to create new polygons using the geometry modified by the 
 tessellation. I thought that the tesselation would simply add new 
 PrimitiveSet such as DrawArrays and that I could have created my new polygons 
 using the getFirst() and getCount() function of DrawArrays with my 
 vertexArray. Unfortunately, when I look at my geometry after the tesselation, 
 it only has DrawElementsUByte, and I don't see how I could get a list of 
 triangles from this PrimitiveSet. I've looked at the DOC, the headers and the 
 source but I don't see what to do.


 Might I also ask you for what purpose you want to know the
 vertices/primitive data? What are you trying to do with it?


 For my project, I had to create a class that handles Surfaces (it displays 
 anykind of polygon and it has some useful tools). And I have to implement a 
 tool that triangulate the polygon and create new Surfaces with each 
 triangle ; so instead of trying to implement my own tessellation algo, I 
 thought I would simply use the osg tessellation.

 I'm really sorry for my lack of precision in my previous posts. And thank you 
 a lot for taking the time to help me.

 Cheers,
 Bob

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





 ___
 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] Tessellation

2012-06-05 Thread Jason Daly

On 06/05/2012 05:50 AM, Bob Slobodan wrote:

Basically yes. My problem is that I don't really get how the tesselation works 
and how to create new polygons using the geometry modified by the tessellation. 
I thought that the tesselation would simply add new PrimitiveSet such as 
DrawArrays and that I could have created my new polygons using the getFirst() 
and getCount() function of DrawArrays with my vertexArray. Unfortunately, when 
I look at my geometry after the tesselation, it only has DrawElementsUByte, and 
I don't see how I could get a list of triangles from this PrimitiveSet. I've 
looked at the DOC, the headers and the source but I don't see what to do.


Note that DrawElementsUByte essentially is-a std::vectorGLubyte which 
stores indices into the vertex attribute arrays.  Traverse the vector to 
get the indices, then look up the specific vertex position, normal, etc, 
in the appropriate vertex attribute array.


--J

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


Re: [osg-users] Tessellation

2012-06-05 Thread Bob Slobodan
Hi,


 Another alternative to looking at the low level primitives is to use a
 functor like the TriangleIndexFunctor or TriangleFunctor. Have a
 search through the OSG code base to see places where this used. 


Exactly what I was searching for.

Thanks a lot !!!

Cheers,
Bob

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





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


Re: [osg-users] Tessellation

2012-06-04 Thread Bob Slobodan
Really no one has a clue about how to do it ?

I tried to look at the getPrimList and the getContours functions of the 
tessallator but it seems the array are the same as before the tesselation. I 
also tried to look at the PrimitiveSetList of my geometry but I can only find 
one after the tessellation (I thought the tesselation would add new 
PrimitiveSet) and I really don't see where to get the information that I need 
to create my new surfaces.
No one has a clue ?

Thank you!

Cheers,
Bob

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





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


Re: [osg-users] Tessellation

2012-06-04 Thread Robert Osfield
On 4 June 2012 13:31, Bob Slobodan qgalv...@msn.com wrote:
 Really no one has a clue about how to do it ?

More likely that no one has a real clue what you are asking and after.

Getting a vertex array from an osg::Geometry is easy... just look at
the Geometry header and you'll find a getVertexArray() method, but I'm
guessing this isn't really what you are asking, which then leaves
wonder what you actually mean.

 I tried to look at the getPrimList and the getContours functions of the 
 tessallator but it seems the array are the same as before the tesselation. I 
 also tried to look at the PrimitiveSetList of my geometry but I can only find 
 one after the tessellation (I thought the tesselation would add new 
 PrimitiveSet) and I really don't see where to get the information that I need 
 to create my new surfaces.
 No one has a clue ?

Yep, no one has a clue what you actually mean :-)

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


Re: [osg-users] Tessellation

2012-06-04 Thread Bob Slobodan
Hi,
Sorry, my bad.

Basically, I want to triangulate polygons. I have polygon with more than 3 
vertices and I want to retrieve the sub-polygons (simple triangles) using the 
osg tesselation tool.

Here is some code. In my surface class, after creating my geometry, I 
tessellate it if it has more than 3 vertex :


Code:

geometry-addPrimitiveSet(new 
osg::DrawArrays(osg::PrimitiveSet::POLYGON,0,vertices-size()));

tessellator = new osgUtil::Tessellator();

if(vertices.size()3){

tessellator-setTessellationType(osgUtil::Tessellator::TESS_TYPE_POLYGONS);
tessellator-setWindingType( 
osgUtil::Tessellator::TESS_WINDING_NONZERO);
tessellator-retessellatePolygons(*geometry);
}




And what I would like to do now is to get the list of triangles from my 
geometry.

By looking at the code of the OSG tesselator, I understood that it creates new 
PrimitiveSet but I can't figure out how exactly how to do it.

Sorry again and thank you!

Bob

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





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


Re: [osg-users] Tessellation

2012-06-04 Thread Robert Osfield
On 4 June 2012 16:01, Bob Slobodan qgalv...@msn.com wrote:
 And what I would like to do now is to get the list of triangles from my 
 geometry.

You original asked for vertices... now you want triangles... is that
because you now know how to get the vertices, or is it that you now
know what you want more precisely??

 By looking at the code of the OSG tesselator, I understood that it creates 
 new PrimitiveSet but I can't figure out how exactly how to do it.

How to do what?  Do the tessellation - your code you posted does that
so I presume you mean how do you get the PrimitiveSet's which is
pretty easy just look at the header for osg::Geometry and you'll find
getPrimitiveSets().

Is that you are asking how to get the primitive data from a
PrimitiveSet???  Again go have a look at the headers it'll tell you
how to access the data within.

Might I also ask you for what purpose you want to know the
vertices/primitive data?  What are you trying to do with it?

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


Re: [osg-users] Tessellation

2011-08-04 Thread Michael Shikin

Glenn Waldron wrote:
 
 Yes, that is what I'm saying, you will have to remove those extraneous 
 triangles from the convex mesh by hand. 
 

DelauneyTriangulator returns to me triangles as a pointer to DrawElementsUInt. 
How can I remove unnecessary triangles from it?

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





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


Re: [osg-users] Tessellation

2011-08-04 Thread Glenn Waldron
On Thu, Aug 4, 2011 at 2:13 AM, Michael Shikin xavier...@yandex.ru wrote:


 Glenn Waldron wrote:
 
  Yes, that is what I'm saying, you will have to remove those extraneous
 triangles from the convex mesh by hand.
 

 DelauneyTriangulator returns to me triangles as a pointer to
 DrawElementsUInt. How can I remove unnecessary triangles from it?


Every set of 3 values in the DrawElements array forms a triangle. Each value
is an index into the VertexArray list in your Geometry. Go through and find
any vertex that falls outside your original boundary and remove it's
indicies from the DrawElements.

There is a function DelaunayTriangulator::removeInternalTriangles that does
the opposite operation. You could probably use that as a template.

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


Re: [osg-users] Tessellation

2011-08-03 Thread Michael Shikin

Glenn Waldron wrote:
 Michael,
 
 Perhaps you could use the osgUtil::DelauneyTriangulator to triangulate your 
 point mesh. This will create a convex mesh. You can try to use the 
 Constraints to define the boundaries, and then remove the exterior triangles 
 afterwards. Just an idea.
  Glenn Waldron / Pelican Mapping / @glennwaldron
 

Can you give me an example of this? I've tried DelauneyTriangulator, but I have 
no clue how to remove exterior triangles... Example delauney in osgexamples 
hasn't helped me.

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





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


Re: [osg-users] Tessellation

2011-08-03 Thread Glenn Waldron
On Wed, Aug 3, 2011 at 3:56 AM, Michael Shikin xavier...@yandex.ru wrote:


 Glenn Waldron wrote:
  Michael,
 
  Perhaps you could use the osgUtil::DelauneyTriangulator to triangulate
 your point mesh. This will create a convex mesh. You can try to use the
 Constraints to define the boundaries, and then remove the exterior triangles
 afterwards. Just an idea.
 
 Glenn Waldron / Pelican Mapping / @glennwaldron
 

 Can you give me an example of this? I've tried DelauneyTriangulator, but I
 have no clue how to remove exterior triangles... Example delauney in
 osgexamples hasn't helped me.


I don't think it has a method to remove exterior triangles. You might have
to just test each vertex to see if it's inside the constraint boundary, and
if not then remove it from the triangulated mesh.

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


Re: [osg-users] Tessellation

2011-08-03 Thread Michael Shikin

Glenn Waldron wrote:
 
 I don't think it has a method to remove exterior triangles. You might have to 
 just test each vertex to see if it's inside the constraint boundary, and if 
 not then remove it from the triangulated mesh.
 

And what about edges outside the boundary? Using your method, I will receive a 
convex surface, while the convent is necessary to me.

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





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


Re: [osg-users] Tessellation

2011-08-03 Thread Glenn Waldron
On Wed, Aug 3, 2011 at 11:19 AM, Michael Shikin xavier...@yandex.ru wrote:


 Glenn Waldron wrote:
 
  I don't think it has a method to remove exterior triangles. You might
 have to just test each vertex to see if it's inside the constraint boundary,
 and if not then remove it from the triangulated mesh.
 

 And what about edges outside the boundary? Using your method, I will
 receive a convex surface, while the convent is necessary to me.


Yes, that is what I'm saying, you will have to remove those extraneous
triangles from the convex mesh by hand.

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


Re: [osg-users] Tessellation

2011-08-03 Thread Glenn Waldron
On Wed, Aug 3, 2011 at 11:19 AM, Michael Shikin xavier...@yandex.ru wrote:


 Glenn Waldron wrote:
 
  I don't think it has a method to remove exterior triangles. You might
 have to just test each vertex to see if it's inside the constraint boundary,
 and if not then remove it from the triangulated mesh.
 

 And what about edges outside the boundary? Using your method, I will
 receive a convex surface, while the convent is necessary to me.


Yes, that is what I'm saying, you will have to remove those extraneous
triangles from the convex mesh by hand.

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


Re: [osg-users] Tessellation

2011-08-02 Thread Glenn Waldron
Michael,

Perhaps you could use the osgUtil::DelauneyTriangulator to triangulate your
point mesh. This will create a convex mesh. You can try to use the
Constraints to define the boundaries, and then remove the exterior triangles
afterwards. Just an idea.

Glenn Waldron / Pelican Mapping / @glennwaldron


On Tue, Aug 2, 2011 at 3:55 AM, Michael Shikin xavier...@yandex.ru wrote:

 So, nobody knows how to solve my problem?  :(
 There're points designating borders of concave poly, and there're points
 inside this poly. How can I build correct concave surface with this data?

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




 ___
 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] Tessellation

2011-08-02 Thread Sergey Kurdakov
Hi Michael,

you might want to use

http://tetgen.berlios.de/

it has examples - the triangulation will take just one call (it allows to
define contstrains in natural way ), or

http://gts.sourceforge.net/

or as it was advised use osgUtil::DelauneyTriangulator ( thouht I personally
never tried it ).

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


Re: [osg-users] tessellation shaders supported?

2010-09-22 Thread Michael Weiblen
Hi,

VertexProgram/FragmentProgram are for the older assembly-level
programmability with ARB VP/FP.

osg::Shader is for the newer GLSL programming interface.  osg::Shader
would be the place to add support for new GLSL shader stages such as
tessellation.

cheers
-- mew

-- 
Mike Weiblen -- Black Hawk, Colorado USA -- http://mew.cx/



On Wed, Sep 22, 2010 at 11:05 AM, Waldemar Schwan
waldemar.sch...@iais.fraunhofer.de wrote:
 Hi,

 my want to use the new tessellation control and tessellation evaluation
 shaders that are new in OpenGL 4.
 Is there support for them in OSG trunk?

 I only found
   VertexProgramm
 (http://www.openscenegraph.org/projects/osg/browser/OpenSceneGraph/trunk/src/osg/VertexProgram.cpp
 )
 and
   FragmentProgramm (
 http://www.openscenegraph.org/projects/osg/browser/OpenSceneGraph/trunk/src/osg/FragmentProgram.cpp
 )

 Also I understand there is another way to create shaders, shown in the
 geometry shader example
 (http://www.openscenegraph.org/projects/osg/browser/OpenSceneGraph/trunk/examples/osggeometryshaders/osggeometryshaders.cpp#L116)
 .
 I noted that *new* osg::Shader( osg::Shader::GEOMETRY, geomSource )
 actually uses open GL constants
 (http://www.openscenegraph.org/projects/osg/browser/OpenSceneGraph/trunk/include/osg/Shader#L87).

 Since osg::Shader seams pretty generic is it a good idea to just use the
 matching GL constant ( something like GL_TESSELLATION_CONTROL_SHADER or so)?

 I guess my question is: How do I use tessellation shaders with OSG?

 Best regards
   Waldemar
 ___
 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