Re: [osg-users] OpenGL error 'invalid enumerant' after RenderBin::draw(, )

2010-12-20 Thread Jean-Sébastien Guay

Hello Evan,


I've written a very simple application which should simply display a sphere. 
The code compiles, but when the viewer runs, the sphere doesn't appear and I 
get the message:
Warning: detected OpenGL error 'invalid enumerant' after RenderBin::draw(,)

I have no idea what this means or how to fix it. I was able to compile and run 
successfully on a Linux system, but I've had no luck with Windows and Visual 
C++. Can anybody help me out?


We will not be able to help much if you don't show your code, because 
what you describe is very simple and should work (at least as far as we 
can see from your description). If we see the code we might be able to 
tell you what's wrong.


Also, have you looked at the OSG examples and the Getting Started Guide 
to make sure you're doing things right?


J-S
--
__
Jean-Sebastien Guayjean-sebastien.g...@cm-labs.com
   http://www.cm-labs.com/
http://whitestar02.webhop.org/
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] OpenGL error 'invalid enumerant' after RenderBin::draw(, )

2010-12-20 Thread Evan Sheffield

Skylark wrote:
 Hello Evan,
 
 We will not be able to help much if you don't show your code, because 
 what you describe is very simple and should work (at least as far as we 
 can see from your description). If we see the code we might be able to 
 tell you what's wrong.
 
 Also, have you looked at the OSG examples and the Getting Started Guide 
 to make sure you're doing things right?
 
 J-S
 -- 
  --
 Post generated by Mail2Forum


Hello,

Yes, I followed the startup guide to get OSG working on my computer. This is 
the simple code that I was trying:



Code:
#include osg/Group
#include osg/LightSource
#include osg/ShapeDrawable

#include osgViewer/Viewer

using namespace osg;

// main function
int main()
{
  // create the root node of the scene graph
  ref_ptrGroup root = new Group;

  // create a node to the geometry of a spherical object
  ref_ptrGeode ballNode = new Geode;
  ballNode-addDrawable(new ShapeDrawable(new Sphere));

  // create a distant light, with 0 for the homogeneous coord
  Vec4 lightDirection(1, -1, 1, 0);
  ref_ptrLightSource ls = new LightSource;
  ls-getLight()-setPosition(lightDirection);
  // set the intensity properties for the light
  ls-getLight()-setAmbient(Vec4(0.2, 0.2, 0.2, 1.0));
  ls-getLight()-setDiffuse(Vec4(1.0, 1.0, 0.7, 1.0));
  ls-getLight()-setSpecular(Vec4(1.0, 0, 0, 1.0)); 

  // assemble the node hierarchy
  root-addChild(ls.get());
  root-addChild(ballNode.get());

  // create the viewer helper object
  osgViewer::Viewer viewer;
  viewer.setSceneData(root.get());
  viewer.realize();

while( !viewer.done() )
{
viewer.frame();
}

return 0;
}



Thanks in advance for your help.

~Evan

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





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


Re: [osg-users] OpenGL error 'invalid enumerant' after RenderBin::draw(, )

2010-12-20 Thread Jean-Sébastien Guay

Hello Evan,

The default viewer camera position is at (0,0,0), which turns out to be 
inside your sphere. So you just see the inside of your sphere (not a 
very interesting view point to be sure! :-) ).


You have used the while(!viewer.done()) viewer.frame() method of coding 
the main loop, and so no camera manipulator is created automatically by 
the viewer, and you don't add any camera manipulator yourself, so you 
will need to set the viewer camera's view matrix yourself to be able to 
see the object.


Add viewer.getCamera()-setViewMatrixAsLookAt(osg::Vec3(0,-10,0), 
osg::Vec3(0,0,0), osg::Vec3(0,0,1)); just before your frame loop to see 
the object. You can also call this method at different times inside the 
frame loop (or in callbacks) if you want to animate the camera's position.


You could also opt to add a camera manipulator, then you would add 
viewer.setCameraManipulator(new osgGA::TrackballManipulator); before 
your frame loop, for example. The camera manipulator will center on your 
scene's bounds on the first frame, so you will see the whole scene and 
will be able to move/rotate the camera around.


With either of these changes I can see the sphere just fine (and with 
the correct yellowish lighting as you've set in your light source's 
diffuse light color). Of course without a camera manipulator you won't 
be able to rotate the camera with the mouse (unless you code that 
yourself in an event handler that sets the camera's view matrix, for 
example).


As for your OpenGL messages, I don't get any of those when running your 
code. They could be related to your driver. These messages are sometimes 
false positives, meaning they may be shown even if nothing is wrong. I 
would recommend checking if there is an updated driver for your video 
card and see if they go away.


Hope this helps,

J-S
--
__
Jean-Sebastien Guayjean-sebastien.g...@cm-labs.com
   http://www.cm-labs.com/
http://whitestar02.webhop.org/
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


[osg-users] OpenGL error 'invalid enumerant' after RenderBin::draw(, )

2010-12-19 Thread Evan Sheffield
Hi,

I've had some problems getting my OSG applications to render properly. I'm 
using Microsoft Visual C++ 2010 Express.

I've written a very simple application which should simply display a sphere. 
The code compiles, but when the viewer runs, the sphere doesn't appear and I 
get the message:
Warning: detected OpenGL error 'invalid enumerant' after RenderBin::draw(,)

I have no idea what this means or how to fix it. I was able to compile and run 
successfully on a Linux system, but I've had no luck with Windows and Visual 
C++. Can anybody help me out?

... 

Thank you!

Cheers,
Evan

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





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