Hi, ok as the mailing list seem to hang the last days this might have been answered before ;-)
On Thu, 2004-01-29 at 17:41, Tensor G wrote: > hello, > after almost one hour of struggling, i got the problem with the alpha chan: > > OpenSG (or at least my version (which I can't change) ) , just use "fake" > GeoColor4fPtr structures! > I mean, when i ->addValue it i can pass just Color3f stuctures and alpha is > internally set to 1.f. Since all the other stuff is private or protected, i > just can't see a way of making my own transparencies. well this is half the truth, yes for the generic interface (that is the one you are using) we indeed use Color3f as the generic type into which everything is converted. > How can i override the damn private/protected stuff and set MY alpha values? > You may say that i can set transparency from material, but that's the point, > i don't want to use it... i am tring to per-vertex lighting, so i need to > handle single vertex colors. > > My idea was to get transparency value from the material, pack it in a > GeoColor4f structure, make my pervertex calculation, override the material > thingy and then render the whole stuff. > So, first question: Is that possible? > second question: how can i set alpha channel using something like > > geoyellow->addValue(Color4f(1.0,1.0,0.0,0.5)); ? as Matthias pointed out the correct way of doing this is : geoyellow->getFieldPtr()->push_back(yellow); getFieldPtr returns you the 'real' storage array of your values (which is a MFColor4f), using this you can modify all the elements you need. > third question: in the desperate scenario -> can i use a MaterialChunk with > transparency info, but no ambient nor diffuse color, and then use MY per > vertex calculations? No, it would not work as the geometry colors will override any color information set by the material and as OpenGL groups color and alpha together you will just override the material one while drawing the geometry. And we do not push the alpha value from the material down to the geometry. A last comment after you set the color including the alpha value by the method mentioned above make sure your material contains the required blend chunk otherwise OpenGL blending will be disabled and you will not get any transparencies too despite the fact that they are set in your vertex colors. regards, gerrit ------------------------------------------------------- The SF.Net email is sponsored by EclipseCon 2004 Premiere Conference on Open Tools Development and Integration See the breadth of Eclipse activity. February 3-5 in Anaheim, CA. http://www.eclipsecon.org/osdn _______________________________________________ Opensg-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/opensg-users
