OpenSceneGraph Forum Forum Index OpenSceneGraph Forum
Official forum which mirrors the existent OSG mailing lists. Messages posted here are forwarded to the mailing list and vice versa.
 
   FAQFAQ    SearchSearch    MemberlistMemberlist    RulesRules    UsergroupsUsergroups    RegisterRegister 
 Mail2Forum SettingsMail2Forum Settings  ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
   AlbumAlbum  OpenSceneGraph IRC ChatOpenSceneGraph IRC Chat   SmartFeedSmartFeed 

Using visitor to transfer material color to geometry color


 
Post new topic   Reply to topic    OpenSceneGraph Forum Forum Index -> General
View previous topic :: View next topic  
Author Message
wernerM
User


Joined: 06 Feb 2013
Posts: 70

PostPosted: Mon Jan 08, 2018 4:14 pm    Post subject:
Using visitor to transfer material color to geometry color
Reply with quote

Hi all,

I'm using gl3 mode in my project by setting
camera->getGraphicsContext()->getState()->setUseModelViewAndProjectionUniforms(_useGL3);
camera->getGraphicsContext()->getState()->setUseVertexAttributeAliasing(_useGL3);

When loading external 3D scenes created in gl2 mode colors of geometries are coded in materials.
I'm sure there is an easy way to check geometries for existence of vertex colors and creating the
vertex colors if necessary from the material in the StateSet by usage of a NodeVisitor.

I did a lot of research but couldn't figure out how to do that.
In recent git sources I found Roberts patch in Material.cpp
********************************
void Material::apply(State& state) const {
    state.Color(_diffuseFront.r(), _diffuseFront.g(), _diffuseFront.b(), _diffuseFront.a());
}
********************************
How can I do the same in a NodeVisitor?

Any help is highly appreciated.

- Werner -

------------------
Post generated by Mail2Forum
Back to top
View user's profile Send private message
wernerM
User


Joined: 06 Feb 2013
Posts: 70

PostPosted: Mon Jan 08, 2018 6:22 pm    Post subject:
Using visitor to transfer material color to geometry color
Reply with quote

OK, I'm answering my own post.
The issue is solved. Sorry for the noise here.

- Werner -

Am 08.01.2018 um 17:11 schrieb Werner Modenbach:

Quote:
Hi all,

I'm using gl3 mode in my project by setting
camera->getGraphicsContext()->getState()->setUseModelViewAndProjectionUniforms(_useGL3);
camera->getGraphicsContext()->getState()->setUseVertexAttributeAliasing(_useGL3);

When loading external 3D scenes created in gl2 mode colors of geometries are coded in materials.
I'm sure there is an easy way to check geometries for existence of vertex colors and creating the
vertex colors if necessary from the material in the StateSet by usage of a NodeVisitor.

I did a lot of research but couldn't figure out how to do that.
In recent git sources I found Roberts patch in Material.cpp
********************************
void Material::apply(State& state) const {
    state.Color(_diffuseFront.r(), _diffuseFront.g(), _diffuseFront.b(), _diffuseFront.a());
}
********************************
How can I do the same in a NodeVisitor?

Any help is highly appreciated.

- Werner -


Quote:
_______________________________________________
osg-users mailing list
(
Only registered users can see emails on this board!
Get registred or enter the forums!
)
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

--
TEXION Software Solutions, Rotter Bruch 26a, D-52068 Aachen
Phone: +49 241 475757-0
Fax: +49 241 475757-29
Web: http://texion.eu
eMail: (
Only registered users can see emails on this board!
Get registred or enter the forums!
)

------------------
Post generated by Mail2Forum
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    OpenSceneGraph Forum Forum Index -> General All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum

Similar Topics
Topic Author Forum Replies Posted
No new posts Scaling visitor not working as expected wernerM General 2 Tue Jan 09, 2018 2:01 pm View latest post
No new posts Specifying indices of triangle vertic... antiro42 General 1 Thu Dec 21, 2017 12:44 pm View latest post
No new posts How to access the view parameters fro... Miguel General 1 Fri Sep 22, 2017 5:31 pm View latest post
No new posts setAttribute / Material issue Valzul General 4 Wed Aug 16, 2017 8:15 am View latest post
No new posts ViewerBase::frame() method slow after... gambr General 8 Fri Jul 21, 2017 9:11 am View latest post


Board Security Anti Bot Question MOD - phpBB MOD against Spam Bots
Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP