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 

Is it possible to clear just certain textures in a framebuffer with multi target rendering?


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


Joined: 11 Sep 2017
Posts: 2

PostPosted: Mon Sep 11, 2017 7:48 pm    Post subject:
Is it possible to clear just certain textures in a framebuffer with multi target rendering?
Reply with quote

Hi,
Is it possible to clear just certain textures in a framebuffer with multi target rendering?

i am searching for equivalent functionality for glClearBufferfv.

Any help would be greatly appreciated.

example shader code:

out vec4 fragcolor1; // first target
out vec4 fragcolor2; // second target
void main()
{
fragcolor1 = vec4(1.0,0.0,0.0,1.0);
fragcolor2.g = 1.0;
}
basically i want to initialize first target as osg::Vec4(0.0,0.0,0.0,0.0);
and i want to initialize my second target to osg::Vec4(1.0,0.0,0.0,0.0).

I tried calling setClearColor in osg::Camera, but this initializes both targets to same value.

Thanks & Regards,
amudhan
Back to top
View user's profile Send private message
SMesserschmidt (Sebastian Messerschmidt)
Forum Moderator


Joined: 10 Sep 2013
Posts: 789

PostPosted: Wed Sep 13, 2017 10:37 am    Post subject:
Is it possible to clear just certain textures in a framebuffer with multi target rendering?
Reply with quote

Hi,

This can usually done by setting the explicit drawbuffer and a
consecutive call to glClear with the appropriate color set.
In OSG-terms I'd use a separate camera pass with the appropriate buffers
bound. Another option, if you need to selectively write to a certain
color buffer only is to use the ColorMaski to select the buffers you
need to write to.

Last option is to add the extension to OSG.

Cheers
Sebastian


Quote:
Hi,
Is it possible to clear just certain textures in a framebuffer with multi target rendering?

i am searching for equivalent functionality for glClearBufferfv.

Any help would be greatly appreciated.

example shader code:

out vec4 fragcolor1; // first target
out vec4 fragcolor2; // second target
void main()
{
fragcolor1 = vec4(1.0,0.0,0.0,1.0);
fragcolor2.g = 1.0;
}
basically i want to initialize first target as osg::Vec4(0.0,0.0,0.0,0.0);
and i want to initialize my second target to osg::Vec4(1.0,0.0,0.0,0.0).

I tried calling setClearColor in osg::Camera, but this initializes both targets to same value.

Thanks & Regards,
amudhan

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









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


Joined: 11 Sep 2017
Posts: 2

PostPosted: Wed Sep 13, 2017 12:55 pm    Post subject:
Reply with quote

Hi Sebastian,
Thanks for your reply.
It worked using 2 cameras passes to achieve the result. I was wondering to achieve the same result with single pass. I will be working huge models and i didn't want to run 2 passes.

Is there any plan to add this extension to OSG?

Thank you!

Thanks and Regards,
Amudhan
Back to top
View user's profile Send private message
SMesserschmidt (Sebastian Messerschmidt)
Forum Moderator


Joined: 10 Sep 2013
Posts: 789

PostPosted: Wed Sep 13, 2017 1:35 pm    Post subject:
Is it possible to clear just certain textures in a framebuffer with multi target rendering?
Reply with quote

Hi Amudhan,
Quote:
Hi Sebastian,
Thanks for your reply.
It worked using 2 cameras passes to achieve the result. I was wondering to achieve the same result with single pass. I will be working huge models and i didn't want to run 2 passes.
Since you're doing MRT and multiple passes anyway, can't you simply add
an otherwise empty pass that only clears? So basically binding the
rendertarget you need to clear and do nothing but clear.


Quote:

Is there any plan to add this extension to OSG?
OpenSceneGraph is community driven anyone is invited to contribute. In
my opinion adding extensions is usually a relatively complicated
process, since there are a lot of side effects to be taken into account,
but we're glad to help if you want to try.

Cheers
Sebastian
Quote:

Thank you!

Thanks and Regards,
Amudhan

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









------------------
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 Multiple pointlights deferred renderi... antiro42 General 0 Fri Sep 08, 2017 2:39 pm View latest post
No new posts Multi layer effect rendering problem ... not3not4 General 0 Wed Jul 19, 2017 9:44 am View latest post
No new posts Multi-pass rendering segfault issue qiaokun General 0 Mon May 15, 2017 10:36 am View latest post
No new posts Disable rendering to screen wernerM General 0 Fri Apr 28, 2017 1:13 pm View latest post
No new posts Polygon Rendering bhanu406 General 1 Thu Mar 16, 2017 9:18 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