Re: [osg-users] a bug or feature in the osgb writer?

2012-08-28 Thread Wang Rui
Hi John,

Oh, so you are talking about the saving/reading of geometry shaders,
not just geometries. :-)

After checking the osg::Program serializer, I can confirm this is a
bug. As GL_POINTS is defined as 0, the serializer will ignore it as
incorrectly recognize it as GL_NONE. And when you load the file again,
the Program class will use a default value for GeometryInputType, that
is, GL_TRIANGLES.

I'll submit the patch to osg-submissions at once. You can also modify
the line at src/osgWrappers/serializers/osg/Program.cpp:

#define PROGRAM_PARAMETER_FUNC( PROP, NAME ) \
static bool check##PROP(const osg::Program attr) \
{ return attr.getParameter(NAME)!=GL_NONE; } \

to

#define PROGRAM_PARAMETER_FUNC( PROP, NAME ) \
static bool check##PROP(const osg::Program attr) \
{ return true; } \

and see if it can work.

Thanks,

Wang Rui


2012/8/28 John Kelso ke...@nist.gov:
 Hi,

 I apologize for the delay in responding.

 Here's my attempt to provide a simple example. I am attaching the three
 referenced files.

 I run my program and dump the node in question into two files: dump.osgt and
 dump.osg.

 If I grep for Geometry in the two files I see:

 dump.osgt:553:  GeometryVerticesOut GL_GEOMETRY_VERTICES_OUT_EXT
 4 dump.osgt:554:  GeometryOutputType GL_GEOMETRY_OUTPUT_TYPE_EXT
 5 dump.osgt:696:osg::Geometry {
 dump.osg:49:GeometryVerticesOut 4
 dump.osg:50:GeometryInputType POINTS
 dump.osg:51:GeometryOutputType TRIANGLE_STRIP
 dump.osg:661:  Geometry {

 That is, the osgt file seems to be missing the line
   GeometryInputType GL_GEOMETRY_INPUT_TYPE_EXT 0

 If I convert dumop.osgt file to an osg file and diff it with the original
 osg
 file I see:

 diff dumpFromOsgt.osg dump.osg

 46c50
  GeometryInputType TRIANGLES
 ---

 GeometryInputType POINTS


 I think the problem is just in the writer, not the reader, because if I
 manually add the missing line to the osgt file it works. And, it if convert
 the modified osgt file to an osg file the input type is now points, not
 triangles.

 I seem to get the same results for osgb as I do for osgt.

 I'm not sure how to answer the question about setVertexArray versus
 setVertexAttribArray. But points.osg is the point data that's loaded.

 I hope this helps. Please let me know if you need anything else that might
 help with solving the problem.

 Thanks,

 John


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


Re: [osg-users] a bug or feature in the osgb writer?

2012-08-12 Thread Wang Rui
Hi John,

2012/8/11 John Kelso ke...@nist.gov

 and the ive run has the line
   Using vertex attribute instead
 repeated eight times. I doubt this has anything to do with it, as the ive
   file is the one that works, but you never know...


I've looked up in the source code and find that the line will be printed in
Geometry::accept(PrimitiveFunctor functor). So I wonder if you don't set
vertex array with the setVertexArray() method but instead set it with
setVertexAttribArray()? I haven't tested such situation with the osgb
format but I don't think it will confuse the writing process... It will
be appreciated if you could provide a small piece of your osg/ive file for
us to find out where the problem is.

Thanks,

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


[osg-users] a bug or feature in the osgb writer?

2012-08-10 Thread John Kelso

Hi all,

I am noticing some odd behavior in the osgb file writer. I will try to
describe it as succinctly as possible. Maybe it's a bug, maybe it's my code.

We are using osg 3.1 0 on a CentOS 6 Linux system.

A fairly large program create a points file that includes some shaders and
textures which operate on the points.

If the program writes the file as an ive or osg file the input geometry type
in the file is POINTS, as is specified in the program, and I get no runtime
errors.

If the program writes the file as an osgb file the input geometry type 
in the file is TRIANGLES, or at least that's what I see when I convert the

osgb file to an osg file. At runtime I get a bunch of spewed messages:

  Warning: detected OpenGL error 'invalid operation' at after 
RenderBin::draw(..)

That is, doing nothing but changing the file type from ive to osgb causes
the error.

Extra information:

I diffed the outputs of:
  env OSGNOTIFYLEVEL=debug OSG_OPTIMIZER=NONE osgconv points.osgb 
pointFromOsgb.osg
and
  env OSGNOTIFYLEVEL=debug OSG_OPTIMIZER=NONE osgconv points.ive 
pointFromIve.osg

and the ive run has the line
  Using vertex attribute instead
repeated eight times. I doubt this has anything to do with it, as the ive
  file is the one that works, but you never know...

I can dump more gory details on request, but as an initial email I thought I'd
see if anyone familiar with the osgb writer had any ideas.

Thanks,

John

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