<html>
<head>
<meta content="text/html; charset=windows-1252"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<font face="Liberation Mono">Hi, <br>
<br>
An attribute is identified by a type (enum Type) and a member
(int). The StateAttribute getters and setters have the member
parameter defaulted to 0. <br>
<br>
I use some custom state attributes:<br>
- I use the type as an attribute class (i.e. MATERIAL for BRDF
related parameters...)<br>
- I use the member of prevent conflicts with the OSG legacy
attributes<br>
<br>
</font><br>
<div class="moz-cite-prefix">On 18/10/2015 22:58, Jannik Heller
wrote:<br>
</div>
<blockquote cite="mid:1445201885.m2f.65369@forum.openscenegraph.org"
type="cite">
<pre wrap="">Hi,
How is one supposed to use a custom StateAttribute?
The docs say that:
"When extending the osg's StateAttribute's simply define your own Type value which is unique, using the StateAttribute::Type enum as a guide of what values to use"
As it is, returning a unique value simply isn't possible because the getType() function returns an enum:
/** Return the Type identifier of the attribute's class type.*/
virtual Type getType() const = 0;
Type is the enum defined here containing the default types, with no room for user types:
Code:
enum Type
{
TEXTURE,
POLYGONMODE,
....
FRAME_BUFFER_OBJECT
};
I suppose that you could choose some integer, static_cast it back to enum Type and then hope that will work. (it will most likely work if the enum has a large enough bit size, but it's technically undefined behaviour, so I can't imagine that's how Robert intended it to be used).
To me it seems the feature advertised in docs of creating your own StateAttributes simply isn't possible, just because of this one function returning enum instead of int, which would be an easy fix. Am I missing something here?
Cheers,
Jannik
------------------
Read this topic online here:
<a class="moz-txt-link-freetext" href="http://forum.openscenegraph.org/viewtopic.php?p=65369#65369">http://forum.openscenegraph.org/viewtopic.php?p=65369#65369</a>
_______________________________________________
osg-users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:osg-users@lists.openscenegraph.org">osg-users@lists.openscenegraph.org</a>
<a class="moz-txt-link-freetext" href="http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org">http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org</a>
</pre>
</blockquote>
<br>
</body>
</html>