Re: [osg-users] Closing of osg-users@lists.openscenegraph.org, please subscribe to osg-users googlegroup

2021-04-06 Thread Werner Modenbach
Hi Robert,

many thanks for this research. Works perfect :-)
I'm subscribed now on osg and vsg lists.

- Werner -

Am 06.04.2021 um 15:21 schrieb Robert Osfield:
> On Tue, 6 Apr 2021 at 13:39, Rizzen  > wrote:
>
> The message is correct in how I joined this email subscription group 
> without using a Gmail address.
>
>
> Thanks for the confirmation.
>  
>
> Is there an email subscription group for VSG?
>
>
> There's been a vsg-users google group for a couple of years, but no 
> instructions for how to subscribe without a google account.  Now I've got the 
> confirmation that it works I've
> added the same instructions to vsg-users:
>
>     https://groups.google.com/g/vsg-users 
> 
>
> Seems like a perfect opportunity for folks to test that I updated the links 
> correctly :-)
>
> -- 
> You received this message because you are subscribed to the Google Groups 
> "OpenSceneGraph Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to osg-users+unsubscr...@googlegroups.com 
> .
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/osg-users/CAFN7Y%2BUb40DmjOda8F7DUOGAL0fsFG7-UYSD_k2t3fe8E%3D5Wcw%40mail.gmail.com
> .
>
> ___
> osg-users mailing list
> osg-users@lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

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


Re: [osg-users] Closing of osg-users@lists.openscenegraph.org, please subscribe to osg-users googlegroup

2021-04-05 Thread Werner Modenbach
Hi Robert,

I followed your suggestion by replacing "myid" by my mail address, which isn't 
registered for a Google account.
There was no error message and I was forwarded to the Login page.
But logging in with the mail address failed with the message: "Your Google 
account could not be found" (translated myself)

So I'll wait if just the login fails and I get messages from the list or if 
everything failed.

Will keep you informed.

- Werner -

Am 05.04.2021 um 12:19 schrieb Robert Osfield:
> There appears to be a perception that you can only join the osg-users group 
> using a Google account.  This isn't correct, plenty of folk have already 
> joined using non google email
> addresses. 
>
> I did a search online about subscribing and came across the suggestion of 
> using a url in the form:
>
>     http://groups.google.com/group/osg-users/boxsubscribe?email=myid 
> 
>
> If you still are struggling to subscribe then I can manually add your email 
> address.  Just email me directly and I can add you.
>
> The trick of banning everyone from joining the old osg-users looks to have 
> stopped the flood of dubious subscription requests so for now the immediate 
> issue of me being
> overwhelmed with support work is over, but it's just a short term hack as it 
> bans everyone, including genuine requests.
>
> Cheers,
> Robert.
>
> ___
> osg-users mailing list
> osg-users@lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

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


Re: [osg-users] Closing of osg-users@lists.openscenegraph.org, please subscribe to osg-users googlegroup

2021-04-04 Thread Werner Modenbach
Hi Robert,

you have my full understanding. It's a pity with bots, spam, hate etc. in the 
Internet.
On the other hand, it is almost impossible to escape the data octopus Google.
I refrain from using Google Mail, Office, Calendar, Addressbook and others.
 If you use it, you have to agree in taking your privacy into public.
By using Android it's not possible to uninstall useless Google apps and you 
have to allow
access to your addresses, calendars, messages and a lot more. You cannot get 
updates
without having a Google account.
I cannot even create a new fantasy account for the mailing lists because under 
the hood
they are all merged and form an overall knowledge about my personality. :-(

But sure, it's convenient - no question.

It is also clear you cannot fight against this Internet spam on your own lists. 
So sad ...

But the osg list was always an extremely valuable resource for my development 
and
the vsg list will be the same for me in future. So I have no choice.

- Werner -

Am 04.04.2021 um 14:27 schrieb Robert Osfield:
> On Sun, 4 Apr 2021 at 13:08, merspieler  wrote:
>
> What about those who can't use the google mailing list?
>
>
> I'm sorry I can't support folks for free on a platform that is requiring so 
> much of time to keep free of spam/misuse. I've supported this osg-users 
> mailing list for free for 20
> years, unfortunately it's now become impractical to continue support.  I 
> wouldn't be taking this step if it hasn't become a serious issue at my end.
>
> As for can't use a google group, could you explain what issues you have with 
> subscribing and using the google group?  Perhaps others can help suggest a 
> way to use it.
>
> Cheers,
> Robert.
>
> ___
> osg-users mailing list
> osg-users@lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

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


[osg-users] querying stats

2021-03-29 Thread Werner Modenbach
Hi all!

I try querying stats for each frame. Unfortunately all values stay at 0.0. Any 
Ideas?

here is my code, mainly copied from the StatsHandler:

Initialisation:

#ifdefPROFILE_FRAMES

osgViewer::ViewerBase::Camerascameras;

Viewer::getCameras(cameras);

Viewer::getViewerStats()->collectStats("update",true);

for(osgViewer::ViewerBase::Cameras::iteratoritr=cameras.begin();

itr!=cameras.end();

++itr)

{

if((*itr)->getStats())(*itr)->getStats()->collectStats("rendering",true);

if((*itr)->getStats())(*itr)->getStats()->collectStats("gpu",true);

}

#endif

After each frame the query:

#ifdefPROFILE_FRAMES

osgViewer::ViewerBase::Camerascameras;

Viewer::getCameras(cameras);

intframeNumber=Viewer::getViewerStats()->getLatestFrameNumber();

doubleupdateTime{0.0};

doublerenderingTime{0.0};

doublegpuTime{0.0};

Viewer::getViewerStats()->getAttribute(frameNumber,std::string("update"),updateTime);

for(osgViewer::ViewerBase::Cameras::iteratoritr=cameras.begin();

itr!=cameras.end();

++itr)

{

doubletmp{0.0};

if((*itr)->getStats()){

if((*itr)->getStats()->getAttribute(frameNumber,std::string("rendering"),tmp))

renderingTime+=tmp;

if((*itr)->getStats()->getAttribute(frameNumber,std::string("gpu"),tmp))

gpuTime+=tmp;

}

}

std::cout<<"update:"<___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


[osg-users] Graphics system interface version

2021-03-26 Thread Werner Modenbach
Hi all,

I need to analyse my application with NVidia Nsight.
Nsight tells me, it needs D3D11 api minimum but my application uses D3D9.
My computer supports Directx12.
Without being an expert I guess my application might be able to create a D3D12 
api context.

How can I influence this?

Thanks for any ideas.

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


[osg-users] Creating an OpenGL debug context

2021-03-25 Thread Werner Modenbach
Hi all,

does anybody know how to create an opengl debug context via flags in the traits?

Thanks

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


Re: [osg-users] Question about array binding

2021-03-10 Thread Werner Modenbach
Hi Robert,

I had a look at the code in osg::Geometry. The lines in question are:

if(handleVertexAttributes)
{

for(unsignedintindex=0;index<_vertexAttribList.size();++index)

{

constArray*array=_vertexAttribList[index].get();

if(array&>getBinding()==osg::Array::BIND_PER_VERTEX)

{

vas->setVertexAttribArray(state,index,array);

}

}

}

Do you remember, why the condition
            getBinding() == BIND_PER_VERTEX
is there?
_But(!) _the same condition is at _normalArray, _colorArray etc. and they are 
handled correct with BIND_OVERALL.

I don't understand what is really done there. Sorry.

- Werner -

Am 09.03.2021 um 21:27 schrieb Robert Osfield:
> HI Werner,
>
> I can't think of think of reason that would cause a problem.  It's quite a 
> while since I look at the associated code so it might be simply that I've 
> forgotten constraints.  Have
> a look at the osg::Geometry::drawImplementation() to see if there is a 
> constraint on vertex attributes needing to be BIND_PER_VERTEX.
>
> If you were using the VSG that I'd suggest running with Vulkan debug and API 
> layer as it's great for picking up errors.  Are there any OpenGL errors being 
> produced?
>
> Robert. 
>
> ___
> osg-users mailing list
> osg-users@lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

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


[osg-users] Question about array binding

2021-03-09 Thread Werner Modenbach
Hi all,

I was hunting a long time for some strange effect. I discovered the reason but 
have some understanding issues.
Why is Code 1 not working but code 2? I would prefer Code 1 because of less 
data.

Code 1) (my original code is not working)
        osg::ref_ptr osgVertexFlagsVector;

        osgVertexFlagsVector = new osg::IntArray(1);
        osgVertexFlagsVector->setBinding(osg::Array::BIND_OVERALL);
        _geometry->setVertexAttribArray(VERTEX_FLAGS_ATR_UNIT, 
osgVertexFlagsVector.get(), osg::Array::BIND_OVERALL);

        (*osgVertexFlagsVector)[0] = VERTEX_FLAG_VISIBLE;

Code 2) (this code is working)
        osg::ref_ptr osgVertexFlagsVector;

        osgVertexFlagsVector = new osg::IntArray(numVertices);
    osgVertexFlagsVector->setBinding(osg::Array::BIND_PER_VERTEX);
        _geometry->setVertexAttribArray(VERTEX_FLAGS_ATR_UNIT, 
osgVertexFlagsVector.get(), osg::Array::BIND_PER_VERTEX);

        for (auto i=0; i___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


[osg-users] Using osg::Matrix::ortho2D as ViewMatrix

2021-02-11 Thread Werner Modenbach
Hi all!

I used to set
    camera->setProjectionMatrix(osg::Matrix::ortho2D(0.0f,1.0f,0.0f,1.0f));
when creating RTT-Cameras.

In my SSAO-Module I need to retrieve the projection matrix but
    if (cam->getProjectionMatrixAsOrtho(left,right,bottom,top,zNear,zFar)) ...
seems to return true but the values retrieved look strange.

So two questions:
1) Do I have to assign osg::Matrix::ortho insted to RTT-Cameras? What is the 
difference?
2) Can I retrieve correct values when ortho2D is used?

Many thanks for any assistance.

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


Re: [osg-users] getting userData or accumulated Uniform in nodevisitor

2021-02-02 Thread Werner Modenbach
Hi Robert,

many thanks for your answers and support. I'm far from reclaiming something.
So as I understand your explanation the information I expected during cull 
trversal is just not there.
So I'll look for another solution.

Thanks again

- Werner -

Am 02.02.2021 um 13:59 schrieb Robert Osfield:
> On Tue, 2 Feb 2021 at 10:38, Werner Modenbach 
> mailto:werner.modenb...@modenbach-ac.de>> 
> wrote:
>
> Hi Robert,
>
>
> Replying to osg-users list so that others can chip in with insights or learn 
> from the discussion.
>  
>
> I think I'm close to getting the solution.
> Unfortunately the CullStack doesn't handle any StateSets.
> I also do not really understand what a StateGraph is.
> I just guess, calling /CullVisitor->getCurrentStateGraph()->_stateSet 
> /gives me the accumulated StateSet.
> Am I right?
> Or is the accumulation of StateSets somewhere in CullVisitor->getState()? 
> But there is no method for just querying a uniform in State.
> Most of the classes have only push(), pop() or apply() methods. No query 
> methods.
>
>
> I have touched this code for years so you are probably more familiar with it 
> now than I. 
>
> From the top of my head the CullVisitor doesn't directly manage individual 
> state components like Uniform, just the high level StateSet.  The results of 
> the Cull traversal are
> passed on to the a osgUitl::StateGraph that remains at the StateSet levels, 
> it's only once this StateGraph is applied during the draw traversal does the 
> OSG's draw traversal
> behind to handle the individual components of state like models, attributes 
> and modes, and this is done via osg::State.
>
> What you are wanting to do is out of the ordinary, it's not something the OSG 
> was specifically designed to do.  Whether your approach is really necessary 
> or the best approach I
> don't know - I'm just trying to answer questions.  When you do go beyond what 
> the OSG was originally envisaged to do you'll need to accept that you'll need 
> to dig into code and
> figure stuff out, I can only help you so much.
>
> Robert.
>
>
>
>  
>
> ___
> osg-users mailing list
> osg-users@lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

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


[osg-users] getting userData or accumulated Uniform in nodevisitor

2021-01-31 Thread Werner Modenbach
I created my own derived LOD node class and implemented the traverse(...) 
method.

I want to control the detail level decision from a StateSet some node further 
up in the nodePath.

So my traverse(...) method needs to read some userData or read the value of an 
accumulated Uniform (with respect to override etc.)
Unfortunately I got lost when studying the code. Where should I place user 
values and are they propagated down the node path?
Where can I find the accumulated value of a Uniform?

Thanks for any hint.

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


Re: [osg-users] Offscreen rendering of large scenes

2019-12-10 Thread Werner Modenbach
Hi Philipp,

I'm not sure, if I really understand what you intend to do.

In my case my scene is very complex and I get timeouts on my graphic card.
So I do a rendering into many tiles, each holding a small portion of the scene.
Thus culling avoids transfer of the complete data onto the graphic card.
The tiles are assigned to a quadtree and rendered with paged LOD.

Would that also be a solution for you?

- Werner -

Am 10.12.2019 um 16:42 schrieb Philipp Wagner:
> Hi,
>
> I want to perform an offscreen rendering of a scene that is too large to fit 
> into the GPU memory at once (lots of big textures).
> My idea was to render parts of the scene each in its own frame, and disable 
> the clearing of the depth and color buffer.
> This does work for the color buffer, but the depth buffer seems to be cleared 
> after each frame, which leads to incorrect results (The later parts are drawn 
> over the previous
> ones, even though they are behind the other parts).
>
> The algorithm:
> 1. Create camera/context/...
> 2. Clear the buffers (i.e. Render an empty scene with a clear mask of 
> (GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT)
> 3. Disable buffer clearing
> 4. Render each part in its own frame
>  a. Add part to the scene
>  b. Render
>  c. Remove part from the scene
> 5. Read back color buffer
>
>
> osg::ref_ptr<::osg::Camera> camera = new osg::Camera();
>
> //Here we set the camera orientation/projection matrix
>
> camera->setClearColor(...);
> camera->setGraphicsContext(context);
>
> osg::ref_ptr img = new osg::Image;
> img->allocateImage(textureWidth, textureHeight, 1, GL_RGBA, GL_UNSIGNED_BYTE);
> camera->attach(osg::Camera::COLOR_BUFFER0, img, numSamples);
> camera->attach(osg::Camera::DEPTH_BUFFER, GL_DEPTH_COMPONENT32);
> camera->setRenderOrder(osg::Camera::PRE_RENDER);
> camera->setRenderTargetImplementation(osg::Camera::RenderTargetImplementation::FRAME_BUFFER_OBJECT);
> camera->setReferenceFrame(osg::Camera::ABSOLUTE_RF);
> camera->setProjectionResizePolicy(osg::Camera::FIXED);
> camera->setViewport(0, 0, img->s(), img->t());
> viewer->addSlave(camera);
>
> camera->setClearMask(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT);
> viewer->frame();
> camera->setClearMask(0);
> for (auto& item : parts)
> {
>    //Here we create and add the item to the scene...
>    viewer->frame();
>    //Here we remove item from the scene and delete it
> }
>
> Thanks in advance
> Phil
> -- 
> You received this message because you are subscribed to the Google Groups 
> "OpenSceneGraph Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to osg-users+unsubscr...@googlegroups.com 
> .
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/osg-users/c6f7907d-6c89-4c00-973c-f9dc0585ae32%40googlegroups.com
> .
>
> ___
> osg-users mailing list
> osg-users@lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

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


[osg-users] Questions on optimizing my scene graph

2019-09-02 Thread Werner Modenbach
Hi all!

I use OSG for many years now and it works really great.
Over the years the request to my application were exploding and I'm about to 
improve my scene graph.
In this context I have some question - maybe someone can give me some hints.

1) Statusswitches are always costly. How does OSG identify if a texture or a 
program is identical when
    checking for status changes? Is it by comparing the pointers? If yes, it is 
necessary to manage a pool
    and use the same pointers everywhere?

2) I have plenty of geometries. Groups of them work on the same vertex array, 
just using different index ranges.
   How should I handle this in an optimal manner?
   Should I create one geometry for such "sharing" geometries and just create 
many primitiveSets inside?
   How effective is culling in this case? (The primitiveSets are spread over 
the scene volume)
   Or should I create many geometries, each holding the relevant part of 
vertices with one primitiveSet each?

3) I need some LOD handling for the geometries. This means that I want to 
assign different shaders and
    uniforms depending on distance to camera.
    The 2 methods I can think of are
        a) using a LOD-Node, having a child for each level with the desired 
status settings and attach the geometry to each of them
        b) using a cullCallback changing the settings during cullTraversal
    Which is more efficient?

4) The different LOD shaders need a different number of instances of the 
primitiveSets.
    If I create a LOD-Node I cannot attach the same geometry to each level 
because the number of Instances is coded in the primitiveSet.
    Is there an elegant way to manage that?

I'm really grateful for any hints and help.

- Werner -

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


Re: [osg-users] Huge perfomance issues

2019-05-31 Thread Werner Modenbach
There should be a better approach.

Just a quick idea:

For each kind of object keep an array of pointers to already created geodes.
If you don't need a certain geode switch it off in the osg::Switch.
If you get a request for a new one, check the switch for inactive geodes. If 
found, just alter it and activate it.
Otherwise append a new one.

In some way you need an organization for the objects.

Am 31.05.2019 um 17:34 schrieb Achilleas Margaritis:
> The problem is I need to destroy my house every frame. 
>
> There is no standard number of objects received; any object, with any 
> configuration, can be received at any time.
>
> My only choice is to destroy everything and repaint everything.
>
> --
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=76162#76162
>
>
>
>
>
> ___
> osg-users mailing list
> osg-users@lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


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


Re: [osg-users] Huge perfomance issues

2019-05-31 Thread Werner Modenbach
Hi Achilleas,

your explanations look to me like "I want to repaint my living room. So I 
destroy my house and ..."
My suggestion:
For each kind of geometry create it as geode and add it to a switch node. So 
you can switch them on and off as needed.
For alterations keep pointers to the geodes and alter the geometries. I.e. 
assign new coordinate arrays etc. .
Also there is no need to do it within a frame.

Regards

- Werner -


Am 30.05.2019 um 12:53 schrieb Achilleas Margaritis:
> Hi,
>
> I am developing a data visualization application with Qt + OSG, but I have 
> huge performance problems.
>
> These problems are not due to OSG itself but rather due to how I use OSG (I 
> just started using OSG/OpenGL for the first time).
>
> The application accepts a lot of data as messages over the network, and draws 
> polygons and lines according to the received data.
>
> In order to make drawing easy, I have developed a class which has many 
> drawing functions: DrawPolygon, DrawPolygonLine, DrawLine, DrawRectangle. 
> DrawCircle, DrawCube, etc.
>
> In every of these functions, I do the following:
>
> 1) create a Geode.
> 2) create a Geometry and attach it to the Geode created above.
> 3) create a material with the appropriate colors for the drawing, attached to 
> the Geode created above.
> 4) create a state set for the drawing properties, attached to the Geode 
> created above.
>
> At each frame, I delete all the objects created, and then use the API I 
> described above (i.e. DrawPolygon, DrawPolygonLine etc) to recreate the 
> drawings with the newly received data.
>
> The frame rate is abysmal though. After the creation of a few tens of 
> polygons and lines (around 100), the frame rate drops extremely low and the 
> UI becomes totally unresponsive.
>
> The code I have created is largely copied from the OSG examples I have found 
> online, mostly from the osggeometry.cpp example.
>
> My question is what am I doing wrong?
>
> Is the multiple statesets created the problem? Each Drawing function creates 
> a new stateset, a new vertex array, a new primitives array, a new geode etc.
>
> Thank you!
>
> Cheers,
> Achilleas
>
> --
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=76154#76154
>
>
>
>
>
> ___
> osg-users mailing list
> osg-users@lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Question about security of shader developments

