Hi Cedric,
On Sat, Dec 11, 2010 at 4:52 PM, Cedric Pinson
<[email protected]> wrote:
> include/osg/TriangleIndexFunctor:187: error: call of overloaded
> ‘operator()(unsigned int&, const unsigned char&, const unsigned char&)’
> is ambiguous
I'm curious to get to the bottom of this. Is this error in
conjunction with a functor that implements both :
operator() (uint, uint, uint)
and
operator() (uchar, uchar, uchar)?
I can't think of how it can be ambiguous otherwise. All the functors
used with TriangleIndexFunctor I've written have all been of the
(uint,uint,uint) type. Is this an error you get with your own code
or the OSG? If the later which source files?
Regardless of getting to the bottom of this odd compiler error I've
ammed the drawElements method so that it doesn't use unsigned int
first, instead uses a typedef for the Index type, and have
IndexPointer use this, and have the first be of type Index.
virtual void drawElements(GLenum mode,GLsizei count,const GLubyte* indices)
{
if (indices==0 || count==0) return;
- typedef const GLubyte* IndexPointer;
-
+ typedef GLubyte Index;
+ typedef const Index* IndexPointer;
+
switch(mode)
{
case(GL_TRIANGLES):
@@ -180,7 +181,7 @@
case(GL_TRIANGLE_FAN):
{
IndexPointer iptr = indices;
- unsigned int first = *iptr;
+ Index first = *iptr;
++iptr;
for(GLsizei i=2;i<count;++i,++iptr)
{
@@ -202,7 +203,8 @@
{
if (indices==0 || count==0) return;
- typedef const GLushort* IndexPointer;
+ typedef GLushort Index;
+ typedef const Index* IndexPointer;
This way no casting will need to be done anywhere in the method
itself. Casting may still happen when applying the templated functor
itself, but at least this will be only done when required.
This change is now checked into svn/trunk.
Cheers,
Robert.
_______________________________________________
osg-submissions mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org