Re: [osg-users] pass mat4 as attribute for glsl

2018-11-26 Thread Cong Ye
I found the gpuculling example. It may solve my problem..

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





___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


[osg-users] pass mat4 as attribute for glsl

2018-11-26 Thread Cong Ye
Hi,

I am currently working on a project requires gpu instancing. I worked out a way 
to do the instancing with vec4 as position attribute in. However, in the real 
case, instances need to be scaled/rotated/translated. Now, I want to send the 
transform matrix as an attribute to the shader. Normally, general opengl uses 
glVertexAttribPointer with offset and glVertexAttribDivisor to sperate mat4 to 
vec4 then pass to the shader. However, I don't find the replacement function to 
do the offset data structure pass. Could someone enlighten me about it, please? 

thanks very much!

... 

Thank you!

Cheers,
Cong

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





___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] update node in view using cullcallback

2018-08-29 Thread Cong Ye
One following question is how can I do the same for drawable and attribute 
callback?


sirian_ye wrote:
> Hi,
> 
> I am recently working on a big scene simulation project. To optimize the 
> performance, we consider to only update elements (material color, position, 
> rotation etc.) in frustum or are not culled. The most straightforward method 
> is using cullcallback to do the update. I implemented it and it works. 
> However, after come across some online articles, most of them are not 
> suggested to use cullcallback. Could I ask is there any drawbacks to do so? 
> 
> Thank you!
> 
> Cheers,
> Cong


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





___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Shadow in GraphicsWindowEmbedded

2018-08-29 Thread Cong Ye
Hi Robert

Thanks very much for your reply. I check the osgQt after your suggestion, I 
know the problem now. However, it still doesn't work after I add gl_back. As it 
is not high priority, I will implement shadow myself later. 


robertosfield wrote:
> On Thu, 16 Aug 2018 at 09:29, Cong Ye <> wrote:
> 
> > I am currently using the osgShadow NodeKist. It only works when I use 
> > osgViewer as default graphics context. Now the case is, I have to assign a 
> > third party graphics context to the main camera as we are using a Qt Gui 
> > for buttons etc. After I assign osgViewer::GraphicsWindowEmbedded to the 
> > main camera, the scene cannot be drawn. Only clear color is displayed. So I 
> > assume that since the graphics context has been changed, do i have to 
> > specify where the shadow texture need to be binded?
> > 
> 
> There isn't any special you need to do with osgShadow, it'll be
> looking after itself.
> 
> The problem you have is mostly likely down to the issues with the Qt
> integration, and using osgShadow isn't revelling this exisiting
> problem rather than causing it.
> 
> My best guess is that you haven't set the Draw/ReadBuffers correctly
> for you viewer level Cameras.
> 
> If this doesn't work then please think about using osgQt.
> 
> Robert.
> ___
> osg-users mailing list
> 
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
> 
>  --
> Post generated by Mail2Forum


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





___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


[osg-users] update node in view using cullcallback

2018-08-29 Thread Cong Ye
Hi,

I am recently working on a big scene simulation project. To optimize the 
performance, we consider to only update elements (material color, position, 
rotation etc.) in frustum or not culled. The most straightforward method come 
to me is using cullcallback to do the update. I implemented it and it works. 
However, after come across some online articles, most of them are not suggested 
to use cullcallback. Could I ask is there any drawbacks to do so? 

Thank you!

Cheers,
Cong

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





___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Shadow in GraphicsWindowEmbedded

2018-08-16 Thread Cong Ye


robertosfield wrote:
> Hi Cong,
> 
> On Thu, 16 Aug 2018 at 06:32, Cong Ye <> wrote:
> 
> > I agree this is a problem. But i don't think it causes the shadow not 
> > displays in embedded window problem. Could I ask where can I specific the 
> > graphicscontext to shadow camera? That may be the problem? Didn't find any 
> > methods in shadow technology to do that.
> > 
> 
> It all depends on how you are doing shadowing.
> 
> If you are using the osgShadow NodeKist then it'll create FBO's for
> the shadow map generation and won't need a separate graphics context,
> just put a ShadowedScene node into your scene graph as per the
> osgshadow example and you should be OK.
> 
> If you are rolling your own shadows then you'll need to explain more
> about your setup for us to give you direction.
> 
> Robert.
> ___
> osg-users mailing list
> 
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
> 
>  --
> Post generated by Mail2Forum


I am currently using the osgShadow NodeKist. It only works when I use osgViewer 
as default graphics context. Now the case is, I have to assign a third party 
graphics context to the main camera as we are using a Qt Gui for buttons etc. 
After I assign osgViewer::GraphicsWindowEmbedded to the main camera, the scene 
cannot be drawn. Only clear color is displayed. So I assume that since the 
graphics context has been changed, do i have to specify where the shadow 
texture need to be binded?

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





___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Shadow in GraphicsWindowEmbedded

2018-08-15 Thread Cong Ye
Hi Robert

Thanks very much for the quick reply. 

I agree this is a problem. But i don't think it causes the shadow not displays 
in embedded window problem. Could I ask where can I specific the 
graphicscontext to shadow camera? That may be the problem? Didn't find any 
methods in shadow technology to do that. 

Thanks again
Cong

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





___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


[osg-users] Shadow in GraphicsWindowEmbedded

2018-08-15 Thread Cong Ye
Hi,

I am recently encountered an interesting problem. I am trying to add shadow to 
a scene embedded in osgViewer::GraphicsWindowEmbedded. Most of shadow 
algorithms are working fine if i use osg::Viewer only. However, if I use them 
in GraphicsWindowEmbedded, nothing will be displayed.

The setting code would be:
_mGraphicsWindow = new osgViewer::GraphicsWindowEmbedded( this->x(), 
this->y(),
  
this->width(), this->height() );

osg::Camera* camera = new osg::Camera;
camera->setViewport( 0, 0, this->width(), this->height() );
camera->setClearColor( osg::Vec4( 0.9f, 0.9f, 1.f, 1.f ) );
float aspectRatio = static_cast( this->width()) / 
static_cast( this->height() );
camera->setProjectionMatrixAsPerspective( 30.f, aspectRatio, 1.f, 
1000.f );
camera->setGraphicsContext( _mGraphicsWindow );

If i override the shadow and assign the graphiccontext to the shadow camera, 
the scene can be rendered, but all in black. 

Thank you for any help!

Cheers,
Cong

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





___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org