2019-01-31 Thread Werner Modenbach
Hi Michael and all other people responding to my request,

first of all thank you very much!

@Michael: What you suggest is something like asking Zuckerberg to
publish his algorithms.
                And belief me, Chinese don't care at all about patents
or other rules we usually accept here.

I'm really surprised that there is no real solution for my problem.
Since OpenGL 4 all developers are advised to create their own shaders.
And once you get familiar
with that you quickly discover the potential of it. A good portion of
your know how gets transferred to shaders.
This should be a common problem in the commercial field. And no solution
from NVIDIA etc. ?

@Robert: Thanks for pointing me to SPIR-V. I'll have a look at it.
Anyway better than pure source code.
                Unfortunately not natively supported by OSG.

Hiding shader source code inside an executable is not that problem
because all our executables are encrypted.
And memory spy during runtime is detected already.
The problem here is the driver api.

@Damian: Do you have any links for detecting OpenGL/GPU debuggers?

Many, many thanks to everybody.

- Werner -

Am 31.01.2019 um 10:29 schrieb michael kapelko:
> Hi.
>
> You may have a look at the problem from a different angle. If someone
> is stealing from you that means they need it. If you cannot stop it
> (or it costs much more than simply let them have it), then you should
> lead it. Instead of hiding your great shaders you can publish them
> yourself (don't forget to add some notes about your company in the
> comments)! This would be the marketing way of handling the problem.
>
> On Thu, 31 Jan 2019 at 12:17, Damian Dixon  wrote:
>> Hi,
>>
>> I don't know what the OSG solution to this would be.
>>
>> You could obfuscate the shader code. Though to be honest this would only 
>> slow someone down not stop them from obtaining the shader source.
>>
>> In addition to obfusication put the shader source into the DLL/exe and 
>> potentially hide the strings by a simple rotation or masking of the data.
>>
>> You could add additional logic to detect OpenGL/GPU debuggers and/or check 
>> the OpenGL shared library is loaded from sensible locations.
>>
>> The other options would be to look at the following in OpenGL. I've not used 
>> either of them so they may not work particularly well.
>>
>> https://www.khronos.org/registry/OpenGL/extensions/ARB/ARB_gl_spirv.txt 
>> (OpenGL 4.6)
>> https://www.khronos.org/registry/OpenGL-Refpages/gl4/html/glShaderBinary.xhtml
>>  (OpenGL 4.1)
>>
>> You may find that the SPIRV extension is not widely supported yet on all 
>> GPUs and drivers (mesa support is not yet there) that your customers are 
>> using. SPIRV modules are an intermediate compiled representation of the 
>> shaders so someone with a lot of time could reverse engineer.
>>
>> The shader binary I believe may be limited to the GPU/driver that it was 
>> compiled for.
>>
>> Also OSG would need to be modified to use SPIRV or shader binaries.
>>
>> Most of this is a trade off between cost of implementation, additional test 
>> and support costs and lost revenue.
>>
>> Regards
>> Damian
>>
>>
>>
>>
>> On Wed, 30 Jan 2019 at 17:50, Werner Modenbach  
>> wrote:
>>> Dear Robert, dear community,
>>>
>>> I use OSG since many years now with great success. But being honest I
>>> usually just use the osg api and direct gl calls are very rare in our code.
>>> That's the reason why I ask people with more gl experience here.
>>> I'm working in a commercial environment. Unfortunately we have very bad
>>> experience about the security of our developments
>>> especially with a famous Asian country. Cracking and copying is the
>>> normal case there.
>>> During the years we have established a quite secure environment for our
>>> executables by encrypting the them and by detecting
>>> debugging and sniffing tools running in parallel.
>>> There is mainly one really weak part, the shaders we develop.
>>> We spent years now in very complex and highly optimized shaders and I
>>> have sleepless nights knowing that the shader code is
>>> transferred to the driver as plain source code.
>>> My question: Is there any way solving this problem? Is there any driver
>>> api for that? I searched all over OSG but didn't find anything.
>>> Is this feature missing in general or is it just not in the OSG api?
>>> If all the questions are answered NO can anybody provide a contact to
>>> NVIDIA for discussing this problem?
>>>
>>> Many thanks in advance for a

[osg-users] Question about security of shader developments

2019-01-30 Thread Werner Modenbach
Dear Robert, dear community,

I use OSG since many years now with great success. But being honest I
usually just use the osg api and direct gl calls are very rare in our code.
That's the reason why I ask people with more gl experience here.
I'm working in a commercial environment. Unfortunately we have very bad
experience about the security of our developments
especially with a famous Asian country. Cracking and copying is the
normal case there.
During the years we have established a quite secure environment for our
executables by encrypting the them and by detecting
debugging and sniffing tools running in parallel.
There is mainly one really weak part, the shaders we develop.
We spent years now in very complex and highly optimized shaders and I
have sleepless nights knowing that the shader code is
transferred to the driver as plain source code.
My question: Is there any way solving this problem? Is there any driver
api for that? I searched all over OSG but didn't find anything.
Is this feature missing in general or is it just not in the OSG api?
If all the questions are answered NO can anybody provide a contact to
NVIDIA for discussing this problem?

Many thanks in advance for any hints and help.

- Werner -


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


[osg-users] Off topic question and request for ideas

2018-12-14 Thread Werner Modenbach
Hi all,

first of all I apologize for an off topic question.
I spent weeks already in the Internet for finding a solution for a
problem - without success.
And I know there are a lot of experienced people here in the list.

I'm doing high quality simulations of textiles from machine data. So I
have to
simulate each yarn as realistic as possible. This works perfect if the
yarn is not hairy.
That means it has no filaments pinning out of the surface i.e. like wool.
The only approaches I found so far are here:
    https://www.shadertoy.com/results?query=fur=popular=0=12
    https://developer.nvidia.com/gpugems/GPUGems2/gpugems2_chapter01.html
Both of them have big cons for my requirements.

Is anybody here having hints or ideas for solving this problem?

Sorry for this off topic message. Please answer to my PM in order not to
spam to much to the list.

Many thanks for any help

- Werner -


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


Re: [osg-users] OpenGL ES 2.0 and LIGHTING

2018-11-16 Thread Werner Modenbach
Hi Grigoriy,

why don't you do the multiply in the shader like you do with gl_vertex?

- Werner -

Am 16.11.2018 um 12:29 schrieb Grigoriy Mylnikov:
> Sorry for delayed reply.
>
> My goal is to open and display .osgt files on android the same way they can 
> be opened on desktop. This includes using several lights inside a model, both 
> directional and point lights.
>
> I have some progress with writing shaders, but I have troubles with 
> understanding OSG states. I've updated osg::Light apply() code to pass light 
> position (relative to camera) as uniform:
>
>
> Code:
> void LightShader::apply(osg::State& state) const
> {
> #ifdef OSG_GL_FIXED_FUNCTION_AVAILABLE
> ... // Original code
> #else
> ...
> osg::Vec4 relPos = state.getModelViewMatrix() * _position;
> lightPosUniform.get()->set(relPos);
> ...
> #endif
> }
>
>
>
>
> But it seems that state.getModelViewMatrix() does not gives me valid view 
> matrix.
>
> If I could get light position (relative to camera), I can use it in shaders 
> like this:
>
>
> Code:
> vec3 APos = vec3(gl_ModelViewMatrix * gl_Vertex);
> ...
> vec3 fromPointToLight = lightPos.xyz - APos;
>
>
>
>
> --
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=75204#75204
>
>
>
>
>
> ___
> osg-users mailing list
> osg-users@lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


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


Re: [osg-users] Value of a variable in shaders?

2018-09-28 Thread Werner Modenbach
Hi Marlin,

in case you want to know the value of a variable (not uniform) of a shader
there is no way (to my knowledge) inspecting it like in a debugger.
The usual workaround is visualizing things by coloring the output pixels.
If you want to "see" the "value" of a normal vector you can just take it
as a
color and set it in the fragment shader as the output color.
Be creative when "debugging" other values: Bools or thresholds go black
and white etc.
If you have to "debug" values in vertex or geometry shaders, just pass
colors to the fragment shader.

I hope this helps a little.

- Werner -

Am 28.09.2018 um 08:40 schrieb Robert Osfield:
> Hi Marlin,
>
> On Thu, 27 Sep 2018 at 19:30, Rowley, Marlin R
> mailto:marlin.r.row...@lmco.com>> wrote:
>
> Is there a way to examine variable values in shader code? I can’t
> figure out this problem that we are having unless I can see the
> values in the shaders.
>
>
> To pass data into shaders you have use a combination of uniforms
> (osg::Unfiorm), textures (osg::Textre*) and vertex attributes.  With
> recent 3.4.x onwards you also have the option of passing in constants
> via #prama(tic) shader composition system that passes #define values
> into the compilation of shaders.
>
> Shaders are a big topic so it's impossible for me to give you a full
> guide, there are plenty of reosurces online about GLSL shaders, within
> the OSG search for uses of osg::Program, osg::Shader, osg::Uniform.
>
> Robert.
>  
>
>
> ___
> osg-users mailing list
> osg-users@lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

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


Re: [osg-users] osgQt + OSG 3.6.2 Status

2018-09-11 Thread Werner Modenbach
Hi Mathieu,

thanks for your support for OSG/Qt integration. I think there are really
many people using OSG together with Qt.
Qt is just great for building multi environment user interfaces.
But there is one thing I don't really understand. There is some
discussion sometimes about difficulties in this integration.
My integration is dated April 2013 and I didn't need any changes since then.

classCl_3D_OsgViewer_QT:publicQWidget,publicosgViewer::Viewer{...

It works without any problems with every version of Qt since that time.
So where is the problem?

OK, I'm not using VS 20xx but Qt Creator and g++ instead. Maybe that
makes the difference. But in this case
it isn't really a problem of Qt integration but a VS problem.
I see that some people tend integrating OSG into QOpenGLWindow.  In my
opinion this is a stony way
because Qt GL wasn't that stable and finally decided since many years
now. So things change frequently
and this is always causing headache for keeping integrations running.

On the other hand I think there is nothing more developed and stable
than QWidget.
If someone needs help send me a PM and I'm willing to share my
integration class.

- Werner -

Am 10.09.2018 um 18:42 schrieb Mathieu MARACHE:
> Back from holidays...
>
> Community support is thin when considering OpenSceneGraph with Qt. I
> am currenlty the only maintainer of osgQt because I have a software
> using it and I didn't want the project to be tossed out.
>
> The Qt4 way of doing things with legacy osgQt (that was droped from
> OpenSceneGraph) doesn't fit well with the Qt5 way of doing things.
> Since Qt5.7 there are even incompatibilities (black screens, etc.).
>
> Qt4 support is getting difficult, even debian is dropping Qt4
> (https://wiki.debian.org/Qt4Removal).
>
> In anticipation I have proposed to drop Qt4 and concentrate only on
> Qt5. Robert only asked to keep the Qt4 version around and make it
> clear which version of osg compiles with which version/branch of osgQt.
>
> There is a feature branch (since Feb '18) of the Qt5 way of doing
> things awaiting testing and validation from the community. This is the
> code I use in my application which was crafted by paid support from
> KDab's Mike Krus (from which I had authorization to open source).
>
> https://github.com/openscenegraph/osgQt/tree/feature/osgQOpenGL
>
> Regards
> --
> nǝıɥʇɐƜ
>
>
> On Mon, 30 Jul 2018 at 17:07, Robert Osfield  > wrote:
>
> On Mon, 30 Jul 2018 at 15:59, Andrew Cunningham  > wrote:
> >
> > Back on the original topic :)
> >
> > This is a really simple QtOSGWidget that I used as a starting
> point for an OSG widget in a QDialog. Simple and works fine.
> >
> > https://github.com/vicrucann/QtOSG-hello
>
> Just had a quick look at the code.  It only works "fine" because there
> it's a trivial example, it's buggy.  Please compare to the the
> osg::Camera setup in the osgQt master and see if you can see the
> error, in this example.  If you can then you'll be able to spot what
> to fix in your own programs.
>
> Robert.
> ___
> osg-users mailing list
> osg-users@lists.openscenegraph.org
> 
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
>
>
> ___
> osg-users mailing list
> osg-users@lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

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


Re: [osg-users] GL profiles issues on Windows

2018-09-05 Thread Werner Modenbach
Hi Robert,

I thin k Riccardo wants to use both libs (libA glcore, linB non glcore)
in the same app on Windows.
In my understanding this is not possible at all.

- Werner -

Am 05.09.2018 um 11:36 schrieb Robert Osfield:
> Hi Riccardo,
>
> On Wed, 5 Sep 2018 at 10:23, Riccardo Corsi  
> wrote:
>> Now what I'd like to do (on Win only) is to use libA and libB together.
>> To do so I expected it was enough to add the OSG_GL3_AVAILABLE flag to build 
>> OSG and to request a Compatibility GL context.
>> What happens instead is that I don't see anything of what libA is supposed 
>> to render, even though I don't get any GL error on the console.
> I you are just building the OSG with defaults, so will provide a
> compatibility profile. then the OSG at runtime will check for all the
> GL3/GL4 features and allow you to use this, you don't need to
> explicitly enable them via OSG_GL3_AVAILABLE.
>
> For compatibility with OSX then you'll need to use the CMake option of
> OPENGL_PROFILE=GLCORE.
>
> If you create an application that works with GLCORE then this same
> application will build and run just fine on the OSG built with
> defaults.
>
> Robert.
> ___
> osg-users mailing list
> osg-users@lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


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


Re: [osg-users] How to create a 3D ray from cursor position?

2018-08-15 Thread Werner Modenbach
Hi Jad,

this is how I do it:

double x = mEv->x();  double y = mEv->y();  double w =
view->getGraphicsWidth();  double h = view->getGraphicsHeight(); x =
x/w; y = y/h; // Normalize to range -1.0 - 1.0 x = (2.0 * _x) - 1.0; y =
-((2.0 * _y) - 1.0); // -1.0 is at bottom!!!  osg::Matrix MVPW(
view->getCamera()->getViewMatrix() *
view->getCamera()->getProjectionMatrix()); osg::Matrixd inverseMVPW =
osg::Matrixd::inverse(MVPW); osg::Vec3 near_point =
osg::Vec3(_x,_y,-1.0f) * inverseMVPW; osg::Vec3 far_point =
osg::Vec3(_x,_y, 1.0f) * inverseMVPW;

- Werner -

Am 16.07.2018 um 17:34 schrieb Jad Killian:
> Given a 2D cursor position from a mouse event, how do I compute a 3D ray into 
> the scene?
>
> This is my attempt so far but it's not giving sensible results:
>
>
> Code:
> float width = viewer->getCamera()->getViewport()->width();
> float height = viewer->getCamera()->getViewport()->width();
>
> float x = (2.0f * ea.getX()) / width - 1.0f;
> float y = 1.0f - (2.0f * ea.getY()) / height;
> float z = 1.0f;
>
> osg::Vec3 ray_nds(x, y, z);
>
> osg::Vec4 ray_clip(ray_nds.x(), ray_nds.y(), -1.0, 1.0);
>
> osg::Matrixd proj_inv = viewer->getCamera()->getProjectionMatrix();
> proj_inv = proj_inv.inverse(proj_inv);
>
> osg::Vec4 ray_eye = proj_inv * ray_clip;
> ray_eye.z() = -1.0;
> ray_eye.w() = 0.0;
>
> osg::Vec4 ray_wor4 = viewer->getCamera()->getInverseViewMatrix() * ray_eye;
> osg::Vec3 ray_wor(ray_wor4.x(), ray_wor4.y(), ray_wor4.z());
>
>
>
> P.S: I need such a ray so I can drag a 3D object around the scene like this:
> new_position = camera_position + ray_direction * depth_value;
> Or is there an easier way to accomplish this?
>
> Thanks
> [/code]
>
> --
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=74349#74349
>
>
>
>
>
> ___
> osg-users mailing list
> osg-users@lists.openscenegraph.org
> 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: i...@texion.eu
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Load an obj file and mapping a given vertex to its Texture coordinates

2018-08-09 Thread Werner Modenbach
Hi Mike,

I suggest checking the results of "geom" and "coords" before using them.
If they are nullptr it will crash your program.

- Werner -

Am 09.08.2018 um 12:39 schrieb michael kapelko:
> Here's how I change texture coordinates:
> https://github.com/OGStudio/ogs-mahjong-components/blob/0308cd2ed97b001cf5aecea1b5aada839707c5cf/02.Theme/desktop/src/render.h#L184
> Note that the function gets osg::Geode that has already been extracted
> from osg::Node.
>
> Here's a sample class to print whole osg::Node structure (replace
> log::logprintf with printf):
> https://github.com/OGStudio/openscenegraph-cross-platform-examples/blob/f692fd8b0886dbdba1d4e99087998e87827056db/features/scene/PrintGraphVisitor.cpp
> You need to create this class instance and call
> 'yourNode.accept(instance);' to have the structure printed.
> On Wed, 8 Aug 2018 at 15:43, Werner Modenbach
>  wrote:
>> Hi Mike,
>>
>> the loaded node isn't just a single node but a treelike structure where
>> your actual geode(s) is/are located somewhere in the structure.
>> What you mean by vertex Id? Each geode contains 1 or more drawables and
>> each drawable contains a vertex array and eventually texCoordArray(s).
>>
>> So you have to identify the geode your vertex is in. Then you can try to
>> dynamic_cast. Anyway you need to check if your cast returned 0.
>>
>> The next problem is the osg::Array. I didn't find a solution for that so
>> far. If you kno
>>
>> Am 06.08.2018 um 16:27 schrieb Mike Blakefiled:
>>> Hi everyone, I'm new here.
>>>
>>> I load an obj file with osgDB::readNodeFile("my.obj") and add it to my 
>>> scene.
>>> now, given a vertex Id, I'd like to be able to get its UV/Texture 
>>> coordinate.
>>>
>>> I can see that osg::Geometry has a getTexCoordArray() method, but 
>>> dynamically casting my node to org::Geometry crashes the program.
>>> moreover, according to the docs,  getTexCoordArray() simply returns a 
>>> pointer to osg::Array, and it's unclear what type the elements of that 
>>> array is (osg::Vec2?)
>>> ...
>>>
>>> Thank you!
>>>
>>> Cheers,
>>> mike
>>>
>>> --
>>> Read this topic online here:
>>> http://forum.openscenegraph.org/viewtopic.php?p=74473#74473
>>>
>>>
>>>
>>>
>>>
>>> ___
>>> osg-users mailing list
>>> osg-users@lists.openscenegraph.org
>>> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>>
>>
>> ___
>> osg-users mailing list
>> osg-users@lists.openscenegraph.org
>> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
> ___
> osg-users mailing list
> osg-users@lists.openscenegraph.org
> 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: i...@texion.eu
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Load an obj file and mapping a given vertex to its Texture coordinates

2018-08-08 Thread Werner Modenbach
Hi Mike,

the loaded node isn't just a single node but a treelike structure where
your actual geode(s) is/are located somewhere in the structure.
What you mean by vertex Id? Each geode contains 1 or more drawables and
each drawable contains a vertex array and eventually texCoordArray(s).

So you have to identify the geode your vertex is in. Then you can try to
dynamic_cast. Anyway you need to check if your cast returned 0.

The next problem is the osg::Array. I didn't find a solution for that so
far. If you kno

Am 06.08.2018 um 16:27 schrieb Mike Blakefiled:
> Hi everyone, I'm new here.
>
> I load an obj file with osgDB::readNodeFile("my.obj") and add it to my scene.
> now, given a vertex Id, I'd like to be able to get its UV/Texture coordinate.
>
> I can see that osg::Geometry has a getTexCoordArray() method, but dynamically 
> casting my node to org::Geometry crashes the program. 
> moreover, according to the docs,  getTexCoordArray() simply returns a pointer 
> to osg::Array, and it's unclear what type the elements of that array is 
> (osg::Vec2?)
> ... 
>
> Thank you!
>
> Cheers,
> mike
>
> --
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=74473#74473
>
>
>
>
>
> ___
> osg-users mailing list
> osg-users@lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org



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


Re: [osg-users] [HELP] Properly using osg::VertexAttribDivisor for basic geometry instancing

2018-08-02 Thread Werner Modenbach
Hi,

what we do is packing our instance parameters in a uniform array and
access it via gl_InstanceID as an index into the array.

- Werner -

Am 01.08.2018 um 16:32 schrieb Julien Valentin:
> Hi
> perhaps it's because of transaltion array 's default binding (UNDEFINED)
> try
> translation->setArrayBinding(Array::PER_VERTEX)
> Cheers
>
>
> ppsychrite wrote:
>> hello sorry if i did this wrong but i dont know how to use mailing lists
>>
>> so ive been trying to do modern glsl/opengl 3.3+ with osg::Geometry and 
>> osg::Stateset and it's been working OK for basic triangle except for 
>> implementing instanced array data
>> am I doing it the wrong way? here's the .cpp code for it and for me it 
>> seems well enough and fine, position and color works fine
>>
>>
>>  osg::Vec3 coords[] = {
>>  { -0.05f,0.05f,0.f },
>>  { 0.05f,-0.05f,0.f },
>>  { 0.05f,0.05f,1.f }
>>  };
>>  osg::Vec3 colors[] = {
>>  {1.f,0.f,0.f},
>>  {0.f,1.f,0.f},
>>  {0.f,0.f,1.f}
>>  };
>>
>>  osg::Vec2 instancetranslations[] = {
>>  { 0.0f, 0.0f },
>>  { 0.1f, 0.0f },
>>  { 0.2f, 0.0f }
>>  };
>>
>>  osg::Vec3Array *pos = new osg::Vec3Array(sizeof(coords) / 
>> sizeof(osg::Vec3), coords);
>>  osg::Vec3Array *color = new osg::Vec3Array(sizeof(colors) / 
>> sizeof(osg::Vec3), colors);
>>  osg::Vec2Array *translation = new 
>> osg::Vec2Array(sizeof(instancetranslations) / sizeof(osg::Vec2), 
>> instancetranslations);
>>
>>  osg::Geometry *vao = new osg::Geometry();
>>  vao->setUseDisplayList(false);
>>  vao->setUseVertexArrayObject(true);
>>  vao->setUseVertexBufferObjects(true);
>>
>>  vao->setVertexAttribArray(0, pos, osg::Array::BIND_PER_VERTEX);
>>  vao->setVertexAttribArray(1, color, osg::Array::BIND_PER_VERTEX);
>>  vao->setVertexAttribArray(2, translation);
>>
>>  vao->addPrimitiveSet(new osg::DrawArrays(GL_TRIANGLES, 0, 3, 3)); //3 
>> instances
>>
>>  osg::ref_ptr program = new osg::Program;
>>
>>  program->addShader(osgDB::readShaderFile("shaders/basic.vert"));
>>  program->addShader(osgDB::readShaderFile("shaders/basic.frag"));
>>
>>  osg::StateSet *stateset = geom->getOrCreateStateSet();
>>  stateset->setAttributeAndModes(program.get());
>>  stateset->setAttribute(new osg::VertexAttribDivisor(2, 1)); //set 3rd 
>> array as per-instance
>>
>> here's the vertex shader code for it:
>>
>>
>> #version 330 core
>> layout (location = 0) in vec3 aPos;
>> layout (location = 1) in vec3 aColor;
>> layout (location = 2) in vec2 aTrans;
>>
>> out vec3 color;
>>
>> void main()
>> {
>> color = aColor;
>> gl_Position = vec4(aPos.x+ aTrans.x,aPos.y+ aTrans.y,aPos.z,1.0);
>> }
>>
>>
>> aTrans doesn't move the triangle at all, it's just one. I know it isn't 
>> the shaders fault because instead of adding aTrans to aPos I've done 
>> (gl_InstanceID * 0.1f) and it's worked perfectly, seeing 3 instanced 
>> triangles
>>
>> what am i doing wrong/how could i get per-instanced array working?
>>
>>
>>
>>
>>
>> ___
>> osg-users mailing list
>>
>> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>>
>>  --
>> Post generated by Mail2Forum
>
> 
> Twirling twirling twirling toward freedom
>
> --
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=74452#74452
>
>
>
>
>
> ___
> osg-users mailing list
> osg-users@lists.openscenegraph.org
> 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: i...@texion.eu
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] how to interpret values shown by stats handler

2018-07-17 Thread Werner Modenbach
OK, thanks Robert.

So I do a couple of frames until values stabilize. The shown average is
what I finally need.

- Werner -

Am 17.07.2018 um 12:12 schrieb Robert Osfield:
> Hi Werner,
>
> The values are averaged as otherwise they'd jump around so much that
> they would be un-readable blur.
>
> The exact values are all collated in the the various osg::Stats
> objects, so perhaps you can have a look at these.
>
> As a general note, OpenGL timing data is not deterministic, this is
> partly down to the OpenGL FIFO blocking at different points in the
> frame, or sometimes the OS and the driver interacting in different
> ways each frame.  This effect gets worse the more overloaded your
> system is.
>
> This means you need to take the stats as hint to what is going on, but
> it's not hard fast, to really understand you need to be aware of how
> various things interact.
>
> Robert.
>
> Robert.
> On Tue, 17 Jul 2018 at 10:43, Werner Modenbach
>  wrote:
>> Hi all,
>>
>> I'm trying to optimize the display speed of my application by testing
>> various techniques.
>>
>> In order to do exact measures I implemented a mechanism where I can
>> trigger single frame() calls from my keyboard.
>>
>> Curiously the GPU times shown by the stats handler are always drifting
>> somehow over significant ranges
>> before getting stable. Does anybody know if there is some averaging over
>> a couple of frames or is there any other effect
>> I don't see at the moment? Or is this a kind of caching effect?
>>
>> It's difficult to judge the effects of techniques under those
>> circumstances if I don't have an idea what is causing the drifts.
>>
>> Thanks for any hints.
>>
>> - Werner -
>>
>>
>> ___
>> osg-users mailing list
>> osg-users@lists.openscenegraph.org
>> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
> ___
> osg-users mailing list
> osg-users@lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


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


[osg-users] how to interpret values shown by stats handler

2018-07-17 Thread Werner Modenbach
Hi all,

I'm trying to optimize the display speed of my application by testing
various techniques.

In order to do exact measures I implemented a mechanism where I can
trigger single frame() calls from my keyboard.

Curiously the GPU times shown by the stats handler are always drifting
somehow over significant ranges
before getting stable. Does anybody know if there is some averaging over
a couple of frames or is there any other effect
I don't see at the moment? Or is this a kind of caching effect?

It's difficult to judge the effects of techniques under those
circumstances if I don't have an idea what is causing the drifts.

Thanks for any hints.

- Werner -


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


Re: [osg-users] Culling and instanced drawing

2018-07-13 Thread Werner Modenbach
B.T.W. Is there any way of doing the culling in Tesselation- or
Geometry-Shader?
In this case I need to know if the vertices are visible or not.

Am 13.07.2018 um 18:51 schrieb Robert Osfield:
> Hi Werner,
>
> The best way to handle the vertex shader moving geometry to new
> locations is to use a custom osg::DrawableComputeBoundingBoxCallback
> that you assign the the drawable that you are using for instancing.
> You'll want to return a BoundingBox that encompasses all the positions
> that the transformed geometries can occupy.
>
> Robert.
> On Fri, 13 Jul 2018 at 17:44, Werner Modenbach
>  wrote:
>> Hi all,
>>
>> maybe someone has some inspiration for me.
>> I have a scene graph where the same object (plenty of vertices) is drawn
>> in many instances.
>> Each instance gets an offset matrix to move the object to some place.
>> If I do the rendering without instances the culling removes those
>> objects from the draw list that are not visible.
>> Is there any way to implement such culling also with instances?
>> I think I need to remove the invisible matrices from the list and reduce
>> the number of instances somehow.
>>
>> Any idea where to do it?
>>
>> Thanks
>>
>> - Werner -
>>
>>
>> ___
>> osg-users mailing list
>> osg-users@lists.openscenegraph.org
>> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
> ___
> osg-users mailing list
> osg-users@lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


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


Re: [osg-users] Culling and instanced drawing

2018-07-13 Thread Werner Modenbach
Hi Robert,

that is exactly what we have done. It is necessary i.e. for the
automatic compution of zNear/zFar.
My problem is the culling - the collection of visible objects.
If I zoom in very close I get a high level of details. But the shaders
have to do this expensive computaion for all instances,
even if only one is visible.
The only solution I see is "removing those instances not visible".
Instancing reduces time for draw traversal significantly!

Thanks

- Werner -

Am 13.07.2018 um 18:51 schrieb Robert Osfield:
> Hi Werner,
>
> The best way to handle the vertex shader moving geometry to new
> locations is to use a custom osg::DrawableComputeBoundingBoxCallback
> that you assign the the drawable that you are using for instancing.
> You'll want to return a BoundingBox that encompasses all the positions
> that the transformed geometries can occupy.
>
> Robert.
> On Fri, 13 Jul 2018 at 17:44, Werner Modenbach
>  wrote:
>> Hi all,
>>
>> maybe someone has some inspiration for me.
>> I have a scene graph where the same object (plenty of vertices) is drawn
>> in many instances.
>> Each instance gets an offset matrix to move the object to some place.
>> If I do the rendering without instances the culling removes those
>> objects from the draw list that are not visible.
>> Is there any way to implement such culling also with instances?
>> I think I need to remove the invisible matrices from the list and reduce
>> the number of instances somehow.
>>
>> Any idea where to do it?
>>
>> Thanks
>>
>> - Werner -
>>
>>
>> ___
>> osg-users mailing list
>> osg-users@lists.openscenegraph.org
>> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
> ___
> osg-users mailing list
> osg-users@lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org



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


[osg-users] Culling and instanced drawing

2018-07-13 Thread Werner Modenbach
Hi all,

maybe someone has some inspiration for me.
I have a scene graph where the same object (plenty of vertices) is drawn
in many instances.
Each instance gets an offset matrix to move the object to some place.
If I do the rendering without instances the culling removes those
objects from the draw list that are not visible.
Is there any way to implement such culling also with instances?
I think I need to remove the invisible matrices from the list and reduce
the number of instances somehow.

Any idea where to do it?

Thanks

- Werner -


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


Re: [osg-users] Constructor parameters of osg::Uniform

2018-06-28 Thread Werner Modenbach


Am 28.06.2018 um 15:03 schrieb Robert Osfield:
> On Thu, 28 Jun 2018 at 13:57, Robert Osfield  wrote:
>> The original osg::Uniform class is a bit of unwieldy mess. In
>> hindsight we shouldn't have gone for this particular implementation as
>> it's a bit too open ended.
> As a bit of background, Mike Weiblen with a bit of input from myself
> created the GLSL support for the OSG before OpenGL 2.0 came out and on
> prototype drivers.  It was completely bleeding edge of OpenGL as well
> as trying to implement this stuff in scene graphs, there was no prior
> art, it was very much winging it.  The fact that is has lasted so long
> without a major rewrite suggests Mike came up with reasonable
> solution.
>
> The first git log entry for osg::Uniform is :
>
> Date:   Thu Feb 24 13:33:35 2005 +
>
> From Mike Weiblen, adding prelimimnary GL Shader Language support
> into core OSG lib.
>with renaming and reordering by Robert Osfield,
>
> 13 years later it's easy to spot better ways of doing it, but kinda
> cool this stuff was once pushing things forward - this work was even
> used a demo at the OpenGL BOF that GLSL/2,0 was launched :-)
>
> Robert.

-- 
*TEXION Software Solutions, Rotter Bruch 26a, D-52068 Aachen*
Phone: +49 241 475757-0
Fax: +49 241 475757-29
Web: http://texion.eu
eMail: i...@texion.eu
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Constructor parameters of osg::Uniform

2018-06-28 Thread Werner Modenbach
It would be the easiest putting an "explicit " in front of the
constructor but I guess there would be far to many reclaims then :)

- Werner -

Am 28.06.2018 um 15:03 schrieb Robert Osfield:
> On Thu, 28 Jun 2018 at 13:57, Robert Osfield  wrote:
>> The original osg::Uniform class is a bit of unwieldy mess. In
>> hindsight we shouldn't have gone for this particular implementation as
>> it's a bit too open ended.
> As a bit of background, Mike Weiblen with a bit of input from myself
> created the GLSL support for the OSG before OpenGL 2.0 came out and on
> prototype drivers.  It was completely bleeding edge of OpenGL as well
> as trying to implement this stuff in scene graphs, there was no prior
> art, it was very much winging it.  The fact that is has lasted so long
> without a major rewrite suggests Mike came up with reasonable
> solution.
>
> The first git log entry for osg::Uniform is :
>
> Date:   Thu Feb 24 13:33:35 2005 +
>
> From Mike Weiblen, adding prelimimnary GL Shader Language support
> into core OSG lib.
>with renaming and reordering by Robert Osfield,
>
> 13 years later it's easy to spot better ways of doing it, but kinda
> cool this stuff was once pushing things forward - this work was even
> used a demo at the OpenGL BOF that GLSL/2,0 was launched :-)
>
> Robert.

-- 
*TEXION Software Solutions, Rotter Bruch 26a, D-52068 Aachen*
Phone: +49 241 475757-0
Fax: +49 241 475757-29
Web: http://texion.eu
eMail: i...@texion.eu
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


[osg-users] Constructor parameters of osg::Uniform

2018-06-28 Thread Werner Modenbach
Hi all,

I recently discovered a strange case in creation of a Uniform:

farRadiusRescaleUniform=newosg::Uniform("farRadiusRescale",2.0f);

The only constructor I could find is like that:

Uniform(Typetype,conststd::string,intnumElements=1);

The wrong construction sometimes leads to unexpected results.
Why is the compiler not reclaming about this mismatch in parameters?

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


Re: [osg-users] Strange behaviour on GBufferCamera with 2 attached osg::Image

2018-06-27 Thread Werner Modenbach
Hi Robert,

I'd really like doing that. Unfortunately I'm on Windows and the only
development environment is Qt.
So I cannot even create a small project outside Qt.
But honestly I tend to believe it's something in OSG.
Really the only difference in the 2 versions is the additional
attachment of the depth image.

I'm sorry.

- Werner -

Am 27.06.2018 um 16:04 schrieb Robert Osfield:
> HI Werner,
>
> The code looks OK. I don't see any reason why attaching an image to
> both the colour and depth attachments wouldn't work, it's not
> something I have tested out though.
>
> There is chance it's an OSG bug, but perhaps there is something in
> your setup that isn't quite right.  It's impossible to know from what
> info I have.  Could you create a small test program that tests out
> assigning an image to colour and depth buffers and if this fails then
> share this so others like myself can have a look at it and either spot
> an error on the OSG side or in your code.  If it works then this
> simple case might shine a light on what you are doing differently.
>
> Robert.
> On Wed, 27 Jun 2018 at 14:52, Werner Modenbach
>  wrote:
>> Hi Robert,
>>
>> I'm sorry, I thougth it's OK like that.
>> Find the definition of the "unknown" method below.
>> I think this shrinks the code to be just OSG, except createScreenQuad() but 
>> that should not really matter.
>>
>> Thanks
>>
>> - Werner -
>>
>> Am 27.06.2018 um 15:44 schrieb Robert Osfield:
>>
>> Hi Werner,
>>
>> You appear to be included reference to calls and classes that aren't
>> in the OpenSceneGraph, are you using a 3rd party library that is
>> providing these?
>>
>> At this point I can't see a way of helping you as there bit doing the
>> set up are unknown to us.
>>
>> Robert.
>> On Wed, 27 Jun 2018 at 13:53, Werner Modenbach
>>  wrote:
>>
>> Hi all,
>>
>> I found a strange behavior of a GBufferCamera. I want to get the color 
>> channel in one image and the depth channel in another image.When
>> What I do:
>>
>> if (!renderImage.valid()) {
>>
>> renderImage = new osg::Image;
>>
>> renderImage->allocateImage(width, height, 1, GL_RGBA, 
>> GL_UNSIGNED_BYTE, 1);
>>
>> renderImage->setInternalTextureFormat(GL_RGBA8);
>>
>> }
>>
>> if (includeDepth && !depthImage.valid()) {
>>
>> depthImage = new osg::Image;
>>
>> depthImage->allocateImage(width, height, 1, GL_DEPTH_COMPONENT, 
>> GL_FLOAT, 1);
>>
>> renderImage->setInternalTextureFormat(GL_LUMINANCE32F_ARB);
>>
>> }
>>
>> if (!includeDepth)
>> renderCamera = 
>> view->createRTTCameraImage(osg::Camera::COLOR_BUFFER, 0, renderImage.get(), 
>> true);
>> else
>> renderCamera = 
>> view->createRTTCameraGBufferImage(osg::Camera::COLOR_BUFFER0, 
>> renderImage.get(), osg::Camera::DEPTH_BUFFER, depthImage.get(),
>> 
>> osg::Camera::COLOR_BUFFER1, 0, 0, true);
>>
>> The definition of createRTT...
>>
>> osg::Camera *createRTTCameraGBufferImage(osg::Camera::BufferComponent 
>> _bufferType1, osg::Image *_image1,
>> osg::Camera::BufferComponent 
>> _bufferType2, osg::Image *_image2,
>> osg::Camera::BufferComponent 
>> _bufferType3, osg::Image *_image3,
>> int _orderNumber, bool _isAbsolute, 
>> bool _withScreenQuad = true) {
>>
>> osg::ref_ptr camera = new osg::Camera;
>>
>> camera->getOrCreateStateSet()->setGlobalDefaults();
>>
>> camera->setClearColor(osg::Vec4());
>>
>> camera->setClearMask(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
>>
>> camera->setRenderTargetImplementation(osg::Camera::FRAME_BUFFER_OBJECT);
>>
>> camera->setRenderOrder(osg::Camera::PRE_RENDER, _orderNumber);
>>
>> if (_image1) {
>>
>> camera->setViewport(0, 0, _image1->s(), _image1->t());
>>
>> camera->attach(_bufferType1, _image1);
>>
>> }
>>
>> if (_image2) {
>>
>> camera->setViewport(0, 0, _image2->s(), _image2->t());
>>
>> camera->attach(_bufferType2, _image2 );
>>
>> }
>>
>> if (_image3) {
>>
>>   

Re: [osg-users] Strange behaviour on GBufferCamera with 2 attached osg::Image

2018-06-27 Thread Werner Modenbach
Hi Robert,

I'm sorry, I thougth it's OK like that.
Find the definition of the "unknown" method below.
I think this shrinks the code to be just OSG, except createScreenQuad()
but that should not really matter.

Thanks

- Werner -

Am 27.06.2018 um 15:44 schrieb Robert Osfield:
> Hi Werner,
>
> You appear to be included reference to calls and classes that aren't
> in the OpenSceneGraph, are you using a 3rd party library that is
> providing these?
>
> At this point I can't see a way of helping you as there bit doing the
> set up are unknown to us.
>
> Robert.
> On Wed, 27 Jun 2018 at 13:53, Werner Modenbach
>  wrote:
>> Hi all,
>>
>> I found a strange behavior of a GBufferCamera. I want to get the color 
>> channel in one image and the depth channel in another image.When
>> What I do:
>>
>> if (!renderImage.valid()) {
>>
>> renderImage = new osg::Image;
>>
>> renderImage->allocateImage(width, height, 1, GL_RGBA, 
>> GL_UNSIGNED_BYTE, 1);
>>
>> renderImage->setInternalTextureFormat(GL_RGBA8);
>>
>> }
>>
>> if (includeDepth && !depthImage.valid()) {
>>
>> depthImage = new osg::Image;
>>
>> depthImage->allocateImage(width, height, 1, GL_DEPTH_COMPONENT, 
>> GL_FLOAT, 1);
>>
>> renderImage->setInternalTextureFormat(GL_LUMINANCE32F_ARB);
>>
>> }
>>
>> if (!includeDepth)
>> renderCamera = 
>> view->createRTTCameraImage(osg::Camera::COLOR_BUFFER, 0, renderImage.get(), 
>> true);
>> else
>> renderCamera = 
>> view->createRTTCameraGBufferImage(osg::Camera::COLOR_BUFFER0, 
>> renderImage.get(), osg::Camera::DEPTH_BUFFER, depthImage.get(),
>> 
>> osg::Camera::COLOR_BUFFER1, 0, 0, true);
>>
>> The definition of createRTT...
>>
>> osg::Camera *createRTTCameraGBufferImage(osg::Camera::BufferComponent 
>> _bufferType1, osg::Image *_image1,
>> osg::Camera::BufferComponent 
>> _bufferType2, osg::Image *_image2,
>> osg::Camera::BufferComponent 
>> _bufferType3, osg::Image *_image3,
>> int _orderNumber, bool _isAbsolute, 
>> bool _withScreenQuad = true) {

osg::ref_ptrcamera=newosg::Camera;

camera->getOrCreateStateSet()->setGlobalDefaults();

camera->setClearColor(osg::Vec4());

camera->setClearMask(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);

camera->setRenderTargetImplementation(osg::Camera::FRAME_BUFFER_OBJECT);

camera->setRenderOrder(osg::Camera::PRE_RENDER,_orderNumber);

if(_image1){

camera->setViewport(0,0,_image1->s(),_image1->t());

camera->attach(_bufferType1,_image1);

}

if(_image2){

camera->setViewport(0,0,_image2->s(),_image2->t());

camera->attach(_bufferType2,_image2);

}

if(_image3){

camera->setViewport(0,0,_image3->s(),_image3->t());

camera->attach(_bufferType3,_image3);

}

if(_isAbsolute){

camera->setReferenceFrame(osg::Transform::ABSOLUTE_RF);

camera->setProjectionMatrix(osg::Matrix::ortho2D(0.0,1.0,0.0,1.0));

camera->setViewMatrix(osg::Matrix::identity());

if(_withScreenQuad){

camera->addChild(createScreenQuad(1.0f,1.0f));

}

}

returncamera.release();

}

>>
>>
>> When rendering without depth, I get a correct color channel image.
>> When rendering both, color and depth, the depth image is OK but the color 
>> image seems having only the red color information.
>> Are there any limitations in using 2 images?
>>
>> Has anybody else had such an effect already or can anybody give me a hint?
>>
>> Many thanks in advance
>>
>> - Werner -
>>
>> Many thanks in advance.
>> ___
>> osg-users mailing list
>> osg-users@lists.openscenegraph.org
>> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
> ___
> osg-users mailing list
> osg-users@lists.openscenegraph.org
> 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: i...@texion.eu
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


[osg-users] Strange behaviour on GBufferCamera with 2 attached osg::Image

2018-06-27 Thread Werner Modenbach
Hi all,

I found a strange behavior of a GBufferCamera. I want to get the color
channel in one image and the depth channel in another image.When
What I do:

if(!renderImage.valid()){

renderImage=newosg::Image;

renderImage->allocateImage(width,height,1,GL_RGBA,GL_UNSIGNED_BYTE,1);

renderImage->setInternalTextureFormat(GL_RGBA8);

}

if(includeDepth&&!depthImage.valid()){

depthImage=newosg::Image;

depthImage->allocateImage(width,height,1,GL_DEPTH_COMPONENT,GL_FLOAT,1);

renderImage->setInternalTextureFormat(GL_LUMINANCE32F_ARB);

}

if(!includeDepth)
renderCamera=view->createRTTCameraImage(osg::Camera::COLOR_BUFFER,0,renderImage.get(),true);
else
renderCamera=view->createRTTCameraGBufferImage(osg::Camera::COLOR_BUFFER0,renderImage.get(),osg::Camera::DEPTH_BUFFER,depthImage.get(),
osg::Camera::COLOR_BUFFER1,0,0,true);

The definition of createRTT...

osg::Camera*createRTTCameraGBufferImage(osg::Camera::BufferComponent_bufferType1,osg::Image*_image1,
osg::Camera::BufferComponent_bufferType2,osg::Image*_image2,

osg::Camera::BufferComponent_bufferType3,osg::Image*_image3,

int_orderNumber,bool_isAbsolute,bool_withScreenQuad=true);


When rendering without depth, I get a correct color channel image.
When rendering both, color and depth, the depth image is OK but the
color image seems having only the red color information.
Are there any limitations in using 2 images?

Has anybody else had such an effect already or can anybody give me a hint?

Many thanks in advance

- Werner -

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


Re: [osg-users] Stuck with applying an offset to projection matrix

2018-06-25 Thread Werner Modenbach
Hi Robert,

from your question I guess, I have a fundamental misunderstanding.
But from all the examples and from the OGS book I learned as follows:

If I want to show a hud I have to do it with a hud camera which has
reference frame ABSOLUTE_RF.
The same if I want to have a wallpaper in the background. I have to
create a textured screen quad and show it with camera with ABSOLUTE_RF.
ABSOLUTE_RF seems to be necessary if the object should not be
manipulated by the camera manipulator. Right?

I will be glad to learn if there is some other and more recommended way
to do it.

Many thanks for your never ending patience.

- Werner -

Am 25.06.2018 um 14:59 schrieb Robert Osfield:
> Hi Werner,
>
> What are you using the ABSOLUTE_RF Camera's for?  My guess this is the
> source of the problems, perhaps the approach you've take with this
> works fine for a single viewport but breaks any form of
> multi-viewport/window composition of the view.
>
> Could you explain what the ABSOLUTE_RF Cameras are for?
>
> Robert
> ___
> osg-users mailing list
> osg-users@lists.openscenegraph.org
> 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: i...@texion.eu
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Stuck with applying an offset to projection matrix

2018-06-25 Thread Werner Modenbach
Hi Robert,

thanks for the quick reply.
What I actually need is a very high resolution screenshot from a
standard scene with
some objects displayed like bacxkground, HUD etc.
You are right in viewing at it like a powerwall with those objects being
spread over all screens.

I can easily get the correct result by temporary multiplying the
projection matices of the main
and all ABSOLUTE cameras with an offset matrix (like slave camera).
Doing a .frame(), reading the screenshot
and then doing the next tile.
As a result the screen flickers during this procedure.
My idea was using a slave camera bound to a pixelbuffer, applying an
offset matrix to that camera and at the
same time setting this offset matrix to a uniform with OVERRIDE. All
vertex shaders of ABSOLUTE cameras can
use this uniform to translate vertex positions.
So only the render pass of the slave camera will have those offsets.
Or do you know any better method for, let's say, rendering a screen quad
over many tiles?
I think my problem is the wrong usage of the offset matrix in the vertex
shader.

- Werner -

Am 25.06.2018 um 13:38 schrieb Robert Osfield:
> HI Werner,
>
> It sounds like you are trying to resolve a problem at the low level
> which you have created by setting things up incorrectly and the top
> level.
>
> So.. what you need to do is change how you are configuring things at
> the top level. You don't clearly explain what task you are trying to
> solve and what the main elements are in your scene graph.  It kinda
> sounds like a power wall configuration with a single background image
> that you want to have applied.
>
> Once you explain more clearly what you are trying to achieve - display
> configuration, hardware configuration, what it's in the scene graph
> that you want to appear, then we an have a bash at recommend how to
> configuration the viewer and what you are doing within the scene
> graph.
>
> Robert.
> ___
> osg-users mailing list
> osg-users@lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org



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


[osg-users] Stuck with applying an offset to projection matrix

2018-06-25 Thread Werner Modenbach
Hi all,

I'm experimenting with slave cameras for a while now and now I'm totally
stuck.
I'm doing a tiled display of a scene and for the main scene graph it
works fine with projection offset matrix on the slave cameras
and all cameras having a RELATIVE reference frame.
But my scene also has cameras with ABSOLUTE reference frame (i.e. a
background image).
The background is - of course - fully mapped on each tile.

In order to solve this I modified my vertex shader like that:

   
gl_Position=osg_ModelViewProjectionMatrix*projectionOffsetMatrix*osg_Vertex;


and I populate the projection offset matrix via uniform (same as slave
offset matrix). Unfortunately without the expected success.

For creation of osg_ModelViewPrtojectionMatrix I found this code:

    osg::Matrixd modelViewProjectionMatrix = modelMatrix * viewMatrix *
_camera->getProjectionMatrix();
    uniform->set(modelViewProjectionMatrix);

And in the updateSlaveImplementatiuon I see:

    _camera->setProjectionMatrix(view.getCamera()->getProjectionMatrix()
* _projectionOffset);

So where is my mistake? It should be obvious but it seems I'm blind here.

Many thanks

- Werner -






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


Re: [osg-users] Which character encoding is used by osgText::Text

2018-05-29 Thread Werner Modenbach
Sorry, forget the noise. Sorry again.

Am 29.05.2018 um 16:53 schrieb Werner Modenbach:
> Does anybody know which character encoding osgText::Text is using?
> I have problems with my internationalization.
>
> Many thanks
>
> - Werner -
>
> ___
> osg-users mailing list
> osg-users@lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


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


[osg-users] Which character encoding is used by osgText::Text

2018-05-29 Thread Werner Modenbach
Does anybody know which character encoding osgText::Text is using?
I have problems with my internationalization.

Many thanks

- Werner -

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


[osg-users] How to query calczulated zNear zFar?

2018-05-18 Thread Werner Modenbach
Sorry, I forgot something:
As I found out in debugging cullVisitor, the projectionMatrix of the
child camera gets updated shortly before leaving the apply() method of
the camera. Where does this modified matrix go? I can't find it in the
camera later.



Hi Robert,

thanks for your answer and your willingness for doing some addition to
the software for helping me.

I do not really understand, why the main camera having a scene gets its
projection Matrix updated
from cullVisitor (to conform to calculated zNear and zFar) but if I move
the scene from main camera
to a child camera I have no chance to get zNear/zFar form anywhere.
These values are very useful and/or necessary in many cases ambient
shadow, DoF and others.
The complete deferred shading idea is based on this scheme.
I cruised the Internet for a solution and discovered that many people
are having the same problem like me.
Even in your examples you always calculate the scenes bounding sphere
and derive zNear/zFar from there
which is far from optimal bounds calculated by the cull visitor in
various display situations.

So, yes, having a callback giving me the chance to retrieve those values
would be great. And I think not just for me.

Many thanks in advance.

- Werner -

Am 17.05.2018 um 18:49 schrieb Robert Osfield:
> Hi Werner,
>
> You have a complicated enough scheme that just reading a general
> description really isn't sufficient to understand what is being down
> when etc.  So best I can is provide general suggests.
>
> Would a CullSettings::ClampProjectionMatrixCallback help?  Might
> enable you to intercept or set the values and do what you want with
> them.  This will be called in Cull traversal at the appropriate time.
> I don't recall the details, it's probably well over a decade since I
> looked at this code.
>
> Robert.
>
>
>
> On 17 May 2018 at 15:11, Werner Modenbach <werner.modenb...@texion.eu> wrote:
>> Dear all,
>>
>> I hope someone can help me.
>> I'm really desperate. I can't find the right way retrieving zNear and zFar
>> values
>> from a child camera.
>> I'm debugging now since many days already without success.
>> I have a deferred rendering scene. The main camera doesn't have my scane as
>> child but the rtt-camera.
>> rtt-camera is set RELATIVE_RF, so it is controlled by the camera manipulator
>> of the main camera.
>>
>> What I found out so far:
>> - The viewer calls "renderingTraversals()"
>> - The renderer calls "cull()" which starts a cullVisitor.
>> - When the cullVisitor reaches my child camera it multiplies view and
>> projection matrices and collects correct
>>zNear and zFar values from the cameras child = my scene.
>> - at the and of apply(const osg::Camera&) the method "popProjectionMatrix()"
>> is called which cals "clampProJectionMatrix(...)"
>> - There the projection matrix is modified the correct way according to zNear
>> and zFar.
>> - I have set a CullCallback and a PreDrawCallback at my child camera but
>> none of them can extract zNear and zFar from the cameras ProjectionMatrix.
>>
>> Is there any other way to get these values which get obviously calculated
>> the correct way?
>> I can't find anything in the Internet or in the examples.
>>
>> Many thanks for any hint.
>>
>> - Werner -
>>
>>
>>
>> ___
>> osg-users mailing list
>> osg-users@lists.openscenegraph.org
>> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>>
> ___
> osg-users mailing list
> osg-users@lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org



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


[osg-users] How to query calczulated zNear zFar?

2018-05-17 Thread Werner Modenbach
Dear all,

I hope someone can help me.
I'm really desperate. I can't find the right way retrieving zNear and
zFar values
from a child camera.
I'm debugging now since many days already without success.
I have a deferred rendering scene. The main camera doesn't have my scane
as child but the rtt-camera.
rtt-camera is set RELATIVE_RF, so it is controlled by the camera
manipulator of the main camera.

What I found out so far:
- The viewer calls "renderingTraversals()"
- The renderer calls "cull()" which starts a cullVisitor.
- When the cullVisitor reaches my child camera it multiplies view and
projection matrices and collects correct
   zNear and zFar values from the cameras child = my scene.
- at the and of apply(const osg::Camera&) the method
"popProjectionMatrix()" is called which cals "clampProJectionMatrix(...)"
- There the projection matrix is modified the correct way according to
zNear and zFar.
- I have set a CullCallback and a PreDrawCallback at my child camera but
none of them can extract zNear and zFar from the cameras ProjectionMatrix.

Is there any other way to get these values which get obviously
calculated the correct way?
I can't find anything in the Internet or in the examples.

Many thanks for any hint.

- Werner -


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


[osg-users] Need your help with zNear / zFar calculation

2018-05-03 Thread Werner Modenbach
Dear community,

today I need your help. Since many days I try finding a solution for my
problem - unfortunately without success.

Here are the facts:

I have a view for my scene and a camera manipulator.
The scene has a switch node holding the actual scene and some classes
for creation of shadow, ambient shadow etc.
Everything works pretty well so far.

For some reasons we decided rendering the actual scene into a texture
and displaying this texture in a hud.
So we create a texture and a rtt camera and added it to the above switch.
Then we removed the actual scene from the switch and added it as a child
to the rtt camera.

In order to get the scene moved according to the camera manipulator we
installed a cull callback updating the rtt cameras matrices:

if(renderCamera.valid()){

osg::Camera*cam=getMainCamera();

renderCamera->setViewMatrix(cam->getViewMatrix());

renderCamera->setProjectionMatrix(cam->getProjectionMatrix());

renderCamera->setClearColor(cam->getClearColor());

Without this callback all matrices are odd and zNear and zFar are both
at 0.0f.
Question 1: Why is it like that? The rtt camera is a child of the main
camera and should not need above settings. (?)
Question 2: In the original configuration zNear and zFar of the main
camera gets recalculated continuously.
                        In the rtt configuration zNear is always 0.0f
and zFar always 1f. Why? The rtt camera is child of main camera and
it has the actual scene as a child.
                        So all cullings should take the actual scene in
account.
I'm really lost. When looking at the osgdeferred example I see the rtt
camera is just created, gets a viewport and gets a child of the main
camera. So easy!
What am I doing wrong and/or where can I start for a deeper research?

Many thanks for any help.

- Werner -



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


[osg-users] Creating depth texture in pre render pass and using it in final rendering

2018-03-16 Thread Werner Modenbach
Hi all.

I'm working on converting my application to deferred rendering.
Due to the complexity of the fragment shaders I'm not able to precalculate
everything necessary for the fragment shader into textures.
Some time ago I found an example of calculating the depth texture in a
simple
pre rendering pass and using this depth texture in the final render pass.
If I remember well the example used a glcopy command and disabled
clearing of the depth texture.

Unfortunately I cant find this example any more.

Is there anybody on the list who has hints for my project?

Thanks in advance.


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


[osg-users] Creating an array of same type a given one

2018-01-26 Thread Werner Modenbach
Hi all,

I have to copy data from given arrays (i.e.
geometry->getTexCoordArrayList())
into new arrays of the same type. So I have to do something like

    osg::Geometry::ArrayListtextureCoords=geometry->getTexCoordArrayList();

    osg::Geometry::ArrayListtextureCoordsNew(textureCoords.size());

for(inti=0;isetTexCoordArrayList(textureCoordsNew);


Has anybody a hint for me how to solve this?

Many thanks in advance.

- Werner -

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


[osg-users] Strange behaviour - no explanation

2018-01-24 Thread Werner Modenbach
Hi all,

I import a 3DS model and after import it shows me a flat structure of
geodes:

Final OSG node structure looks like this:

Group

    Geode

        Geometry

    Geode

        Geometry

    Geode

        Geometry

    Geode

        Geometry

    Geode

        Geometry

    Geode

        Geometry

    Geode

        Geometry

        Geometry

    Geode

        Geometry

    Geode

        Geometry

        Geometry

    Geode

        Geometry

        Geometry

    Geode

        Geometry

    Geode

 Geometry

    Geode

        Geometry

    Geode

        Geometry

        Geometry

        Geometry

        Geometry

        Geometry

    Geode

        Geometry

    Geode

        Geometry

    Geode

        Geometry

        Geometry

        Geometry

        Geometry

    Geode

        Geometry

    Geode

        Geometry

    Geode

        Geometry

    Geode

        Geometry

    Geode

        Geometry

    Geode

        Geometry

    Geode

        Geometry

        Geometry

    Geode

        Geometry

    Geode

        Geometry

    Geode

        Geometry

        Geometry

    Geode

        Geometry

    Geode

        Geometry

        Geometry

    Geode

        Geometry

        Geometry

    Geode

        Geometry

    Geode

        Geometry

    Geode

        Geometry

    Geode

        Geometry

        Geometry

        Geometry

        Geometry

    Geode

        Geometry

    Geode

        Geometry

        Geometry

        Geometry

        Geometry

    Geode

        Geometry

    Geode

        Geometry

    Geode

        Geometry

    Geode

        Geometry

    Geode

        Geometry

    Geode

        Geometry

    Geode

        Geometry

    Geode

        Geometry

        Geometry

    Geode

        Geometry

    Geode

        Geometry   


I do a pick with a LineSegmentIntersector.
The Interesections array contains 1 hit.
It is a geometry and has 1 parent - the geode.
I want this geometry to show in line mode.
geometry->getOrCreateStateSet()->setAttribute(newosg::PolygonMode(osg::PolygonMode::FRONT_AND_BACK,osg::PolygonMode::LINE));

But many geometries show up in line mode.
I wrote a check NodeVisitor and this visitor finds many geometries being
set to LineMode.
I wrote another visitor which explicitely disables linemode on all
geometries after loading of the model:
geometry->getOrCreateStateSet()->setMode(osg::StateAttribute::POLYGONMODE,osg::StateAttribute::OFF);
I already spent many hours on that but I'm running out of ideas.

Any hint from someone in the list?

Many thanks in advance

- Werner -




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


[osg-users] Scaling visitor not working as expected

2018-01-09 Thread Werner Modenbach
Hi all,

I'm loading 3ds scenes as subnodes into my scene. The 3ds coordinates
are in a different scale than my scene.
Usually I would solve this by a transform. But because of internal
reasons I need the vertices being
in MY coordinate measure.
So I wrote a scaling visitor, that multiplies al vertices of geometries
by a given factor.
That works perfectly fine when loading the 3ds scene:
/       
osg::ref_ptrnode=osgDB//::readRefNodeFile(//path//);
//
       
ScaleVisitorsv(//initialObjectScale*correctiveObjectScale//); //
//        //node->//accept//(sv); //
//        //addChild//(node); //
/
Unfortunately when rescaling the object after being added as a child
this doesn't work any more:
/        osg::ref_ptr node=getChild(0);
//        ScaleVisitorsv(scaleChange);//
        //node->accept(sv);/

The 3ds scene doesn't change size on my screen.
The visitor calls:
        vertices->dirty();
        geom.dirtyBound();

But nothing happens. What am I missing? Deleting the 3ds scene and
recreating it from scratch works OK but is very inefficient.

Thanks for any hint.

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


Re: [osg-users] Using visitor to transfer material color to geometry color

2018-01-08 Thread Werner Modenbach
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:
> 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 -
>
>
> ___
> osg-users mailing list
> osg-users@lists.openscenegraph.org
> 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: i...@texion.eu
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


[osg-users] Using visitor to transfer material color to geometry color

2018-01-08 Thread Werner Modenbach
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 -
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


[osg-users] Preview gfenerator plugin for Windows

2017-12-22 Thread Werner Modenbach
Hi community,

I'm looking for a Windows explorer plugin for creation of previews/icons
of 3D data files.
Does anybody know if something like that is available somewhere?
Sources would be preferred because of adding proprietary formats.

Many thanks

- Werner -

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


[osg-users] Setting up a shadowDepthCamera

2017-09-08 Thread Werner Modenbach

Hi all!

I'm still working on my shadow technique for OpenGL 3 shaders.
I only partially manage setting the matrix for the light camera creating 
the shadowMap.


What I do:
    osg::Vec3lightPositionVS=mainCamera->getViewMatrix()*lightPosition;

osg::Vec3eye;

osg::Vec3center;

osg::Vec3up;

mainCamera->getViewMatrixAsLookAt(eye,center,up,view->getDistance());

shadowDepthCamera->setViewMatrixAsLookAt(center,center+lightPositionVS,up);

That works quite fine except it doesn't honor the manipulations which are
usually done by the model matrix (scaling / translation).
So I guess I should do something like that:
        osg::Vec3lightPositionVS=???->getModelMatrix() * 
mainCamera->getViewMatrix()*lightPosition;

I have references to the view and to the mainCamera.
I found out that the model matrix is held by the cameraManipulator.
Unfortunately I couldn't find and way to get the manipulator from the 
references I have.
Any other things I have to care about?

Or is there any other approach in setting up the shadowDepthCamera?

Any idea?

Thanks

- Werner -

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


[osg-users] Idea about shadows

2017-09-06 Thread Werner Modenbach

Hi all,

today I come over with an idea about avoiding an additional render pass 
for creating shadows.
I highly appreciate any comments and maybe hints before I start with a 
trial implementation.


I use deferred shading and my scene gets rendered in a prerender pass in 
order to get

i.e. a depth map for various effects like ambient occlusion.
I'd also like calculating shadows. The usual approach is adding an 
additional render pass
with a camera located at the light position. This gives the depth 
texture from the light point.


In the final shading pass, done from the final camera position,  I need 
a matrix for calculating
the actual positions depth from light point and compare it with the 
shadow maps depth.


So I think I could do some comparable calculation in my prerender pass 
and create a shadow map
manually without having the shadowmap prerender pass even when the 
actual camera position

isn't at light position. This would be a very welcome speedup.

Maybe I'm misleaded. So please kindly comment.

Thank you

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


[osg-users] RenderBin vs. SlaveCamera

2017-08-03 Thread Werner Modenbach

Hi all,

I'm restructuring my project because I want to implement some multi pass 
effects.

I have some problems understanding the different approaches for example when
creating HUD displays.
The approach I used so far is attaching a SlaveCamera and puttung it in 
PostRender pass.
On the other hand I found an approach of just attaching the matrices to 
the root node and

assigning the HUD geometry to a RenderBin with high number.

I'd like to understand the difference of the approaches and the pros and 
cons.


Is there any one who can help me with that?

Thanks

- Werner -

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


[osg-users] draw primitive sets and geometry shader in opengl 3

2017-05-24 Thread Werner Modenbach

I have a simple question but couldn't find an answer.

My geode is assigned a geometry shader that starts with

layout(lines_adjacency)in;
 


For drawing geometry 1 I use
geometry1->addPrimitiveSet(newosg::DrawArrays(osg::PrimitiveSet::LINE_STRIP_ADJACENCY,0,count)); 



That works absolutely fine.

For drawing geometry 2 in the same geode I use
geometry2->addPrimitiveSet(newosg::DrawArrays(osg::PrimitiveSet::TRIANGLE_FAN,0,count)); 



Is the geometry shader just skipped for the second geometry? Or must I 
assign an individual shader for each geometry?

This might be a big slowdown because I have really many of those geodes.
Is it possible to define 2 geometry shaders with different layouts in 
one shader program?


Thanks for any hints.

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


[osg-users] Disable rendering to screen

2017-04-28 Thread Werner Modenbach

Hi all,

I have a scene with child cameras.
I add a rtt slave camera and want only the slave to render and nothing 
being rendered to the screen.


I tried setting the ColorMask of the main camera to all false.
This works for the main  camera, but the child cameras still render to 
screen.
Setting ColorMask on the child cameras is no option because they need to 
render on the slave camera.


Is there any easy way of suppressing rendering to screen when calling 
frame() method?


Thanks for any hints.

- Werner -

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


Re: [osg-users] Fast move a lot of nodes to another group

2017-04-04 Thread Werner Modenbach

Ah OK,

so why not adding them as children into 2 switch nodes and just 
switching them an and off as needed.
It should not really be an overhead since the pointers are shared and 
disabled nodes are ignored.


- Werner -

Am 04.04.2017 um 12:33 schrieb Yura Ivanov:

I already have such transform to move all nodes in a group. But I need to move 
nodes selected by user.

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





___
osg-users mailing list
osg-users@lists.openscenegraph.org
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: i...@texion.eu
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Fast move a lot of nodes to another group

2017-04-04 Thread Werner Modenbach

Hi Yura,

just make the transform node a permanent member of your scene and
let it be identity or your specific transform as needed.

- Werner -

Am 31.03.2017 um 10:05 schrieb Yura Ivanov:

Hi,
I need to move a lot of nodes from Group to MatrixTransform to translate them 
into new position by user input, and then move them back into Group with new 
position. Call addChild and removeChild for each node is slow because of 
removeChild. Also I cant use removeChildren to remove all nodes at once because 
my node list is not continuous.



Thank you!

Cheers,
Yura

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





___
osg-users mailing list
osg-users@lists.openscenegraph.org
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: i...@texion.eu
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Significant drop in frame rate when updating from OSG 3.2.1 to 3.4.0

2017-03-31 Thread Werner Modenbach

Hi Robert,

final analysis:

In our software we did the following patch to make it run with high fps 
in master of 3.4 branch:


osgNormals=newosg::Vec3Array;

+osgNormals->setBinding(osg::Array::BIND_PER_VERTEX);

geometry->setNormalArray(osgNormals.get());

geometry->setNormalBinding(osg::Geometry::BIND_PER_VERTEX);

Obviously we have to set the binding in the array itself and the 
setNormalBinding works but has poor performance.


Now we are happy again :-)

- Werner -

Am 31.03.2017 um 13:11 schrieb Werner Modenbach:

Hi Robert,

the 3.4.0 tagged version is OK with the frame rate.
We discovered your commit in the 3.4 branch causing the problem:

From1f1c21772ae0dd10a93cd31ab81bf563802b7b2dMonSep1700:00:002001
From:RobertOsfield<rob...@openscenegraph.com>
Date:Thu,3Nov201611:31:07+
Subject:Addedcheckagainstbindingtypeofarraytodecidewhetherit's
appropriatetoassignarraytoVBO.
diff--gita/src/osg/Geometry.cppb/src/osg/Geometry.cpp
index779e8cd..244bf25100644
---a/src/osg/Geometry.cpp
+++b/src/osg/Geometry.cpp
@@-445,7+445,7@@boolGeometry::getDrawElementsList(DrawElementsList)const
voidGeometry::addVertexBufferObjectIfRequired(osg::Array*array)
{
-if(_useVertexBufferObjects)
+if(_useVertexBufferObjects&>getBinding()==Array::BIND_PER_VERTEX)
{
if(!array->getVertexBufferObject())
{

The question is: Why is the viewer frame rate OK, even it is built 
with the same version we are using?

What are we doing different to the viewer?

Thanks so much for your excellent work!

- Werner -

Am 28.03.2017 um 18:22 schrieb Robert Osfield:

Hi Wener,

On 28 March 2017 at 16:24, Werner Modenbach 
<werner.modenb...@texion.eu <mailto:werner.modenb...@texion.eu>> wrote:


I know it is actually not your duty giving help here but you are very
familiar with the driver calls and it would help a lot if you can
provide
an idea what kind of setting might cause this issue.


I'm a very occasional Windows user so really don't have much 
experience with Windows drivers to be able help with driver settings.


It's a long shot, but have your tried the OSG-3.4 branch or OSG 
master as these both contain a range of bug fixes/OSG improvements, 
there is chance that something has changed that might fix things.


Whatever the cause is it seems to be some small OpenGL state 
difference between OSG-3.2 and OSG-3.4.0, I'm afraid I don't know 
what this might be.  Perhaps using a 3rd party OpenGL debugging tool 
might help here - capture all the GL calls for 3.2.x and 3.4.x and 
see what the differences are.


Robert.


___
osg-users mailing list
osg-users@lists.openscenegraph.org
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: i...@texion.eu


___
osg-users mailing list
osg-users@lists.openscenegraph.org
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: i...@texion.eu
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Significant drop in frame rate when updating from OSG 3.2.1 to 3.4.0

2017-03-31 Thread Werner Modenbach

Hi Robert,

the 3.4.0 tagged version is OK with the frame rate.
We discovered your commit in the 3.4 branch causing the problem:

From1f1c21772ae0dd10a93cd31ab81bf563802b7b2dMonSep1700:00:002001

From:RobertOsfield<rob...@openscenegraph.com>

Date:Thu,3Nov201611:31:07+

Subject:Addedcheckagainstbindingtypeofarraytodecidewhetherit's

appropriatetoassignarraytoVBO.

diff--gita/src/osg/Geometry.cppb/src/osg/Geometry.cpp

index779e8cd..244bf25100644

---a/src/osg/Geometry.cpp

+++b/src/osg/Geometry.cpp

@@-445,7+445,7@@boolGeometry::getDrawElementsList(DrawElementsList)const

voidGeometry::addVertexBufferObjectIfRequired(osg::Array*array)

{

-if(_useVertexBufferObjects)

+if(_useVertexBufferObjects&>getBinding()==Array::BIND_PER_VERTEX)

{

if(!array->getVertexBufferObject())

{


The question is: Why is the viewer frame rate OK, even it is built with 
the same version we are using?

What are we doing different to the viewer?

Thanks so much for your excellent work!

- Werner -

Am 28.03.2017 um 18:22 schrieb Robert Osfield:

Hi Wener,

On 28 March 2017 at 16:24, Werner Modenbach 
<werner.modenb...@texion.eu <mailto:werner.modenb...@texion.eu>> wrote:


I know it is actually not your duty giving help here but you are very
familiar with the driver calls and it would help a lot if you can
provide
an idea what kind of setting might cause this issue.


I'm a very occasional Windows user so really don't have much 
experience with Windows drivers to be able help with driver settings.


It's a long shot, but have your tried the OSG-3.4 branch or OSG master 
as these both contain a range of bug fixes/OSG improvements, there is 
chance that something has changed that might fix things.


Whatever the cause is it seems to be some small OpenGL state 
difference between OSG-3.2 and OSG-3.4.0, I'm afraid I don't know what 
this might be.  Perhaps using a 3rd party OpenGL debugging tool might 
help here - capture all the GL calls for 3.2.x and 3.4.x and see what 
the differences are.


Robert.


___
osg-users mailing list
osg-users@lists.openscenegraph.org
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: i...@texion.eu
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Significant drop in frame rate when updating from OSG 3.2.1 to 3.4.0

2017-03-28 Thread Werner Modenbach

Hi Robert,

I have done 1 week of testing now on the dramatic performance issue.
As I said, when linking my program against osg 3.2.1 I get 60 fps
and linking the program without any change against version 3.4.0 I get 
2.5 fps.

Exporting my scene and running it in your viewer in 3.4.0 also has 60 fps.
So the problem is somewhere in the settings of my software. :-(
I used 2 different tools for profiling and both tell me that about 95% 
of the
running time is done in nvoglv64.dll. One of the tool tells me it is 
mainly the

function "DrvPresentBuffers" but I'm not sure if this is reliable.

I know it is actually not your duty giving help here but you are very
familiar with the driver calls and it would help a lot if you can provide
an idea what kind of setting might cause this issue.

Many thanks in advance

- Werner -

Am 20.03.2017 um 18:08 schrieb Robert Osfield:

Hi Werner,

Hopefully others will be able to chip in as I don't have a answer 
right now, it's certainly very odd.  If it were a general problem then 
we'd seen lots of issue with it being reported.


With this level of slow down it's almost like your'e invoking a 
software renderer when running with 3.4.0.


My next thought is that perhaps an OpenGL error is being invoked 
somehow. Are there any errors being reported to the console?


What happens with the standard OSG example set?  Does osgviewer run 
any differently with models you have on the two versions.


Robert.



On 20 March 2017 at 15:29, Werner Modenbach 
<werner.modenb...@texion.eu <mailto:werner.modenb...@texion.eu>> wrote:


Hi Robert,

I updated my project from version 3.2.1 to 3.4.0.
I'm on Window 7 Pro.
Unfortunately the frame rate dropped significantly from 60 fps to
2.x fps.
I verified it several times by just linking to the 2 versions
without any change of my code.
Please see the 2 screen shots with the stats output.

Do you have any idea what might be the reason for it or how I can
do further analysis?

Thanks for any idea.

- Werner -

Ich habe 2 zu dieser E-Mail gehörende Dateien hochgeladen:
OSG 3.4.0.png
<https://www.hightail.com/download/dDZFdFdRMm1veE5vZE1UQw>(727
KB)Hightail

<https://www.hightail.com>https://www.hightail.com/download/dDZFdFdRMm1veE5vZE1UQw
<https://www.hightail.com/download/dDZFdFdRMm1veE5vZE1UQw>
OSG 3.2.1.png
<https://www.hightail.com/download/dDZFdFdRMm1veE5jR01UQw>(628
KB)Hightail

<https://www.hightail.com>https://www.hightail.com/download/dDZFdFdRMm1veE5jR01UQw
<https://www.hightail.com/download/dDZFdFdRMm1veE5jR01UQw>
Mozilla Thunderbird <http://www.getthunderbird.com> macht es
einfach, große Dateien über E-Mails zu teilen.


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




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


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


Re: [osg-users] Please test OpenSceneGraph master in prep for 3.5.6 dev release

2017-03-24 Thread Werner Modenbach

Hi Robert,

just a little side info.
I tried our application with the 3.5.5(?) branch about 2 weeks ago
and everything was fine except hud texts were all coming out in black.
I don't know if that is a useful hint.

Thanks

- Werner -

Am 24.03.2017 um 18:27 schrieb Robert Osfield:

HI Li,

My best guess is that the first cut of fallback shaders I've added for
GLES2/GLES3 and GL3core are being enabled accidentally for some
reason.  These shaders shaders are add in the
StateSet::setGlobalDefaults() method implementation found in
OpenSceneGraph/src/osg/StateSet.cpp.  Could you put an #if 0 #endif
around all the shader code in StateSet::setGlobalDefaults(), do a
build and see if that restores the rendering back to normal.

These fallback shaders are there just to make sure there users see
something on screen when no fixed function pipeline isn't available.
I'm currently working on a experimental shader_pipeline branch of the
OSG that has support for intergrating #pragmat(ic) shader composition
with fixed function StateAttribute to get pure shader based builds to
work in the same way as fixed function systems so that old fixed
function based models work in shaders without problems and no need for
generating shaders manually.

For this dev release that shader_pipeline work won't be merged, I was
hoping that the fallback shaders in OSG master wouldn't affect
standard OSG builds, if it isn't I'll need to have a look at how the
#idef's are all put together.

Robert.

On 24 March 2017 at 16:15, Li Chi  wrote:

Hi Robert,


What CMake build options did you select when building?

I'm using the default OPENGL and OSG options, please see the attached file.


What type of hardware and drivers are you using?

Display Driver: Intel HD 530 and Nvidia GTX 970m, and I got the same results.
I simply run: osgViewer.exe cow.osg


Do any of the OSG examples work? Does stats work?

Stats work fine.
Other examples can normally startup, but the result pictures are same as the 
previous post.


Do previous versions of the OSG work OK?

Last week's version(master branch) works fine.


Thank you!

Cheers,
Li

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




Attachments:
http://forum.openscenegraph.org//files/cmake_138.png


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

___
osg-users mailing list
osg-users@lists.openscenegraph.org
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: i...@texion.eu
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Bug in 3.4.0 when exporting .osgx file?

2017-03-21 Thread Werner Modenbach

Hi Robert,

the problem is here:

if 
(osgDB::Registry::instance()->loadLibrary(pluginLib)==osgDB::Registry::LOADED)

return findWrapper(name);

return NULL;

The loadLibrary() returns PREVIOUSLY_LOADED and not LOADED.
So NULL gets returned instead of a wrapper pointer and thus the node doesn't 
get exported.
Or am I on the wrong search path?

I try exporting my scene into an .osgx file by calling:
osg::ref_ptrrw=osgDB::Registry::instance()->getReaderWriterForExtension( 
osgDB::getLowerCaseFileExtension(_filename.toStdString())); 
if(!rw.valid()) returnfalse; osgDB::ReaderWriter::WriteResultresult=rw->writeNode(_node,_filename.toStdString());


result.success() is true.
It creates a file containing only the outer xml header and no scene data. node 
is of type osg::group


Am 21.03.2017 um 14:42 schrieb Robert Osfield:

Hi Werner,

I can't work out what might be wrong form the description.

In general the ObjectWrapperManager::findWrapper() checks wrappers
that have been registered with it first, then if it fails to find one
then attempts to load plugins that may be able to provide that
wrapper. If the code is getting to the find return then it's an
indication that the wrapper has been found.  Given this the
ObjectWrapperManager::findWrapper() code looks correct.

This review would suggest that the issue is likely elsewhere.  What
might be wrong is not something I can say at this stage.  Would it be
possible create a test case that reproduces the problem so others can
look into it?

Robert.


On 21 March 2017 at 13:15, Werner Modenbach <werner.modenb...@texion.eu> wrote:

Hi Robert,

I think I catched another problem in version 3.4.0.
I try exporting my scene as .osgx file.
But except the xml header nothing is written.
I debuged it and found the following sequence of calls:


 osg::ref_ptr rw =
osgDB::Registry::instance()->getReaderWriterForExtension(


osgDB::getLowerCaseFileExtension(_filename.toStdString()));

 if (!rw.valid())

 return false;

 osgDB::ReaderWriter::WriteResult result = rw->writeNode(_node,
_filename.toStdString());

-> ReaderWriterOSG2::writeNode(...)

 result = writeNode( node, fout, local_opt.get() );

-> ReaderWriterOSG2::writeNode(...)

 os.writeObject(  ); CATCH_EXCEPTION(os);

-> OutputStream::writeObject(...)

 if (newID)
 {
 writeObjectFields(obj);
 }

-> OutputStream::writeObjectFields(...)

 ObjectWrapper* wrapper =
Registry::instance()->getObjectWrapperManager()->findWrapper( name );
 if ( !wrapper )
 {
 OSG_WARN << "OutputStream::writeObject(): Unsupported wrapper class
"
 << name << std::endl;
 return;
 }

-> OutputStream::writeObjectFields(...)

 ObjectWrapper* wrapper =
Registry::instance()->getObjectWrapperManager()->findWrapper( name );
 if ( !wrapper )
 {
 OSG_WARN << "OutputStream::writeObject(): Unsupported wrapper class
"
 << name << std::endl;
 return;
 }
-> ObjectWrapperManager::findWrapper(...)

 pluginLib =
osgDB::Registry::instance()->createLibraryNameForExtension(libName);
 if (
osgDB::Registry::instance()->loadLibrary(pluginLib)==osgDB::Registry::LOADED
)
 return findWrapper(name);
 }
 return NULL;

The loadLibrary(...) method returns "PREVIOUSLY_LOADED" and so NULL is
returned and nothing gets written.

I think that should be different. Am I right?

- Werner -



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


___
osg-users mailing list
osg-users@lists.openscenegraph.org
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: i...@texion.eu
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


[osg-users] Bug in 3.4.0 when exporting .osgx file?

2017-03-21 Thread Werner Modenbach

Hi Robert,

I think I catched another problem in version 3.4.0.
I try exporting my scene as .osgx file.
But except the xml header nothing is written.
I debuged it and found the following sequence of calls:


osg::ref_ptrrw=osgDB::Registry::instance()->getReaderWriterForExtension( 



osgDB::getLowerCaseFileExtension(_filename.toStdString()));

if(!rw.valid())

returnfalse;

osgDB::ReaderWriter::WriteResultresult=rw->writeNode(_node,_filename.toStdString());

-> ReaderWriterOSG2::writeNode(...)
result=writeNode(node,fout,local_opt.get());

-> ReaderWriterOSG2::writeNode(...) os.writeObject();CATCH_EXCEPTION(os);

->OutputStream::writeObject(...)

if(newID)
{
writeObjectFields(obj);
}

->OutputStream::writeObjectFields(...)

ObjectWrapper*wrapper=Registry::instance()->getObjectWrapperManager()->findWrapper(name);
if(!wrapper)
{
OSG_WARN<<"OutputStream::writeObject():Unsupportedwrapperclass"
<OutputStream::writeObjectFields(...)

ObjectWrapper*wrapper=Registry::instance()->getObjectWrapperManager()->findWrapper(name);
if(!wrapper)
{
OSG_WARN<<"OutputStream::writeObject():Unsupportedwrapperclass"
<ObjectWrapperManager::findWrapper(...)

pluginLib=osgDB::Registry::instance()->createLibraryNameForExtension(libName);
if(osgDB::Registry::instance()->loadLibrary(pluginLib)==osgDB::Registry::LOADED)
returnfindWrapper(name);
}
returnNULL;

The loadLibrary(...) method returns "PREVIOUSLY_LOADED" and so NULL is returned 
and nothing gets written.

I think that should be different. Am I right?

- Werner -


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


[osg-users] Significant drop in frame rate when updating from OSG 3.2.1 to 3.4.0

2017-03-20 Thread Werner Modenbach

Hi Robert,

I updated my project from version 3.2.1 to 3.4.0.
I'm on Window 7 Pro.
Unfortunately the frame rate dropped significantly from 60 fps to 2.x fps.
I verified it several times by just linking to the 2 versions without 
any change of my code.

Please see the 2 screen shots with the stats output.

Do you have any idea what might be the reason for it or how I can do 
further analysis?


Thanks for any idea.

- Werner -

Ich habe 2 zu dieser E-Mail gehörende Dateien hochgeladen:
OSG 3.4.0.png 
(727 
KB)Hightail 
https://www.hightail.com/download/dDZFdFdRMm1veE5vZE1UQw
OSG 3.2.1.png 
(628 
KB)Hightail 
https://www.hightail.com/download/dDZFdFdRMm1veE5jR01UQw
Mozilla Thunderbird  macht es einfach, 
große Dateien über E-Mails zu teilen.




binQ0SqVuwJ4x.bin
Description: Binary data


binxMcBV91Bzv.bin
Description: Binary data
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] How do cameras handle the render target?

2017-03-15 Thread Werner Modenbach

Hi Sebastion,

thanks for the quick reply.
What do you mean by composing to the same FBO? As i wrote attaching the
FBO to the child cameras the same way as with the main camera just 
delivers a black fbImage.


Concerning the screen capture example:
I remember an easier version where a slave camera was created with a 
pbuffer context and then

an image attached like thgat:

osg::ref_ptrpbo=newosg::PixelBufferObject(image.get()); 



image->setPixelBufferObject(pbo.get());

image->allocateImage(width,height,1,GL_RGBA,GL_UNSIGNED_BYTE,1);

camera->attach(osg::Camera::COLOR_BUFFER,image.get());

pbuffer->realize();

This seams more convenient than fiddling with gl functions.
I still have that version but it also shows only the rendered model.
Is it possible that the rendering is just not completed after the 
viewer->frame() call?

Is it necessary having a finalDrawCallback instead?

Thanks again

- Werner -

Am 15.03.2017 um 11:28 schrieb Sebastian Messerschmidt:


Hi Werner,


from diagonal reading:

You could make all cameras composing to the same FBO and get the 
texture in a final pass that can either put the image to Framebuffer 
or read back the texture. Also take a look at the screenshot example 
(using pbuffer) and the various draw callbacks.


Cheers
Sebastian



Hi all.

I have a problem understanding how cameras handle render targets.
My special case:
I have a standard camera on a view.
The root node of the scene is a group with the following children:

- my model
- hud camera for wallpaper
- hud camera for text
- more cameras for special cases

All the cameras are children of the group node and do POST_RENDER 
operation.


I need snapshots of the complete scene from various camera positions.
What I do:

osg::ref_ptrcamera=view->getCamera();

osg::ref_ptrfbImage=newosg::Image;

fbImage->allocateImage(width,height,1,GL_RGBA,GL_UNSIGNED_BYTE,1);

osg::Camera::RenderTargetImplementationrti=camera->getRenderTargetImplementation(); 


camera->setRenderTargetImplementation(osg::Camera::FRAME_BUFFER_OBJECT);
camera->attach(osg::Camera::COLOR_BUFFER,fbImage.get(),0,0);
camera->dirtyAttachmentMap();

Then I do snapshots with the modified projection matrix of the camera.
After each snapshot I read the contents of the fbImage.

I reset everything to the initial status by:

camera->setRenderTargetImplementation(rti);

camera->detach(osg::Camera::COLOR_BUFFER);

camera->dirtyAttachmentMap();


Unfortunately the fbImage always only contains my model but not the
child cameras renderings.
Attaching the fbImage to the child cameras as well gives me just a black
fbImage.
Of course the child cameras do not clear the color buffer.

What is the proper way of receiving the complete rendering? I also tried
already
installing a slave camera to the main camera but that also gives me only
the rendered model.
And rendering to the fbImage by installing an additional child camera
with POST_RENDER instead
of a slave camera leads to the same result.

Rendering to screen is perfect, but to fbImage is not.
It seems I'm blind on some basic functionality and all my research
doesn't open my eyes.

I instantly hope for some help.

Thanks

- Werner -


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




___
osg-users mailing list
osg-users@lists.openscenegraph.org
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: i...@texion.eu
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


[osg-users] How do cameras handle the render target?

2017-03-15 Thread Werner Modenbach

Hi all.

I have a problem understanding how cameras handle render targets.
My special case:
I have a standard camera on a view.
The root node of the scene is a group with the following children:

- my model
- hud camera for wallpaper
- hud camera for text
- more cameras for special cases

All the cameras are children of the group node and do POST_RENDER operation.

I need snapshots of the complete scene from various camera positions.
What I do:

osg::ref_ptrcamera=view->getCamera();

osg::ref_ptrfbImage=newosg::Image;

fbImage->allocateImage(width,height,1,GL_RGBA,GL_UNSIGNED_BYTE,1);

osg::Camera::RenderTargetImplementationrti=camera->getRenderTargetImplementation();
camera->setRenderTargetImplementation(osg::Camera::FRAME_BUFFER_OBJECT);
camera->attach(osg::Camera::COLOR_BUFFER,fbImage.get(),0,0);
camera->dirtyAttachmentMap();

Then I do snapshots with the modified projection matrix of the camera.
After each snapshot I read the contents of the fbImage.

I reset everything to the initial status by:

camera->setRenderTargetImplementation(rti);

camera->detach(osg::Camera::COLOR_BUFFER);

camera->dirtyAttachmentMap();


Unfortunately the fbImage always only contains my model but not the 
child cameras renderings.
Attaching the fbImage to the child cameras as well gives me just a black 
fbImage.

Of course the child cameras do not clear the color buffer.

What is the proper way of receiving the complete rendering? I also tried 
already
installing a slave camera to the main camera but that also gives me only 
the rendered model.
And rendering to the fbImage by installing an additional child camera 
with POST_RENDER instead

of a slave camera leads to the same result.

Rendering to screen is perfect, but to fbImage is not.
It seems I'm blind on some basic functionality and all my research 
doesn't open my eyes.


I instantly hope for some help.

Thanks

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


Re: [osg-users] How to get Center Parameter of CameraManipulator

2017-03-15 Thread Werner Modenbach

view->getCamera()->getViewMatrixAsLookAt(...)

Am 15.03.2017 um 04:27 schrieb duc nguyen:

Hi,
After setCameraManipulator for my viewer i can get the Eye parameter of camera 
but cannot get the Center parameter to get the point of my camera looking at. 
How to get this value?

Here is the way i get the Eye parameter:


Code:
osg::Matrixd mt = _viewer->getCameraManipulator()->getMatrix();
Vec3d eye = mt.getTrans();





Thank you!

Cheers,
duc

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





___
osg-users mailing list
osg-users@lists.openscenegraph.org
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: i...@texion.eu
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Is it possible to temporarily redirect the main camera of a view?

2017-03-10 Thread Werner Modenbach

Hi Glen,

thanks for the hint. I'm still sticking with version 3.2 and this method 
is not available there.

I will try to move to the latest version and do like you suggested.

Thanks

- Werner -

Am 09.03.2017 um 15:24 schrieb Glenn Waldron:

Werner,
I have never switched render targets at runtime before, but I have 
switched attachments and needed to call camera->dirtyAttachmentMap() 
after calling attach() or detach(). Maybe that will work.


Glenn Waldron

On Thu, Mar 9, 2017 at 9:10 AM, Werner Modenbach 
<werner.modenb...@texion.eu <mailto:werner.modenb...@texion.eu>> wrote:


Hi all.

Is it possible to redirect the main camera of a view temporarily
to a FBO?
It is my intention to get a snapshot of the scene with a modified
projection matrix.
I think about something like that:

osg::ref_ptr camera = view->getCamera();
osg::Camera::RenderTargetImplementation rti =
camera->getRenderTargetImplementation();
osg::MatrixdprojectionMatrix=view->getCamera()->getProjectionMatrix();
camera->setRenderTargetImplementation(osg::Camera::FRAME_BUFFER_OBJECT);
osg::ref_ptr fbImage=newosg::Image;

fbImage->allocateImage(width,height,1,GL_RGBA,GL_UNSIGNED_BYTE,1);

camera->attach(osg::Camera::COLOR_BUFFER,fbImage.get(),0,0);

camera->setProjectionMatrix(projectionMatrix*offsetMatrix);

view->frame(); camera->setRenderTargetImplementation(rti);
camera->detach(osg::Camera::COLOR_BUFFER );

camera->setProjectionMatrix(projectionMatrix);


I tried it but my screen gets updated on the frame()  call with
the modified projection matrix and the image stays black. Thanks
for any hints.- Werner -
___ osg-users mailing
list osg-users@lists.openscenegraph.org
<mailto:osg-users@lists.openscenegraph.org>
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
<http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org>


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


[osg-users] Is it possible to temporarily redirect the main camera of a view?

2017-03-09 Thread Werner Modenbach

Hi all.

Is it possible to redirect the main camera of a view temporarily to a FBO?
It is my intention to get a snapshot of the scene with a modified 
projection matrix.

I think about something like that:

osg::ref_ptr camera = view->getCamera();
osg::Camera::RenderTargetImplementation rti = 
camera->getRenderTargetImplementation();

osg::MatrixdprojectionMatrix=view->getCamera()->getProjectionMatrix();

camera->setRenderTargetImplementation(osg::Camera::FRAME_BUFFER_OBJECT);

osg::ref_ptr fbImage=newosg::Image;

fbImage->allocateImage(width,height,1,GL_RGBA,GL_UNSIGNED_BYTE,1);

camera->attach(osg::Camera::COLOR_BUFFER,fbImage.get(),0,0);

camera->setProjectionMatrix(projectionMatrix*offsetMatrix);

view->frame();

camera->setRenderTargetImplementation(rti);
camera->detach(osg::Camera::COLOR_BUFFER );

camera->setProjectionMatrix(projectionMatrix);


I tried it but my screen gets updated on the frame()  call with the 
modified projection matrix

and the image stays black.

Thanks for any hints.

- Werner -

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


[osg-users] About separate rendering of a slave camera

2017-03-07 Thread Werner Modenbach

Hi all.

I have a view with a main camera and an additional slave camera with a 
pixel buffer context.
At the moment I call frame() on the view to get the rendered pixel 
buffer contents.
Is there any way of just rendering on the slave camera without getting 
the view updated?


Many thanks

- Werner -

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


Re: [osg-users] How to handle cameras in the scene graph when rendering to framebuffer

2017-02-27 Thread Werner Modenbach
Sorry, found the second parameter of  setRenderOrder, but using this on
the wallpaper and the framebuffer camera doen't make a difference,
independent of the numbers I assign.

Am 27.02.2017 um 12:08 schrieb Werner Modenbach:
> Hi Robert,
>
> you may be right. There are several (more) objects that have to be
> rendered in a certain sequence and PRE-/NORMAL-/POST-RENDER is
> a little weak for fine grained tuning.
> Can I use
> StateSet->setRenderBinDetails( 11, "RenderBin");
>
> instead? That should work, isn't it?
> What are the bin numbers usually used for the 3 modes?
>
> Am 27.02.2017 um 12:02 schrieb Robert Osfield:
>> HI Werner,
>>
>> It's hard to work exactly what is going on with a quick read through
>> as it's rather complicated set up of various Camera's.  My current
>> best guess Your Cl_3D_Wallpaper class is setting the RenderOrder to
>> POST_RENDER as this is make it render after the Camera you are adding
>> to do the screenshot has been done.
>>
>> Perhaps the best way to work out what order things are being done in
>> is to add a Camera initiali, pre, post and a final DrawCallbacks to
>> each of the Camera's and have these debug callbacks just write to the
>> console when they are being called.
>>
>> Robert.
>>
>> On 27 February 2017 at 10:34, Werner Modenbach
>> <werner.modenb...@texion.eu> wrote:
>>> Hi Robert,
>>>
>>> sorry for the delayed answer. It's carnival time here and so everybody is
>>> out - except me ;-)
>>>
>>> I try to give an as compressed description as possible here.
>>>
>>> The scene looks like that:
>>>  *
>>>
>>>   *  ---
>>>
>>>   *  | RootNode  |
>>>
>>>   *  ---
>>>
>>>   *   /\
>>>
>>>   *---
>>> -
>>>
>>>   *| ShadowScene ||evtl.
>>> PPU-Prozessor|
>>>
>>>   *---
>>> -
>>>
>>>   */ \
>>>
>>>   *--- ---
>>>
>>>   *|  Switchnode | | LightSource |
>>>
>>>   *--- ---
>>>
>>>   * /  \\\
>>>
>>>   * --- -
>>>
>>>   * |  User scene | | evtl. further |
>>>
>>>   * --- | Objects   |
>>>
>>>   * -
>>>
>>> The further objects are the wallpaper, a magnifier etc.
>>>
>>>
>>> The main camera is a standard camera with perspective view and a trackball
>>> manipulator.
>>> The wallpaper class is like that:
>>> class Cl_3D_Wallpaper : public osg::Camera {
>>>
>>> public:
>>>
>>> Cl_3D_Wallpaper(Cl_3Dview_osg *_parent);
>>>
>>> /** This Method creates the background image. */
>>>
>>> void setWallpaper(const QString _path);
>>>
>>> protected:
>>> Cl_3Dview_osg *view;
>>> QString path;
>>> };
>>>
>>>
>>> Cl_3D_Wallpaper::Cl_3D_Wallpaper(Cl_3Dview_osg *_parent): view(_parent),
>>> path(QLatin1String("")) {
>>>
>>> setCullingActive( false );
>>>
>>> setClearMask( 0 );
>>>
>>> setAllowEventFocus( false );
>>>
>>> setReferenceFrame( osg::Transform::ABSOLUTE_RF );
>>>
>>> setRenderOrder( osg::Camera::POST_RENDER );
>>>
>>> setProjectionMatrix( osg::Matrix::ortho2D(0.0, 1.0, 0.0, 1.0) );
>>>
>>> setName(getNodeName().toStdString().c_str());
>>>
>>> osg::StateSet* ss = getOrCreateStateSet();
>>>
>>> ss->setMode( GL_LIGHTING, osg::StateAttribute::OFF );
>>>
>>> ss->setAttributeAndModes( new osg::Depth(osg::Depth::LEQUAL, 1.0, 1.0)
>&

Re: [osg-users] How to handle cameras in the scene graph when rendering to framebuffer

2017-02-27 Thread Werner Modenbach
Hi Robert,

you may be right. There are several (more) objects that have to be
rendered in a certain sequence and PRE-/NORMAL-/POST-RENDER is
a little weak for fine grained tuning.
Can I use

StateSet->setRenderBinDetails( 11, "RenderBin");

instead? That should work, isn't it?
What are the bin numbers usually used for the 3 modes?


Am 27.02.2017 um 12:02 schrieb Robert Osfield:
> HI Werner,
>
> It's hard to work exactly what is going on with a quick read through
> as it's rather complicated set up of various Camera's.  My current
> best guess Your Cl_3D_Wallpaper class is setting the RenderOrder to
> POST_RENDER as this is make it render after the Camera you are adding
> to do the screenshot has been done.
>
> Perhaps the best way to work out what order things are being done in
> is to add a Camera initiali, pre, post and a final DrawCallbacks to
> each of the Camera's and have these debug callbacks just write to the
> console when they are being called.
>
> Robert.
>
> On 27 February 2017 at 10:34, Werner Modenbach
> <werner.modenb...@texion.eu> wrote:
>> Hi Robert,
>>
>> sorry for the delayed answer. It's carnival time here and so everybody is
>> out - except me ;-)
>>
>> I try to give an as compressed description as possible here.
>>
>> The scene looks like that:
>>  *
>>
>>   *  ---
>>
>>   *  | RootNode  |
>>
>>   *  ---
>>
>>   *   /\
>>
>>   *---
>> -
>>
>>   *| ShadowScene ||evtl.
>> PPU-Prozessor|
>>
>>   *---
>> -
>>
>>   */ \
>>
>>   *--- ---
>>
>>   *|  Switchnode | | LightSource |
>>
>>   *--- ---
>>
>>   * /  \\\
>>
>>   * --- -
>>
>>   * |  User scene | | evtl. further |
>>
>>   * --- | Objects   |
>>
>>   * -
>>
>> The further objects are the wallpaper, a magnifier etc.
>>
>>
>> The main camera is a standard camera with perspective view and a trackball
>> manipulator.
>> The wallpaper class is like that:
>> class Cl_3D_Wallpaper : public osg::Camera {
>>
>> public:
>>
>> Cl_3D_Wallpaper(Cl_3Dview_osg *_parent);
>>
>> /** This Method creates the background image. */
>>
>> void setWallpaper(const QString _path);
>>
>> protected:
>> Cl_3Dview_osg *view;
>> QString path;
>> };
>>
>>
>> Cl_3D_Wallpaper::Cl_3D_Wallpaper(Cl_3Dview_osg *_parent): view(_parent),
>> path(QLatin1String("")) {
>>
>> setCullingActive( false );
>>
>> setClearMask( 0 );
>>
>> setAllowEventFocus( false );
>>
>> setReferenceFrame( osg::Transform::ABSOLUTE_RF );
>>
>> setRenderOrder( osg::Camera::POST_RENDER );
>>
>> setProjectionMatrix( osg::Matrix::ortho2D(0.0, 1.0, 0.0, 1.0) );
>>
>> setName(getNodeName().toStdString().c_str());
>>
>> osg::StateSet* ss = getOrCreateStateSet();
>>
>> ss->setMode( GL_LIGHTING, osg::StateAttribute::OFF );
>>
>> ss->setAttributeAndModes( new osg::Depth(osg::Depth::LEQUAL, 1.0, 1.0)
>> );
>>
>> view->installDefaultShader(ss);  // In case we are on gl3
>>
>> }
>>
>> /** Diese Methode erzeugt eine Hintergrundbildanzeige,
>>
>>   * falls der Pfad auf eine Bilddatei verweist.
>>
>>   */
>>
>> void Cl_3D_Wallpaper::setWallpaper(const QString _path) {
>>
>>   path = _path;
>>
>> if (!_path.isEmpty()) {
>>
>> // 
>>
>> // Die Szene des Bildes erzeugen
>>
>> // 
>>
>> osg::Geode* geode = new osg::Geode();
>&

Re: [osg-users] How to handle cameras in the scene graph when rendering to framebuffer

2017-02-27 Thread Werner Modenbach
 my code here with the background of giving an example to
others looking for functionality like that.




Am 24.02.2017 um 17:56 schrieb Robert Osfield:
> Hi Werner,
>
> In principle what you are doing should be possible.  What is going
> wrong in your instance is impossible to say without seeing how you are
> setting up the viewer Camera's and the in scene graph Camera's.
>
> Robert.
>
> On 24 February 2017 at 16:44, Werner Modenbach
> <werner.modenb...@texion.eu> wrote:
>> Hi all,
>> sorry for so many questions today.
>>
>> My scene graph has additional cameras as children somewhere in the scene
>> graph.
>> For example a hud camera for a background image.
>>
>> I do screenshots by adding a slave camera to the main camera which renders
>> the scene to the FB.
>> Unfortunately this rendering doesn't show the parts of the nested cameras,
>> i.e. no
>> background wallpaper.
>> What is the recommended way to solve this?
>>
>> Thanks for any help.
>>
>> - Werner -
>>
>>
>> ___
>> osg-users mailing list
>> osg-users@lists.openscenegraph.org
>> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
> ___
> osg-users mailing list
> osg-users@lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

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


[osg-users] How to handle cameras in the scene graph when rendering to framebuffer

2017-02-24 Thread Werner Modenbach

Hi all,
sorry for so many questions today.

My scene graph has additional cameras as children somewhere in the scene 
graph.

For example a hud camera for a background image.

I do screenshots by adding a slave camera to the main camera which 
renders the scene to the FB.
Unfortunately this rendering doesn't show the parts of the nested 
cameras, i.e. no

background wallpaper.
What is the recommended way to solve this?

Thanks for any help.

- Werner -


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


Re: [osg-users] Text colors in shaders

2017-02-24 Thread Werner Modenbach

Hi Robert,

thanks for the good explanations - as we are used from your side :-)
I cannot switch completely to gl3 because I have customers whose 
hardware/driver doesn't support it

So at the start of the application I analyze it and use the

camera->getGraphicsContext()->getState()->setUseModelViewAndProjectionUniforms(useGL3);
camera->getGraphicsContext()->getState()->setUseVertexAttributeAliasing(useGL3);

accordingly. It's for sure a burden but what can I do?

Thanks for your excellent support!

- Werner -

Am 24.02.2017 um 16:09 schrieb Robert Osfield:

On 24 February 2017 at 14:30, Werner Modenbach
<werner.modenb...@texion.eu> wrote:

that's great. It works with the shader you suggested.
Strange is, that just using vertex color doesn't work. It seems alpha is set
to transparent (0).
Also a texture is set but only alpha has a meaning. Texture color is black.
That looks odd to me.

If you build the OSG against the GL3 core profile it maps the texture
format to GL_RED rather than GL_ALPHA as the later is no longer
supported.  The graphics hardware doesn't expand GL_RED in the same
way as GL_ALPHA so it can cause problems.  It's a bit of pain having
GL pull the rug from GL_ALPHA as it has a particularly useful mapping.
Potentially one could use texture swizzle to get round this but it's
not support on all GL versions.

Robert.
___
osg-users mailing list
osg-users@lists.openscenegraph.org
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: i...@texion.eu
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


[osg-users] osgShadow and gl3

2017-02-24 Thread Werner Modenbach

Hi all,

my project needs gl3 features and so I use the following methods:

camera->getGraphicsContext()->getState()->setUseModelViewAndProjectionUniforms(useGL3); 

camera->getGraphicsContext()->getState()->setUseVertexAttributeAliasing(useGL3); 



Of course I need my own shaders then.
I'm trying to make osgShadow working with my project.
So far I have found the shader codes in StandardShadowMap and I try 
merging the functionality with my own shaders.
Where I'm struggling is the gl_EyePlane[STRQ] stuff. It seems that is 
not made available as osg_EyePlane[STRQ] like other

gl_ variables. Am I right? Is there any known way to get this working?

Also there are cameras used inside shadowmaps. Those cameras have their 
own shaders (?) which are not gl3 conformant.

Can this be influenced from my application?

Thanks for any hints.

- Werner -

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


Re: [osg-users] Text colors in shaders

2017-02-24 Thread Werner Modenbach

Hi Sebastian,

that's great. It works with the shader you suggested.
Strange is, that just using vertex color doesn't work. It seems alpha is 
set to transparent (0).

Also a texture is set but only alpha has a meaning. Texture color is black.
That looks odd to me.

But anyway, I'm happy now.

- Werner -

Am 24.02.2017 um 13:16 schrieb Sebastian Messerschmidt:



Am 2/24/2017 um 12:57 PM schrieb Werner Modenbach:

Dear all,

my project needs gl3 features and so I use the following methods:


camera->getGraphicsContext()->getState()->setUseModelViewAndProjectionUniforms(useGL3); 



camera->getGraphicsContext()->getState()->setUseVertexAttributeAliasing(useGL3); 



Of course I need my own shaders then.
But I also like having built-in functionality like StatsHandler.
To set a simple shader for the StatsHandlers camera I do like that:

osgViewer::StatsHandler*sthd=newosgViewer::StatsHandler;

view->addEventHandler(sthd);

if(useGL3){
stateSet=sthd->getCamera()->getOrCreateStateSet();

stateSet->getOrCreateUniform(BASE_TEXTURE_UNIFORM,osg::Uniform::INT_SAMPLER_2D)->set(BASE_TEXTURE_UNIT); 



stateSet->setTextureAttributeAndModes(BASE_TEXTURE_UNIT,textur_weiss.get(),osg::StateAttribute::ON); 



installDefaultShader(stateSet);

}

The shaders are really simple:
VERTEX

uniformmat4osg_ModelViewProjectionMatrix;
uniformmat4osg_ModelViewMatrix;

uniformmat3osg_NormalMatrix;

uniformvec3lightPosition0=vec3(0.0f,0.0f,1.0f);

invec4osg_Vertex;

invec4osg_Normal;

invec4osg_Color;

invec4osg_MultiTexCoord0;

outvec3normal;

outvec3lightDir;

outvec4vertexColor;

outvec2textureCoord;

voidmain(){

normal=normalize(osg_NormalMatrix*osg_Normal.xyz);

vec3vertexPos=vec3(osg_ModelViewMatrix*osg_Vertex);

lightDir=normalize(lightPosition0-vertexPos);

vertexColor=osg_Color;

textureCoord=osg_MultiTexCoord0.xy;

gl_Position=osg_ModelViewProjectionMatrix*osg_Vertex;

}


FRAGMENT

uniformsampler2DbaseTexture;

invec3normal;
invec3lightDir;

invec4vertexColor;

invec2textureCoord;

outvec4fragData;

voidmain(){

vec4textureColor=texture2D(baseTexture,textureCoord);
fragData=vertexColor*textureColor;

}


That works fine for the graphics but all text is black. Obviously text
does not set osg_Color .


osg_Color is an alias for the color-vertex attribute. Colors are set in
void Text::drawForegroundText ~line 1628. So there should be colors.

My fragment shader looks like this:

#version 440
#extension GL_ARB_enhanced_layouts : enable
#extension GL_ARB_separate_shader_objects : enable

layout (location=0) out vec4 FragmentData;

layout(location=1) in block
{
mediump vec2 tex_coord;
mediump vec4 color;
} In;


uniform sampler2D osg_Texture;

void main()
{

vec4 diffuse_color = In.color;

diffuse_color *=  texture2D(osg_Texture, In.tex_coord).a;

FragmentData = diffuse_color;
}

which seems to work. As you can see I'm using the alpha channel only.

Cheers
Sebastian



Unfortunately I failed discovering the reason in the sources of osg.

Can anyone give me a hint on how to solve this?

Many thanks in advance

- Werner -



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




___
osg-users mailing list
osg-users@lists.openscenegraph.org
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: i...@texion.eu
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


[osg-users] Text colors in shaders

2017-02-24 Thread Werner Modenbach

Dear all,

my project needs gl3 features and so I use the following methods:

camera->getGraphicsContext()->getState()->setUseModelViewAndProjectionUniforms(useGL3);

camera->getGraphicsContext()->getState()->setUseVertexAttributeAliasing(useGL3);

Of course I need my own shaders then.
But I also like having built-in functionality like StatsHandler.
To set a simple shader for the StatsHandlers camera I do like that:

osgViewer::StatsHandler*sthd=newosgViewer::StatsHandler;

view->addEventHandler(sthd);

if(useGL3){
stateSet=sthd->getCamera()->getOrCreateStateSet();

stateSet->getOrCreateUniform(BASE_TEXTURE_UNIFORM,osg::Uniform::INT_SAMPLER_2D)->set(BASE_TEXTURE_UNIT);

stateSet->setTextureAttributeAndModes(BASE_TEXTURE_UNIT,textur_weiss.get(),osg::StateAttribute::ON);

installDefaultShader(stateSet);

}

The shaders are really simple:
VERTEX

uniformmat4osg_ModelViewProjectionMatrix;
uniformmat4osg_ModelViewMatrix;

uniformmat3osg_NormalMatrix;

uniformvec3lightPosition0=vec3(0.0f,0.0f,1.0f);

invec4osg_Vertex;

invec4osg_Normal;

invec4osg_Color;

invec4osg_MultiTexCoord0;

outvec3normal;

outvec3lightDir;

outvec4vertexColor;

outvec2textureCoord;

voidmain(){

normal=normalize(osg_NormalMatrix*osg_Normal.xyz);

vec3vertexPos=vec3(osg_ModelViewMatrix*osg_Vertex);

lightDir=normalize(lightPosition0-vertexPos);

vertexColor=osg_Color;

textureCoord=osg_MultiTexCoord0.xy;

gl_Position=osg_ModelViewProjectionMatrix*osg_Vertex;

}


FRAGMENT

uniformsampler2DbaseTexture;

invec3normal;
invec3lightDir;

invec4vertexColor;

invec2textureCoord;

outvec4fragData;

voidmain(){

vec4textureColor=texture2D(baseTexture,textureCoord);
fragData=vertexColor*textureColor;

}


That works fine for the graphics but all text is black. Obviously text 
does not set osg_Color .

Unfortunately I failed discovering the reason in the sources of osg.

Can anyone give me a hint on how to solve this?

Many thanks in advance

- Werner -

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


[osg-users] TrackballManipulator versus Camera->setProjectionMatrix

2017-01-17 Thread Werner Modenbach

Hi OSG community,

my application needs "zoom keys". As a result the cursor position
gets centered in the window and depending on key the scene gets
zoomed.
I do this with this short method:

/**A zoom key was pressed (ESC,F1-F5)

*_xand_y is the cursor position in the window scaled to-1.0..+1.0

*/

voidCl_3Dview_osg::handleZoom(double_x,double_y,double_scale){

osg::MatrixoffsetMatrix=

osg::Matrix::scale(_scale,_scale,1.0)*

osg::Matrix::translate(-_scale*_x,_scale*_y,0.0);

view->getCamera()->setProjectionMatrix(view->getCamera()->getProjectionMatrix()*offsetMatrix);

}

The camera has a TrackballManipulator. After my offset is applied the 
home position of the manipulator is lost.
I guess I have to control the manipulator instead of the projection 
matrix of the camera.


Unfortunately I get stock because I don't manage to convert this 
accordingly.


I hope for some help here.

Many thanks for any hints.

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


Re: [osg-users] How to implement pagedLOD without reading from files?

2016-11-16 Thread Werner Modenbach
Hi Robert,

I think I have all the coding done and in my opinion  it should work.
But it doesn't and I figured out why.
When using osgDB with my own ReaderWriter it automatically uses the
dynamic load feature and the ReaderWriter is expected to be a dll in the
plugins folder.
Unfortunately my ReaderWriter is very much depending on many classes I
have in my
project and also has dependencies to Qt.
Creating such a dll would be a complete overkill of link dependencies.
Is there any way avoiding the dynamic load mechanism and using an
instance of a
class being part of my static libs?

Thanks in advance for any hints.

- Werner -

Am 11.11.2016 um 12:47 schrieb Robert Osfield:
> Hi Wener,
>
> On 11 November 2016 at 11:32, Werner Modenbach
> <werner.modenb...@texion.eu> wrote:
>> just one more small question.
>> As to my understanding the ReaderWriter classes are instantiated
>> automatically
>> according to the "file extensions". So I get no hands on the instances of
>> the reader.
>> How can I give the reader class a reference to my data structures?
> You can pass data into a plugin via the osgDB::Options object that you
> can pass along with the string used for the filename.  The Options
> object can store user data as well be subclassed.
>
> Robert.
> ___
> osg-users mailing list
> osg-users@lists.openscenegraph.org
> 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: i...@texion.eu
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] How to implement pagedLOD without reading from files?

2016-11-11 Thread Werner Modenbach
Thanks Robert.

I think I should use the PluginDataMap to provide pointers to classes or
structures. Right?

Thanks again. Very quick and good help!

- Werner -

Am 11.11.2016 um 12:47 schrieb Robert Osfield:
> Hi Wener,
>
> On 11 November 2016 at 11:32, Werner Modenbach
> <werner.modenb...@texion.eu> wrote:
>> just one more small question.
>> As to my understanding the ReaderWriter classes are instantiated
>> automatically
>> according to the "file extensions". So I get no hands on the instances of
>> the reader.
>> How can I give the reader class a reference to my data structures?
> You can pass data into a plugin via the osgDB::Options object that you
> can pass along with the string used for the filename.  The Options
> object can store user data as well be subclassed.
>
> Robert.
> ___
> osg-users mailing list
> osg-users@lists.openscenegraph.org
> 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: i...@texion.eu
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] How to implement pagedLOD without reading from files?

2016-11-11 Thread Werner Modenbach
Hi Chris,

just one more small question.
As to my understanding the ReaderWriter classes are instantiated
automatically
according to the "file extensions". So I get no hands on the instances
of the reader.
How can I give the reader class a reference to my data structures?

Thanks

- Werner -

Hi Chris,

thanks a lot. I knew it must be easy somehow but I was blind for the
solution.
Yes, I have to subclass ReaderWriter and that's it. Wow!

- Werner -

Am 09.11.2016 um 18:43 schrieb Chris Hanson:
> Basically you make a custom URI scheme to name each "file" in the
> PagedLOD object, like
>
> 12345567890.werner_texion_tile
>
> Then you create and register a pseudoloader that accepts requests for
> "files" ending in the ".werner_texion_tile" extension. But when your
> pseudoloader is called to "load" one of these "files", you simply
> parse the "filename" to get the tile ID from it, and then construct
> the resulting subgraph using the assets already available in memory
> (or over a network, or however you wish to get the real data to make
> the subgraph) and return it as if you had just loaded it from disk.
>
> There's nothing "disk" specific about the URI system in the PagedLOD
> subsystem.
>
> ​
>
>
> ___
> osg-users mailing list
> osg-users@lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

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


Re: [osg-users] How to implement pagedLOD without reading from files?

2016-11-10 Thread Werner Modenbach
Hi Chris,

thanks a lot. I knew it must be easy somehow but I was blind for the
solution.
Yes, I have to subclass ReaderWriter and that's it. Wow!

- Werner -

Am 09.11.2016 um 18:43 schrieb Chris Hanson:
> Basically you make a custom URI scheme to name each "file" in the
> PagedLOD object, like
>
> 12345567890.werner_texion_tile
>
> Then you create and register a pseudoloader that accepts requests for
> "files" ending in the ".werner_texion_tile" extension. But when your
> pseudoloader is called to "load" one of these "files", you simply
> parse the "filename" to get the tile ID from it, and then construct
> the resulting subgraph using the assets already available in memory
> (or over a network, or however you wish to get the real data to make
> the subgraph) and return it as if you had just loaded it from disk.
>
> There's nothing "disk" specific about the URI system in the PagedLOD
> subsystem.
>
> ​
>
>
> ___
> osg-users mailing list
> osg-users@lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


[osg-users] How to implement pagedLOD without reading from files?

2016-11-09 Thread Werner Modenbach
Dear community,

I have to visualize huge simulation images on a textured quad.
Because of the size of the textures I decided for using a pagedLOD
approach and tiles.
This was really nicely described by Rui Wang
(https://www.packtpub.com/books/content/openscenegraph-methods-improving-rendering-efficiency)
My problem: All examples and descriptions I can find are related to
loading from files or databases.
The tiles of the large image I have are not in files but they are
structures in the RAM.
I'm sure it is very simple to implement some kind of derived class or
callback or something like
that for creating the nodes as textured quads depending on the LOD per
program code.

Looks like being a trivial question but I couldn't find the solution.

Thanks for any hints, examples etc.

- Werner -


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


Re: [osg-users] Feedback/guidance sought on move of osgQt out into it's own project/repository

2016-09-06 Thread Werner Modenbach
Hi Robert,

if I recognized well, there are still frequent questions on the list
about Qt-interface in OSG.
At least we are using it very intensely. There was not much move in the
interface since long and so
we just take it as it was and as it works so far.
The threading problem is a bit unsatisfactory but we learned to live
with it.

For us it would be a big problem if further compatibility between OSG
and Qt would break.
I fully understand that you like to focus on the real OSG related tasks.
I have no idea what the best way would be for the future.
Unfortunately I also have not enough expertise to support Qt interface.

But I instantly hope there will be a good solution.

- Werner -

Am 06.09.2016 um 15:09 schrieb Robert Osfield:
> Do we not have any Qt users anymore? No one care enough to chip in?
>
> I'm not going to wait around forever before making decisions.  I need
> to get on with moving the OSG towards OSG-3.6.
>
> The OSG/Qt users need to decide how they want to progress from here
> once osgQt has been move out from the core OSG.  If you don't step up
> then osgQt will likely languish unloved and unsupported. I don't have
> the Qt expertise to do the support, you guys need to step up.
> ___
> osg-users mailing list
> osg-users@lists.openscenegraph.org
> 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: i...@texion.eu
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Trouble with NodeMask and shadows

2016-08-25 Thread Werner Modenbach
Hi Pete.
Thanks for your reference link. I now did it with my own shaders and of
course it works.
First I activated the fixed function shaders because I thought there
must be some integrated
mechanism for switching on and off shadows. Otherwise in my opinion the
definition of
receiveShadowMask doesn't make any sense. Or am I missing something?

Anyway, thanks for your answer.

- Werner -

Am 24.08.2016 um 23:10 schrieb Pete Black:
> Pretty sure osgShadow doesn't do anything with the receiveShadows mask bit - 
> , at least when using any of the shadow map algorithms.
>
> Some reference to this:
>
> http://osg-users.openscenegraph.narkive.com/eMJHm8Gm/osgshadow-question
>
> --
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=68444#68444
>
>
>
>
>
> ___
> osg-users mailing list
> osg-users@lists.openscenegraph.org
> 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: i...@texion.eu
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


[osg-users] Trouble with NodeMask and shadows

2016-08-22 Thread Werner Modenbach
Hi!
I have a little issue with a scene with shadows.
I need to have within a scene that has shadows an object that doesn't
cast and doesn't receive shadows.

Here is what I do:

  constintReceivesShadowTraversalMask=0x1;

constintCastsShadowTraversalMask=0x2;

intmask=geode->getNodeMask()&~CastsShadowTraversalMask&~ReceivesShadowTraversalMask;

geode->setNodeMask(mask);

The geode doesn't cast shadows as expected. But unfortunately it receives 
shadow.
I have to mention that the object is in the transparent bin.

How can I prevent the object from receiving shadows?

- Werner -

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


[osg-users] Any recommendation on displaying spline surfaces?

2016-07-13 Thread Werner Modenbach
Hi all.

I have to visualize objects defined by parametric spline surfaces.
Is there any recommended way to do this in osg?

Thanks for any hint

- Werner -


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


Re: [osg-users] osgShadow with GLES

2016-07-04 Thread Werner Modenbach

Hi Pierre-Jean,

I was also doing some research in that.
I think the shader you adopted is not the only place where shaders have 
to be given.

I found some place with comments like
"I don't use my shader because the fixed function shaders have better 
performance".

This is just how I remember the comment - so not exactly reproduced.
To be honest the research was consuming to much of my time.
But it would be really great if share your solution if you manage to 
solve this.


- Werner -

Am 04.07.2016 um 17:48 schrieb Pierre-Jean Petitprez:

Hi,

I would like to use the osgShadow soft shadow map on an Android device (with 
GLES 2).
I have already written my own Phong shader for my objects which works very 
well. Now I would like to add the shadow map. I have taken the shader code from 
the SoftShadowMap.cpp file and I have adapted it to add it in my own shader.
But this does not seem to work, the applied shadow map is always fully white.

Maybe this has to do with the texture coordinates that are used.

Can someone enlighten me on using osgShadow with GLES 2 ?

Thank you!

Cheers,
Pierre-Jean

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





___
osg-users mailing list
osg-users@lists.openscenegraph.org
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: i...@texion.eu
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


[osg-users] Hiding shader sources

2016-01-21 Thread Werner Modenbach

Hi all,

we are using OSG with big success since many years now. Thanks Robert 
and the community.

We are in a commercial context and we have to care about the know-how.
We use Open-GL 3 and make heavy use of shaders.
So my question is:
Is there any way of hiding shader sources so they cannot be sniffed?

Thanks for any help

- Werner -


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


[osg-users] shadows in an GL 3.2 / glsl 1.5 environment

2015-09-02 Thread Werner Modenbach

Dear all,

I need to do shadows in an GL 3.2 / glsl 1.5 environment.
I was using osgShadow with LightSpacePerspectiveShadowMapCB technique 
before moving to 3.2/1.5.
I tried to track down the necessary actions and I think I have to solve 
3 items:

1) Assigning new shaders to the technique (StandardShadowMap
2) Setting setUseModelViewAndProjectionUniforms(true) and 
setUseVertexAttributeAliasing(true) to the state

3) Find a workaround for TexGen
1) is easy
2) should be possible.
3) Makes me some headache.
osg::TexGen.apply simply says: "TexGen::apply(State&)-notsupported"
By searching the Internet I found at http://http://docs.gl/gl3/glTexGen
++

If the texture generation function is |GL_EYE_LINEAR|, the function

g=p1′′×xe+p2′′×ye+p3′′×ze+p4′′×we

is used, where

(p1′′p2′′p3′′p4′′)=(p1p2p3p4)M-1

and xe, ye, ze, and weare the eye coordinates of the vertex, p1, p2, p3, 
and p4are the values supplied in /|params|/, and Mis the modelview 
matrix when |glTexGen| is invoked. If Mis poorly conditioned or 
singular, texture coordinates generated by the resulting function may be 
inaccurate or undefined.


Note that the values in /|params|/ define a reference plane in eye 
coordinates. The modelview matrix that is applied to them may not be the 
same one in effect when the polygon vertices are transformed. This 
function establishes a field of texture coordinates that can produce 
dynamic contour lines on moving objects.


++
That looks like if I have the light position of the shadow casting light 
and the planes somehow given in uniforms
I should be able to do the necessary texture coordinate calculation in 
the vertex shader.

I just don't have the necessary knowledge to do it.
My first question: Is it correct that the planes are constant and not 
depending on camera movements?
Second question: Is it correct that the above modelView matrix is the 
one from the camera when shadow are created (Light view)?


Does anybody has a link where I can dig further into that or is there 
even a "ready to use" example implementation?


Thanks for any hints.

- Werner -

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


Re: [osg-users] Qt5 integration

2015-08-17 Thread Werner Modenbach
Hi Ricky,
I understand your point of view here. But I think there are multiple use cases. 
If I understand your approach well you intend having a 3d rendering app with 
some nice qt based features.
On the other hand we are developing a lot of software in the textile 
environment and 3d simulation of the fabric is just an optional add-on. So the 
main aspect in our case is having a geometry managed embedded window showing an 
ist scene.
So for us James's contribution is just what we need.
As I said before, there are many scenarios for interacting qt and osg.


On 17. August 2015 18:33:46 MESZ, Riccardo Corsi riccardo.co...@kairos3d.it 
wrote:
Hi James,

I haven't looked into osg+qt integration since a while so I might not
be
aware of the latest features available.

From my point of view the most desired feature is to be able to
integrate a
qt scene (a GUI layout or a browser/pdf/svg viewer widget) inside an
osg
driven application smoothly - i.e. without the need of a Qt application
to
run as main thread loop, but hiding it as a slave somewhere in an osg
module/node, to make those widget pluggable in a regular osg
application.

Instead if you're interested, a while ago I coded an integration to
render
with osg inside a QtQuick+QML application.
Basically the solution implements a custom QtQuick node which renders
an
osgViewer scene to an FBO, and then copies the FBO contents back to the
Qt
context, to make it available in the qt/qml scenegraph which renders
the
widgets.
The osgQuickNode uses a separate OpenGL context, not to interfere with
the
one used by Qt for its own scene rendering.
All the code is here: https://github.com/rickyviking/qmlosg
If you have questions about the implementation feel free to write me.

Ricky

On Mon, Aug 17, 2015 at 12:54 PM, Robert Osfield
robert.osfi...@gmail.com
wrote:

 HI Alistair,

 I'm not familiar with Qt5/QQuck2 so can't comment on the Qt side, so
have
 to defer to others on this.

 On the OSG side osgViewer is designed specifically to handle a thread
per
 graphics context/window - it's a core feature of how
osg::GraphicsContext,
 osg::GraphicsThread are designed and implemented.  If Qt5 requires a
thread
 per window then this is a model that osgViewer can be capable of
handling
 since it's inception (well before Qt5), the only question would be to
how
 to integrate the threading in synchronization operations that Qt5 is
 forcing upon the set up with the way that the OSG manages things. 
Perhaps
 subclassing from osg::GraphicsThread might be one approach or other
classes.

 I don't know if the other direction might be possible - stop Qt
trying to
 do everything that the OSG can already do perfectly without it.

 Robert.

 On 17 August 2015 at 09:48, Alistair Baxter alist...@mve.com wrote:

 As you are no doubt aware, James, we've been looking into this sort
of
 integration ourselves. QQuick 2 integration is part of our goal,
although
 we hadn't been planning direct interaction between QML and out osg
scenes,
 since we have a separate data model. Although if such a thing
existed, and
 were sufficiently convenient to use, then we might be interested in
 integrating it in a similar way to how we use the existing 3D osg
 manipulators. We've never really been interested in QWidgetImage, we
only
 ever used it to try and get round a window composition issue on OSX.

 Our main concern at the moment is that we need a multi-window
viewer. Due
 to the way Qt 5 has a separate opengl render thread per Window, this
has
 meant reimplementing a significant chunk of OSGCompositeViewer in
order to
 get it to work at all, and we are discovering a variety of
 thread-synchronisation issues.
 ___
 osg-users mailing list
 osg-users@lists.openscenegraph.org

http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org



 ___
 osg-users mailing list
 osg-users@lists.openscenegraph.org

http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org






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


[osg-users] Using osg::shadow with Gl 3.2 (Shader 1.5)

2015-08-06 Thread Werner Modenbach

Due to several reasons I had to convert a project to above versions.
I was successful almost all over the project due to the excellent work 
of osg exported uniforms etc.

The last item I have to solve now is shadow.
I'm using osgShadow::LightSpacePerspectiveShadowMapCB and I found out 
how to replace

 the given shaders.
In my old vertex shader I had to calculate the shadow texture coordinate 
like that:


if(useShadow){

gl_TexCoord[1].s=dot(eye,gl_EyePlaneS[1]);

gl_TexCoord[1].t=dot(eye,gl_EyePlaneT[1]);

gl_TexCoord[1].p=dot(eye,gl_EyePlaneR[1]);

gl_TexCoord[1].q=dot(eye,gl_EyePlaneQ[1]);

}

Unfortunately the gl_EyePanes are no more available.
I also couldn't find any uniform exports like osg_vertex etc.
Is there any way I can calculate this inside the vertex shader
by using the given uniforms and the eye position?
Or is there anything I can precalculate on CPU and provide it via uniform?

Any help is highly appreciated.

- Werner -


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


[osg-users] What is the difference of adding an additional camera as child or slave

2015-07-24 Thread Werner Modenbach

Dear OSG users,

can someone give me an explanation about the difference in:

view-addSlave(camera.get(),true);

and

view-getCamera()-addChild(camera.get());

Many thanks in advance

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


Re: [osg-users] ClipNode Opposite Behavior

2015-07-23 Thread Werner Modenbach
Are you sure? I think this will leed to nothing being displayed. But I 
didn't verify it. It is just how I understand clipping.


Am 23.07.2015 um 10:35 schrieb Christian Buchner:


I think you only need to flip the clipping plane around (reverse the 
plane's normal vector) to get the desired effect.



2015-07-22 21:28 GMT+02:00 Erik Hensens ehens...@hunter.com 
mailto:ehens...@hunter.com:


Hi everyone!

I have a geode that is just a quad rectangular surface and I need
to be able to put circular holes in it. To better visualize what
I'm talking about, think about a flat slice of Swiss cheese.

I just discovered the ClipNode node and I figured I could achieve
what I want by adding clip nodes that were the roughly circular,
but ClipNode apparently behaves opposite to how I originally
thought (I'm new to this).

Is there a way to make ClipNode remove parts of the scene instead
or keeping only those parts in the clip node region?

Or, is there a better way to achieve this flat slice of Swiss
cheese shape? Thanks very much in advance!

Thank you!

Cheers,
Erik

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





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




___
osg-users mailing list
osg-users@lists.openscenegraph.org
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: i...@texion.eu
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


[osg-users] Getting world coordinates from screen coordinates

2015-07-22 Thread Werner Modenbach

Hi all,

please give me a little assistance.
I'm using geometry shaders for creating my objects during rendering.
That is why I can't use the picking via lineIntersection inside osg.
But I have a local proprietary structure containing my display objects and
I know how to calculate the nearest hit with a ray.
The only thing: I don't know how to convert screen coordinate (x,y,0)
x,y [0,1] to a coordinate in model space.
Doing so and the same with (x,y,1) should give me the 2 points defining 
my ray for further local processing.


Any help appreciated.

Thanks

- Werner -

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


Re: [osg-users] some questions about Frame Scheme ON_DEMAND

2015-07-20 Thread Werner Modenbach

Hi Gianni,

I solved it for me by deriving the viewer class and setting a
local variable needsUpdate with any mod of the sceene.
This works pretty good.

- Werner -


Am 20.07.2015 um 10:51 schrieb Gianni Ambrosio:

Hi All,
can anybody tell me please if there is a way to know if the OSG scene has been 
modified (i.e. node added or removed) so that I can check if 
osgViewer::ViewerBase::frame() must be called in a setRunFrameScheme(ON_DEMAND) 
case?

Regards
Gianni

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





___
osg-users mailing list
osg-users@lists.openscenegraph.org
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: i...@texion.eu
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] How does shadow technic work if geometry shaders are in use

2015-06-08 Thread Werner Modenbach

Sorry, was on a business trip for a while.
Here is my code (shortened a little):

osg::Group*rootNode=newosg::Group();
view-setSceneData(rootNode);

shadowedScene=newosgShadow::ShadowedScene;
shadowedScene-setReceivesShadowTraversalMask(ReceivesShadowTraversalMask);
shadowedScene-setCastsShadowTraversalMask(CastsShadowTraversalMask);
rootNode-addChild(shadowedScene.get());

objectSwitch=newosg::Switch;
shadowedScene-addChild(objectSwitch);


lightSource=newosg::LightSource;
lightSource-setLight(myLight);
lightSource-setReferenceFrame(osg::LightSource::ABSOLUTE_RF);
lightSource-setLocalStateSetModes(osg::StateAttribute::ON);
shadowedScene-addChild(lightSource.get());


osg::StateSet*stateset=objectSwitch-getOrCreateStateSet();

// setting uniforms etc. here

osg::Program*program=newosg::Program();
stateset-setAttribute(program);

program-addShader(Cl_ShaderGen::getShader(osg::Shader::VERTEX,forceGL3Mode, 
...));program-addShader(Cl_ShaderGen::getShader(osg::Shader::GEOMETRY,forceGL3Mode, 
...));program-addShader(Cl_ShaderGen::getShader(osg::Shader::FRAGMENT,forceGL3Mode, 
...));

view-getCamera()-getGraphicsContext()-getState()-setUseModelViewAndProjectionUniforms(forceGL3Mode);
view-getCamera()-getGraphicsContext()-getState()-setUseVertexAttributeAliasing(forceGL3Mode);


If I use GL2 mode everything works like expected.
In GL3 mode without shadow technique everything works fine (using 
geometry shader)
In GL3 mode assigning a shadow technique doesn't change anything i.e. no 
shadow appears.
If I assign the schaders to the state set of shadowedScene in GL3 mode 
without shadow technique
everything appears the normal way but when assigning a shadow technique 
geometry shaders

don't do their work any more.
So my guess is that shadow technique just replaces the shaders.

Is my approach wrong? Do I do something in a non standard way?

Many thanks for hints and help.

- Werner -



Am 29.05.2015 um 18:53 schrieb Trajce Nikolov NICK:
Hard to say without seeing your code  I have modified shaders for 
the LSPSM. Can you share a sample app ?


On Fri, May 29, 2015 at 6:38 PM, Werner Modenbach 
werner.modenb...@texion.eu mailto:werner.modenb...@texion.eu wrote:


Hi Nick,

I'm using LightSpacePerspective  shadow technique as well.
But I set the shaders only inside the scene graph where reqired.
Do I have to set them anywhere else?
My graph looks like that:
*---

   *   |  RootNode   |

   *   ---

   */ \

   * --- 
-

   * |  ShadowScene  | |evtl.  
PPU-Prozessor|

   * --- 
-

   * /  \

   * ---  ---

   * |   Switchnode  |  |  LightSource  
|

   * ---  ---
   *  /   \\\



Am 29.05.2015 um 18:16 schrieb Trajce Nikolov NICK:

Hi Werner,

I am doing the same and using the LightSpacePerspective shadow
techinque. In your program you have to set your vertex and
fragment shaders as well, and it will be picked up correctly if
you set the masks for receiving/cast shadows  So it should
work. As long as they are part of the top ShadowedScene

Nick


Nick

On Fri, May 29, 2015 at 5:56 PM, Werner Modenbach
werner.modenb...@texion.eu mailto:werner.modenb...@texion.eu
wrote:

Hi all,

My scene contains many objects, which are created by geometry
shaders.
So no vertices are created outside the graphics card for
those objects.
So I use
state-setUseVertexAttributeAliasing(true)
and
state-setUseModelViewAndProjectionUniforms(true)

Is it possible using a shadow technique in this case? If I'm
right the shadow technique installs it's own shaders.

Thanks for any hint.

- Werner -

___
osg-users mailing list
osg-users@lists.openscenegraph.org
mailto:osg-users@lists.openscenegraph.org

http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org




-- 
trajce nikolov nick



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


-- 
*TEXION Software Solutions, Rotter Bruch 26a, D-52068 Aachen

  1   2   >