Re: [osg-users] EXTERNAL: Re: EXTERNAL: Re: EXTERNAL: Re: Where is CreateContextAttribs() being used?

2019-04-11 Thread Rowley, Marlin R
Sebastian,

I have written the shaders for GL 3.3 so that’s done.  When RenderDoc runs, I’m 
assuming it’s only checking that window context.  I am NOT assuming that it can 
comb through my code and determine that I’ve used a fixed-function GL call 
somewhere and therefore spits out the message.

In general, I’d like to have a working GPU debugger.  Right now, we are 
struggling to find out values of local variables in the shaders that aren’t 
uniform.  We would also love to be able to pinpoint bottlenecks in the code 
from the GPU side to optimize performance.


Marlin Rowley
Software Engineer, Staff
[cid:image002.jpg@01D39374.DEC5A2E0]
Missiles and Fire Control
972-603-1931 (office)
214-926-0622 (mobile)
marlin.r.row...@lmco.com<mailto:marlin.r.row...@lmco.com>

From: osg-users  On Behalf Of 
Sebastian Messerschmidt
Sent: Thursday, April 11, 2019 9:49 AM
To: 'OpenSceneGraph Users' 
Subject: EXTERNAL: Re: [osg-users] EXTERNAL: Re: EXTERNAL: Re: Where is 
CreateContextAttribs() being used?

Merlin,

As Chris already mentioned the complete application needs to run on 
core-profile. That means there is no fixed function pipeline and no 
backward-compatibility features.
In order to get your application running in core-profile you need to write 
shaders for everything and IIRC compile OSG with GL3 enabled. I haven’t used 
OSG in a while now, but I think there is mechanism to decorate the scene graph 
with shaders automatically.

I started to refactor my project some years ago to fully support core-only 
scenarios, but I gave up due to a lot features no longer working out-of-the-box.
Can you maybe try to explain what you’re trying to debug? There might be some 
more options for you.


Cheers
Sebastian

From: osg-users 
mailto:osg-users-boun...@lists.openscenegraph.org>>
 On Behalf Of Rowley, Marlin R
Sent: Donnerstag, 11. April 2019 16:24
To: OpenSceneGraph Users 
mailto:osg-users@lists.openscenegraph.org>>
Subject: Re: [osg-users] EXTERNAL: Re: EXTERNAL: Re: Where is 
CreateContextAttribs() being used?

Sebastian,

What does “core OpenGL profile” mean with regards to the graphics context?  I’m 
still not getting it to work.

Here is my code structure:

…
osg::ref_ptr traits = new 
osg::GraphicsContext::Traits;
traits->x = aXPosition;
traits->y = aYPosition;
traits->width  = aWidth;
traits->height = aHeight;
traits->stencil = 8;
traits->doubleBuffer = true;
traits->windowDecoration = false;
#if defined(WIN32)
traits->inheritedWindowData = new 
osgViewer::GraphicsWindowWin32::WindowData( aWindow );
#elif defined(__linux__)
   traits->inheritedWindowData = new 
osgViewer::GraphicsWindowX11::WindowData( aWindow );
#endif
// gl graphics context version and profile mask
traits->glContextVersion = "3.3";
traits->glContextProfileMask = 0x1;

// create the graphics window from the context
osgViewer::GraphicsWindow* gw = 
dynamic_cast(osg::GraphicsContext::createGraphicsContext(traits.get()));

…

// set the main camera to use the window
mainCamera->setGraphicsContext( gw );

…

I assume here that setting the traits variable with the major/minor version of 
OpenGL and setting the profile mask to 1 (‘core’??) would be all I need.  But 
that’s obviously not the case.

-M


Marlin Rowley
Software Engineer, Staff
[cid:image002.jpg@01D39374.DEC5A2E0]
Missiles and Fire Control
972-603-1931 (office)
214-926-0622 (mobile)
marlin.r.row...@lmco.com<mailto:marlin.r.row...@lmco.com>

From: osg-users 
mailto:osg-users-boun...@lists.openscenegraph.org>>
 On Behalf Of 
sebastian.messerschm...@gmx.de<mailto:sebastian.messerschm...@gmx.de>
Sent: Thursday, April 11, 2019 9:01 AM
To: 'OpenSceneGraph Users' 
mailto:osg-users@lists.openscenegraph.org>>
Subject: EXTERNAL: Re: [osg-users] EXTERNAL: Re: Where is 
CreateContextAttribs() being used?

Hi Marlin,

In order for RenderDoc (and most tools I’m aware of) you’re application needs 
to run on core OpenGL profile.
You might want to look here for some debugging options: 
https://www.khronos.org/opengl/wiki/Debugging_Tools
I personally used Nvidia Nsight for quite a while, as it at least helps with 
framebuffer debugging etc.

Cheers
Sebastian


From: osg-users 
mailto:osg-users-boun...@lists.openscenegraph.org>>
 On Behalf Of Rowley, Marlin R
Sent: Donnerstag, 11. April 2019 14:52
To: OpenSceneGraph Users 
mailto:osg-users@lists.openscenegraph.org>>
Subject: Re: [osg-users] EXTERNAL: Re: Where is CreateContextAttribs() being 
used?

We are using Win10-x64.

We are trying to get RenderDoc to be able to see our application so we can do 
some graphics debugging.  It’s shouting back that the current device context 
wasn’t created using CreateContextAttrib, so 

Re: [osg-users] EXTERNAL: Re: EXTERNAL: Re: Where is CreateContextAttribs() being used?

2019-04-11 Thread Rowley, Marlin R
Sebastian,

What does “core OpenGL profile” mean with regards to the graphics context?  I’m 
still not getting it to work.

Here is my code structure:

…
osg::ref_ptr traits = new 
osg::GraphicsContext::Traits;
traits->x = aXPosition;
traits->y = aYPosition;
traits->width  = aWidth;
traits->height = aHeight;
traits->stencil = 8;
traits->doubleBuffer = true;
traits->windowDecoration = false;
#if defined(WIN32)
traits->inheritedWindowData = new 
osgViewer::GraphicsWindowWin32::WindowData( aWindow );
#elif defined(__linux__)
   traits->inheritedWindowData = new 
osgViewer::GraphicsWindowX11::WindowData( aWindow );
#endif
// gl graphics context version and profile mask
traits->glContextVersion = "3.3";
traits->glContextProfileMask = 0x1;

// create the graphics window from the context
osgViewer::GraphicsWindow* gw = 
dynamic_cast(osg::GraphicsContext::createGraphicsContext(traits.get()));

…

// set the main camera to use the window
mainCamera->setGraphicsContext( gw );

…

I assume here that setting the traits variable with the major/minor version of 
OpenGL and setting the profile mask to 1 (‘core’??) would be all I need.  But 
that’s obviously not the case.

-M


Marlin Rowley
Software Engineer, Staff
[cid:image002.jpg@01D39374.DEC5A2E0]
Missiles and Fire Control
972-603-1931 (office)
214-926-0622 (mobile)
marlin.r.row...@lmco.com<mailto:marlin.r.row...@lmco.com>

From: osg-users  On Behalf Of 
sebastian.messerschm...@gmx.de
Sent: Thursday, April 11, 2019 9:01 AM
To: 'OpenSceneGraph Users' 
Subject: EXTERNAL: Re: [osg-users] EXTERNAL: Re: Where is 
CreateContextAttribs() being used?

Hi Marlin,

In order for RenderDoc (and most tools I’m aware of) you’re application needs 
to run on core OpenGL profile.
You might want to look here for some debugging options: 
https://www.khronos.org/opengl/wiki/Debugging_Tools
I personally used Nvidia Nsight for quite a while, as it at least helps with 
framebuffer debugging etc.

Cheers
Sebastian


From: osg-users 
mailto:osg-users-boun...@lists.openscenegraph.org>>
 On Behalf Of Rowley, Marlin R
Sent: Donnerstag, 11. April 2019 14:52
To: OpenSceneGraph Users 
mailto:osg-users@lists.openscenegraph.org>>
Subject: Re: [osg-users] EXTERNAL: Re: Where is CreateContextAttribs() being 
used?

We are using Win10-x64.

We are trying to get RenderDoc to be able to see our application so we can do 
some graphics debugging.  It’s shouting back that the current device context 
wasn’t created using CreateContextAttrib, so I started looking. So since we are 
using Win64, doesn’t look like osg will go the WindowWin32 route. Hmm…

How are you debugging the GPU?  It’s incredibly difficult trying to solve 
realtime pipeline problems without the use of a graphics debugger.


Marlin Rowley
Software Engineer, Staff
[cid:image002.jpg@01D39374.DEC5A2E0]
Missiles and Fire Control
972-603-1931 (office)
214-926-0622 (mobile)
marlin.r.row...@lmco.com<mailto:marlin.r.row...@lmco.com>

From: osg-users 
mailto:osg-users-boun...@lists.openscenegraph.org>>
 On Behalf Of Robert Osfield
Sent: Thursday, April 11, 2019 7:16 AM
To: OpenSceneGraph Users 
mailto:osg-users@lists.openscenegraph.org>>
Subject: EXTERNAL: Re: [osg-users] Where is CreateContextAttribs() being used?

Hi Marlin,

A great for CreateContextttribs in the OSG shows:

$ grep -r CreateContextAttribs .
Binary file ./lib/libosgViewer.so.3.6.4 matches
Binary file ./src/osgViewer/CMakeFiles/osgViewer.dir/GraphicsWindowX11.cpp.o 
matches
./src/osgViewer/GraphicsWindowX11.cpp:typedef GLXContext 
(*glXCreateContextAttribsARBProc)(Display*, GLXFBConfig, GLXContext, Bool, 
const int*);
./src/osgViewer/GraphicsWindowX11.cpp:glXCreateContextAttribsARBProc 
glXCreateContextAttribsARB = 0;
./src/osgViewer/GraphicsWindowX11.cpp:glXCreateContextAttribsARB = 
(glXCreateContextAttribsARBProc) glXGetProcAddress((const 
GLubyte*)"glXCreateContextAttribsARB");
./src/osgViewer/GraphicsWindowX11.cpp:if (glXCreateContextAttribsARB)
./src/osgViewer/GraphicsWindowX11.cpp:_context = 
glXCreateContextAttribsARB( _display, _fbConfig, sharedContext, True, 
contextAttributes.data() );
./src/osgViewer/GraphicsWindowWin32.cpp:extern HGLRC WINAPI 
wglCreateContextAttribsARB (HDC, HGLRC, const int *);
./src/osgViewer/GraphicsWindowWin32.cpp:
PFNWGLCREATECONTEXTATTRIBSARBPROC wglCreateContextAttribsARB =
./src/osgViewer/GraphicsWindowWin32.cpp:( 
PFNWGLCREATECONTEXTATTRIBSARBPROC ) wglGetProcAddress( 
"wglCreateContextAttribsARB" );
./src/osgViewer/GraphicsWindowWin32.cpp:if( 
wglCreateContextAttribsARB==0 )
./src/osgViewer/GraphicsWindowWin32.cpp:  

Re: [osg-users] EXTERNAL: Re: Where is CreateContextAttribs() being used?

2019-04-11 Thread Rowley, Marlin R
We are using Win10-x64.

We are trying to get RenderDoc to be able to see our application so we can do 
some graphics debugging.  It’s shouting back that the current device context 
wasn’t created using CreateContextAttrib, so I started looking. So since we are 
using Win64, doesn’t look like osg will go the WindowWin32 route. Hmm…

How are you debugging the GPU?  It’s incredibly difficult trying to solve 
realtime pipeline problems without the use of a graphics debugger.


Marlin Rowley
Software Engineer, Staff
[cid:image002.jpg@01D39374.DEC5A2E0]
Missiles and Fire Control
972-603-1931 (office)
214-926-0622 (mobile)
marlin.r.row...@lmco.com<mailto:marlin.r.row...@lmco.com>

From: osg-users  On Behalf Of 
Robert Osfield
Sent: Thursday, April 11, 2019 7:16 AM
To: OpenSceneGraph Users 
Subject: EXTERNAL: Re: [osg-users] Where is CreateContextAttribs() being used?

Hi Marlin,

A great for CreateContextttribs in the OSG shows:

$ grep -r CreateContextAttribs .
Binary file ./lib/libosgViewer.so.3.6.4 matches
Binary file ./src/osgViewer/CMakeFiles/osgViewer.dir/GraphicsWindowX11.cpp.o 
matches
./src/osgViewer/GraphicsWindowX11.cpp:typedef GLXContext 
(*glXCreateContextAttribsARBProc)(Display*, GLXFBConfig, GLXContext, Bool, 
const int*);
./src/osgViewer/GraphicsWindowX11.cpp:glXCreateContextAttribsARBProc 
glXCreateContextAttribsARB = 0;
./src/osgViewer/GraphicsWindowX11.cpp:glXCreateContextAttribsARB = 
(glXCreateContextAttribsARBProc) glXGetProcAddress((const 
GLubyte*)"glXCreateContextAttribsARB");
./src/osgViewer/GraphicsWindowX11.cpp:if (glXCreateContextAttribsARB)
./src/osgViewer/GraphicsWindowX11.cpp:_context = 
glXCreateContextAttribsARB( _display, _fbConfig, sharedContext, True, 
contextAttributes.data() );
./src/osgViewer/GraphicsWindowWin32.cpp:extern HGLRC WINAPI 
wglCreateContextAttribsARB (HDC, HGLRC, const int *);
./src/osgViewer/GraphicsWindowWin32.cpp:
PFNWGLCREATECONTEXTATTRIBSARBPROC wglCreateContextAttribsARB =
./src/osgViewer/GraphicsWindowWin32.cpp:( 
PFNWGLCREATECONTEXTATTRIBSARBPROC ) wglGetProcAddress( 
"wglCreateContextAttribsARB" );
./src/osgViewer/GraphicsWindowWin32.cpp:if( 
wglCreateContextAttribsARB==0 )
./src/osgViewer/GraphicsWindowWin32.cpp:reportErrorForScreen( 
"GL3: wglCreateContextAttribsARB not available.",
./src/osgViewer/GraphicsWindowWin32.cpp:context = 
wglCreateContextAttribsARB( _hdc, 0, attribs );
./src/osgViewer/GraphicsWindowWin32.cpp:
reportErrorForScreen( "GL3: wglCreateContextAttribsARB returned NULL.",

So only X11 and Win32.  What platform are you using?

Robert.



On Thu, 11 Apr 2019 at 00:32, Rowley, Marlin R 
mailto:marlin.r.row...@lmco.com>> wrote:
We are trying to run the graphics debugger called ‘RenderDoc’.  It’s spitting 
out an error message after we create a window and it’s device context.  I’ve 
been looking through the osg code to find a function called 
CreateContextAttribs().  I can’t seem to locate it. My idea is to override 
where it’s used or refactor something into the code where we can call the 
function ourselves.

In the meantime, I’m setting the traits->glContextVersion = “3.3” in our 
graphics application but RenderDoc is still shouting “Context not created via 
CreateContextAttribs.  Capturing disabled.”

-M


Marlin Rowley
Software Engineer, Staff
[cid:image002.jpg@01D39374.DEC5A2E0]
Missiles and Fire Control
972-603-1931 (office)
214-926-0622 (mobile)
marlin.r.row...@lmco.com<mailto:marlin.r.row...@lmco.com>

___
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


[osg-users] Where is CreateContextAttribs() being used?

2019-04-10 Thread Rowley, Marlin R
We are trying to run the graphics debugger called 'RenderDoc'.  It's spitting 
out an error message after we create a window and it's device context.  I've 
been looking through the osg code to find a function called 
CreateContextAttribs().  I can't seem to locate it. My idea is to override 
where it's used or refactor something into the code where we can call the 
function ourselves.

In the meantime, I'm setting the traits->glContextVersion = "3.3" in our 
graphics application but RenderDoc is still shouting "Context not created via 
CreateContextAttribs.  Capturing disabled."

-M


Marlin Rowley
Software Engineer, Staff
[cid:image002.jpg@01D39374.DEC5A2E0]
Missiles and Fire Control
972-603-1931 (office)
214-926-0622 (mobile)
marlin.r.row...@lmco.com

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


Re: [osg-users] EXTERNAL: Re: EXTERNAL: Re: Nvidia RTX

2019-02-21 Thread Rowley, Marlin R
Shoot me an email anytime.


Marlin Rowley
Software Engineer, Staff
[cid:image002.jpg@01D39374.DEC5A2E0]
Missiles and Fire Control
972-603-1931 (office)
214-926-0622 (mobile)
marlin.r.row...@lmco.com<mailto:marlin.r.row...@lmco.com>

From: osg-users  On Behalf Of Chris 
Hanson
Sent: Thursday, February 21, 2019 6:34 AM
To: OpenSceneGraph Users 
Subject: EXTERNAL: Re: [osg-users] EXTERNAL: Re: Nvidia RTX

On Wed, Feb 20, 2019 at 10:55 PM Rowley, Marlin R 
mailto:marlin.r.row...@lmco.com>> wrote:
I, personally, wouldn't be in such a rush to implement RTX support.  The 
graphics card can only handle 1 ray-tracing feature at acceptable framerates.  
We are using OSG for terrain generation and I see rendering triangles fast 
enough along with managing high res textures as still being a #1 priority for 
us.  Graphics hardware just isn't fast enough to render relatively dense meshes 
even with the best cards.  I sincerely hope that RTX doesn't cause a fork in 
the road and reduce the need to improve the overall bandwidth of the graphics 
pipeline.

I actually, agree.

For general purpose stuff, I think normal rasterization is more practical, but 
in your industry I should think you can also imagine simulation situations 
where direct computation of ray transport of radiative energy among surfaces of 
different reflective properties is interesting.


I'd love to chat with you sometime about how you're using OSG, Marlin.

--
Chris 'Xenon' Hanson, omo sanza lettere. 
xe...@alphapixel.com<mailto:xe...@alphapixel.com> http://www.alphapixel.com/
Training • Consulting • Contracting
3D • Scene Graphs (Open Scene Graph/OSG) • OpenGL 2 • OpenGL 3 • OpenGL 4 • 
GLSL • OpenGL ES 1 • OpenGL ES 2 • OpenCL
Legal/IP • Forensics • Imaging • UAVs • GIS • GPS • osgEarth • Terrain • 
Telemetry • Cryptography • LIDAR • Embedded • Mobile • iPhone/iPad/iOS • Android
@alphapixel<https://twitter.com/alphapixel> 
facebook.com/alphapixel<http://facebook.com/alphapixel> (775) 623-PIXL [7495]
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] EXTERNAL: Re: Nvidia RTX

2019-02-20 Thread Rowley, Marlin R
I, personally, wouldn't be in such a rush to implement RTX support.  The 
graphics card can only handle 1 ray-tracing feature at acceptable framerates.  
We are using OSG for terrain generation and I see rendering triangles fast 
enough along with managing high res textures as still being a #1 priority for 
us.  Graphics hardware just isn't fast enough to render relatively dense meshes 
even with the best cards.  I sincerely hope that RTX doesn't cause a fork in 
the road and reduce the need to improve the overall bandwidth of the graphics 
pipeline.

My 2 cents..


Marlin Rowley
Software Engineer, Staff

Missiles and Fire Control
972-603-1931 (office)
214-926-0622 (mobile)
marlin.r.row...@lmco.com

-Original Message-
From: osg-users  On Behalf Of Terry 
Welsh
Sent: Tuesday, February 19, 2019 5:47 PM
To: osg-users@lists.openscenegraph.org
Subject: EXTERNAL: Re: [osg-users] Nvidia RTX

My research tells me that a) hybrid rendering like RTX is the way to go for the 
next few years if you want real-time performance, and b) Vulkan will have 
ray-tracing extensions but OpenGL will have none.

So once I get time I'd like to dig into VSG or some game engine with Vulkan 
support. I don't know of any other options besides rolling your own, and I'm 
not so anxious to do that with Vulkan. Would love to hear other opinions on 
this.
- Terry

> On Tue, 19 Feb 2019 at 17:17, Chris Hanson  wrote:
> > Any of my OSG homies do anything with Nvidia RTX yet? I did a simple search 
> > and didn't see any overlap between OSG and RTX.
>
> RTX feature support is on my ROADMAP.md for the VSG ;-)
>
> It will likely take till early summer before we've completed enough 
> other VSG features before we can progress on to the RTX features.
>
> Add RTX features to the OSG should be possible, though I don't have 
> any plans to do this myself as my work on the VSG is close to full 
> time till 1.0 goes out.
>
> 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] EXTERNAL: Re: Nvidia RTX

2019-02-19 Thread Rowley, Marlin R
Isn't RTX DirectX only?  


Marlin Rowley
Software Engineer, Staff

Missiles and Fire Control
972-603-1931 (office)
214-926-0622 (mobile)
marlin.r.row...@lmco.com

-Original Message-
From: osg-users  On Behalf Of 
Robert Osfield
Sent: Tuesday, February 19, 2019 2:52 PM
To: OpenSceneGraph Users 
Subject: EXTERNAL: Re: [osg-users] Nvidia RTX

On Tue, 19 Feb 2019 at 17:17, Chris Hanson  wrote:
> Any of my OSG homies do anything with Nvidia RTX yet? I did a simple search 
> and didn't see any overlap between OSG and RTX.

RTX feature support is on my ROADMAP.md for the VSG ;-)

It will likely take till early summer before we've completed enough other VSG 
features before we can progress on to the RTX features.

Add RTX features to the OSG should be possible, though I don't have any plans 
to do this myself as my work on the VSG is close to full time till 1.0 goes out.

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] EXTERNAL: Re: Value of a variable in shaders?

2018-09-28 Thread Rowley, Marlin R
Robert,

LOL @ mis-reading my question. 

How would you check the values of vertices?  I just need to see the transformed 
values of a vertex.

Thanks,

-M


Marlin Rowley
Software Engineer, Staff

Missiles and Fire Control
972-603-1931 (office)
214-926-0622 (mobile)
marlin.r.row...@lmco.com

-Original Message-
From: osg-users  On Behalf Of 
Robert Osfield
Sent: Friday, September 28, 2018 3:41 AM
To: OpenSceneGraph Users 
Subject: EXTERNAL: Re: [osg-users] Value of a variable in shaders?

Hi Marlin,

On Fri, 28 Sep 2018 at 07:40, Robert Osfield  wrote:
> 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.

Seems I mis-read your question :-)

Testing internal values in shader is an easy thing to do, what I end up doing 
is build up shaders bit by bit making sure each bit works on it's own before I 
assemble it into a more complex shader.  When I want to test values I usually 
just set the fragment colour value, though often this will have a processed 
version of the value to make it visible.  You can use #ifdef's in shaders to 
toggle the debug code paths and even toggle these paths on/off via the 
osg::StateSet::setDefine("ENABLE_DEBUG");

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] EXTERNAL: Re: Value of a variable in shaders?

2018-09-28 Thread Rowley, Marlin R
Thanks, I'll look into that.


Marlin Rowley
Software Engineer, Staff

Missiles and Fire Control
972-603-1931 (office)
214-926-0622 (mobile)
marlin.r.row...@lmco.com

-Original Message-
From: Sebastian Messerschmidt  
Sent: Friday, September 28, 2018 2:00 AM
To: OpenSceneGraph Users ; Rowley, Marlin R 
(US) 
Subject: EXTERNAL: Re: [osg-users] Value of a variable in shaders?

Hi,

Usually you can use the output-colors in case of a fragment shader to inspect 
the values per fragment. Rendering to a texture and inspecting the values in 
the image is also an option.

Another approach to display incoming/per state values is this nifty shader:

http://mew.cx/drawtext/drawtext.html

Appart from this, in case you're using a modern Nvidia-GPU and
Visual-Studio:

https://developer.nvidia.com/nsight-visual-studio-edition

Cheers
Sebastian



Am 27.09.2018 um 20:14 schrieb Rowley, Marlin R:
> All,
> 
> Is there a way to examine variable values in shader code? I cant 
> figure out this problem that we are having unless I can see the values 
> in the shaders.
> 
> Any help would be appreciated
> 
> 
> 
> Marlin Rowley
> 
> Software Engineer, Staff
> 
> cid:image002.jpg@01D39374.DEC5A2E0
> 
> /Missiles and Fire Control/
> 
> 972-603-1931 (office)
> 
> 214-926-0622 (mobile)
> 
> marlin.r.row...@lmco.com <mailto:marlin.r.row...@lmco.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] EXTERNAL: Re: Value of a variable in shaders?

2018-09-28 Thread Rowley, Marlin R
Robert,

I’ve written the shaders already and am well-versed in writing them.  I just 
need a debugging tool that will allow me to see their values at runtime.


Marlin Rowley
Software Engineer, Staff
[cid:image002.jpg@01D39374.DEC5A2E0]
Missiles and Fire Control
972-603-1931 (office)
214-926-0622 (mobile)
marlin.r.row...@lmco.com<mailto:marlin.r.row...@lmco.com>

From: osg-users  On Behalf Of 
Robert Osfield
Sent: Friday, September 28, 2018 1:40 AM
To: OpenSceneGraph Users 
Subject: EXTERNAL: Re: [osg-users] Value of a variable in shaders?

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


Re: [osg-users] EXTERNAL: Re: Read Image from RTT

2018-09-27 Thread Rowley, Marlin R
Did you allocate storage for your osg::Image* before using it (i.e. osg::Image* 
img = new osg::Image)?  That doesn't make sense why it would only work on a 
osg::ref_ptr. 


Marlin Rowley
Software Engineer, Staff

Missiles and Fire Control
972-603-1931 (office)
214-926-0622 (mobile)
marlin.r.row...@lmco.com

-Original Message-
From: osg-users  On Behalf Of 
Rômulo Cerqueira
Sent: Thursday, September 27, 2018 3:34 PM
To: osg-users@lists.openscenegraph.org
Subject: EXTERNAL: Re: [osg-users] Read Image from RTT

Solved the problem!

Perhaps readImageFromCurentTexture() works only with osg::ref_ptr 
instead of osg::Image*.
... 

Thank you!

Cheers,
Rômulo

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





___
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] EXTERNAL: Re: Read Image from RTT

2018-09-27 Thread Rowley, Marlin R
I just noticed that.  You'll have to check and see what line it's crashing on 
in the debugger.  I just noticed that you get a graphics context but never 
check to see if it's NULL.  A NULL pointer can't access any methods of the 
class it's referring to.

Good Luck!


Marlin Rowley
Software Engineer, Staff

Missiles and Fire Control
972-603-1931 (office)
214-926-0622 (mobile)
marlin.r.row...@lmco.com

-Original Message-
From: osg-users  On Behalf Of 
Rômulo Cerqueira
Sent: Thursday, September 27, 2018 2:37 PM
To: osg-users@lists.openscenegraph.org
Subject: EXTERNAL: Re: [osg-users] Read Image from RTT

Hi Martin,

I never faced with this problem. Do you have some tip to solve it?
... 

Thank you!

Cheers,
Rômulo

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





___
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] EXTERNAL: Read Image from RTT

2018-09-27 Thread Rowley, Marlin R
What if your gfxc returns NULL?  You assume that gfxc->getTraits() should 
always have a valid reference pointer.


Marlin Rowley
Software Engineer, Staff

Missiles and Fire Control
972-603-1931 (office)
214-926-0622 (mobile)
marlin.r.row...@lmco.com

-Original Message-
From: osg-users  On Behalf Of 
Rômulo Cerqueira
Sent: Thursday, September 27, 2018 2:07 PM
To: osg-users@lists.openscenegraph.org
Subject: EXTERNAL: [osg-users] Read Image from RTT

Hi,

I have tried to read image from RTT (where the image is "not attached", but 
available on buffer) using a osg::Camera::DrawCallback, the compilation is 
working, however the executable brings me a segmentation fault during image 
rendering. How can I solve this?



Code:
WindowCaptureScreen::WindowCaptureScreen(osg::ref_ptr 
gfxc, osg::Texture2D* tex) {
_mutex = new OpenThreads::Mutex();
_condition = new OpenThreads::Condition();
_image = new osg::Image();

// checks the GraficContext from the camera viewer
if (gfxc->getTraits()) {
_tex = tex;
int width = gfxc->getTraits()->width;
int height = gfxc->getTraits()->height;
_image->allocateImage(width, height, 1, GL_RGBA, GL_FLOAT);
}
}

WindowCaptureScreen::~WindowCaptureScreen() {
delete (_condition);
delete (_mutex);
}

osg::ref_ptr WindowCaptureScreen::captureImage() {
//wait to finish the capture image in call back
_condition->wait(_mutex);

return _image;
}

void WindowCaptureScreen::operator ()(osg::RenderInfo& renderInfo) const {
osg::ref_ptr gfxc = 
renderInfo.getState()->getGraphicsContext();

if (gfxc->getTraits()) {
_mutex->lock();

// read the color buffer as 32-bit floating point
renderInfo.getState()->applyTextureAttribute(0, _tex);

// THE PROGRAM CRASHES HERE
_image->readImageFromCurrentTexture(renderInfo.getContextID(), true, 
GL_FLOAT);

// grants the access to image
_condition->signal();
_mutex->unlock();
}
}




Output from GDB:


Code:
#0  0xff88 in ?? ()
#1  0x7fffef1ee39d in normal_depth_map::WindowCaptureScreen::operator() 
(this=0x7fffb53ee7a0, renderInfo=...)
at 
/home/romulo/dev/sonarsim/simulation/normal_depth_map/src/ImageViewerCaptureTool.cpp:158
#2  0x7fffebb43b10 in osgUtil::RenderStage::draw(osg::RenderInfo&, 
osgUtil::RenderLeaf*&) ()
   from target:/usr/lib/x86_64-linux-gnu/libosgUtil.so.100
#3  0x7fffebb4bdb7 in osgUtil::SceneView::draw() () from 
target:/usr/lib/x86_64-linux-gnu/libosgUtil.so.100
#4  0x7fffec31c03f in osgViewer::Renderer::draw() () from 
target:/usr/lib/x86_64-linux-gnu/libosgViewer.so.100
#5  0x7fffef557d49 in osg::GraphicsContext::runOperations() ()
   from target:/usr/lib/x86_64-linux-gnu/libosg.so.100
#6  0x7fffef5a7bbf in osg::OperationThread::run() () from 
target:/usr/lib/x86_64-linux-gnu/libosg.so.100
#7  0x7fffef5596f8 in osg::GraphicsThread::run() () from 
target:/usr/lib/x86_64-linux-gnu/libosg.so.100
#8  0x7fffecbd06c8 in OpenThreads::ThreadPrivateActions::StartThread(void*) 
()
   from target:/usr/lib/x86_64-linux-gnu/libOpenThreads.so.20
#9  0x760246ba in start_thread (arg=0x7fffa7efe700) at 
pthread_create.c:333
#10 0x7130f41d in clone () at 
../sysdeps/unix/sysv/linux/x86_64/clone.S:109




Thanks in advance,

Cheers,
Rômulo

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





___
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] Value of a variable in shaders?

2018-09-27 Thread Rowley, Marlin R
All,

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.

Any help would be appreciated


Marlin Rowley
Software Engineer, Staff
[cid:image002.jpg@01D39374.DEC5A2E0]
Missiles and Fire Control
972-603-1931 (office)
214-926-0622 (mobile)
marlin.r.row...@lmco.com

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


Re: [osg-users] EXTERNAL: Re: LookAt() function parameter meanings..

2018-08-13 Thread Rowley, Marlin R
Ravi,

During the projection matrix phase, OpenGL switches to left-handed system (i.e. 
Z-axis points positive going into the screen).  But I missed the rotation, so 
it stays left-handed with +x (right), -y (look), and +z(up).

Thanks for the interpretation of the parameter names.  I interpreted “center” 
to mean a position point – not a vector.  And “eye” to mean the direction the 
eye is pointed to.


Marlin Rowley
Software Engineer, Staff
[cid:image002.jpg@01D39374.DEC5A2E0]
Missiles and Fire Control
972-603-1931 (office)
214-926-0622 (mobile)
marlin.r.row...@lmco.com<mailto:marlin.r.row...@lmco.com>

From: osg-users  On Behalf Of Ravi 
Mathur
Sent: Monday, August 13, 2018 9:32 AM
To: OpenSceneGraph Users 
Subject: EXTERNAL: Re: [osg-users] LookAt() function parameter meanings..

Hey Martin,

You are not interpreting the parameters properly. Look at the header for 
Matrixd.cpp:

  /** Set the position and orientation to be a view matrix,
* using the same convention as gluLookAt.
  */
  void makeLookAt(const Vec3d& eye,const Vec3d& center,const Vec3d& up);

It follows the same convention and algorithm as gluLookAt(), so you can look at 
the many online reference pages for that 
(microsoft<https://docs.microsoft.com/en-us/windows/desktop/opengl/glulookat>, 
khronos<https://www.khronos.org/registry/OpenGL-Refpages/gl2.1/xhtml/gluLookAt.xml>).
 There is no question about its correctness or compatibility with OpenGL, since 
OSG has been used with OpenGL in hundreds of projects for like 20 years. :D

To very directly answer your question, "eye" is the eye position (or camera if 
you prefer), "center" is a point towards which the eye is looking, and 
therefore the look vector points from eye towards center. This look vector is 
the negative z-axis of OpenGL. The "up" vector specifies the direction of the 
positive y-axis. The x-axis is then defined as y-cross-z, which is the default 
OpenGL right-handed system. HOWEVER, OSG takes it a step further and maps the 
y-axis to the look vector (into the screen). With this simple rotation, x 
points right and z points up, which remains right-handed. I'm guessing this is 
done because many OSG applications represent physical (real-world) systems, in 
which the z-axis often does point up. (Robert or someone else can correct me if 
that's not the reason)

Ravi

On Mon, Aug 13, 2018 at 10:07 AM Rowley, Marlin R 
mailto:marlin.r.row...@lmco.com>> wrote:
All,

I’m very confused by the parameters passed into this function.  I am going over 
some of the legacy code and saw this line of code:

osg::Matrixd frustumView;
frustumView.makeLookAt(VIEW_POS, mDirection, mUp);

saw the docs, it’s described like this:

void makeLookAt(const Vec3d& eye,const Vec3d& center,const Vec3d& up);

So in this context, I would think that “eye” represents the look vector.  
However, it seems to work like a position vector.  The “center” parameter 
expects a direction vector (0, -1, 0) where the look vector is along the -yaxis.

This matrix will not translate to OpenGL properly since it’s coordinate system 
is based off of a right handed coordinate frame.

Questions:


  1.  Am I interpreting these parameters properly?
  2.  How would I convert this system to the OpenGL right-handed system?


Marlin Rowley
Software Engineer, Staff
Missiles and Fire Control
972-603-1931 (office)
214-926-0622 (mobile)
marlin.r.row...@lmco.com<mailto:marlin.r.row...@lmco.com>

___
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


[osg-users] LookAt() function parameter meanings..

2018-08-13 Thread Rowley, Marlin R
All,

I'm very confused by the parameters passed into this function.  I am going over 
some of the legacy code and saw this line of code:

osg::Matrixd frustumView;
frustumView.makeLookAt(VIEW_POS, mDirection, mUp);

saw the docs, it's described like this:

void makeLookAt(const Vec3d& eye,const Vec3d& center,const Vec3d& up);

So in this context, I would think that "eye" represents the look vector.  
However, it seems to work like a position vector.  The "center" parameter 
expects a direction vector (0, -1, 0) where the look vector is along the -yaxis.

This matrix will not translate to OpenGL properly since it's coordinate system 
is based off of a right handed coordinate frame.

Questions:


  1.  Am I interpreting these parameters properly?
  2.  How would I convert this system to the OpenGL right-handed system?


Marlin Rowley
Software Engineer, Staff
[cid:image002.jpg@01D39374.DEC5A2E0]
Missiles and Fire Control
972-603-1931 (office)
214-926-0622 (mobile)
marlin.r.row...@lmco.com

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


Re: [osg-users] EXTERNAL: Re: World space normal.

2018-07-11 Thread Rowley, Marlin R
Robert,

Are you suggesting that I compute the world space normal in the application and 
pass it to the shader?  I absolutely need world space coordinates. If so, how 
would I get the normal of the triangle before evaluating the shader?


Marlin Rowley
Software Engineer, Staff
[cid:image002.jpg@01D39374.DEC5A2E0]
Missiles and Fire Control
972-603-1931 (office)
214-926-0622 (mobile)
marlin.r.row...@lmco.com<mailto:marlin.r.row...@lmco.com>

From: osg-users  On Behalf Of 
Robert Osfield
Sent: Wednesday, July 11, 2018 11:26 AM
To: OpenSceneGraph Users 
Subject: EXTERNAL: Re: [osg-users] World space normal.

Hi Marlin,

It can be done, but I strongly recommend that you don't go transforming vertex 
or normal data into world coordinates in the shader.  I know there are some 
published algorithms that do this but it's a really bad practice and you 
shouldn't follow it as precision issues on only proper dataset will cause 
mayhem - the do the cals in world coordinates only for datasets with a local 
origin, it's just a mess for any real-word datasets.

Cheers,
Robert.




On Wed, 11 Jul 2018 at 14:17, Rowley, Marlin R 
mailto:marlin.r.row...@lmco.com>> wrote:
I have a world space vertex computed as follows:

WorldVertex = osg_ViewMatrixInverse * gl_ModelViewMatrix * aVertex;

I would like to get the world space normal from this vertex.  Is there an 
equivalent osg_* matrix that does the same thing?

I tried this:

NormalWorld = gl_NormalMatrix * gl_Normal;

But I know that is only putting the normal in view space.


Marlin Rowley
Software Engineer, Staff
[cid:image002.jpg@01D39374.DEC5A2E0]
Missiles and Fire Control
972-603-1931 (office)
214-926-0622 (mobile)
marlin.r.row...@lmco.com<mailto:marlin.r.row...@lmco.com>

___
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


[osg-users] World space normal.

2018-07-11 Thread Rowley, Marlin R
I have a world space vertex computed as follows:

WorldVertex = osg_ViewMatrixInverse * gl_ModelViewMatrix * aVertex;

I would like to get the world space normal from this vertex.  Is there an 
equivalent osg_* matrix that does the same thing?

I tried this:

NormalWorld = gl_NormalMatrix * gl_Normal;

But I know that is only putting the normal in view space.


Marlin Rowley
Software Engineer, Staff
[cid:image002.jpg@01D39374.DEC5A2E0]
Missiles and Fire Control
972-603-1931 (office)
214-926-0622 (mobile)
marlin.r.row...@lmco.com

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


Re: [osg-users] EXTERNAL: Announcement: VulkanSceneGraph and SceneGraphTestBed!

2018-06-04 Thread Rowley, Marlin R
This will be awesome! I can't wait!


Marlin Rowley
Software Engineer, Staff

Missiles and Fire Control
972-603-1931 (office)
214-926-0622 (mobile)
marlin.r.row...@lmco.com

-Original Message-
From: osg-users  On Behalf Of 
Robert Osfield
Sent: Friday, June 1, 2018 12:23 PM
To: OpenSceneGraph Users 
Subject: EXTERNAL: [osg-users] Announcement: VulkanSceneGraph and 
SceneGraphTestBed!

Hi All,

I am delighted to say that today I began work on VulkanSceneGraph, an all new 
scene graph that builds upon Vulkan and modern C++.  This new project can be 
thought of a new family member, the child of OpenSceneGraph project.  As it's a 
family member I've created the project repository alongside the OpenSceneGraph 
within the github openscenegraph account:

   https://github.com/openscenegraph/VulkanSceneGraph

Please have a read through the README.md on the above repo as this will explain 
a little about the project and where my focus will be for the next three months 
work wise conducting an Exploration Phase to scope out the technology and 
techniques that will go into project once we start coding the scene graph 
itself.

This new project will co-exist with the OpenSceneGraph for years to come.  I 
will remain as project lead of the OpenSceneGraph, I will fix bugs, push out 
releases, generally chase everybody to test things and also help out with 
general support here - continue to do what I've done for nearly two decades.  
Like OpenGL the OpenSceneGraph is still relevant to many application developers 
and I expect it to remain a corner stone of many application for years to come. 
 Both OpenGL and OpenSceneGraph are very mature bits of software now so there 
isn't a need to keep pushing hard on new features, so I planning for a stable 
period when maintenance is increasingly the focus rather new new bells and 
whistles.

You no doubt will have lots of questions, but at this point I can't provide too 
many answers on the technical front as we are so early in the project the 
technical details are yet to solidified - this is what my next three months 
work will be all about.  I'll be learning everything I can about Vulkan, 
working out how best to encapsulate it's features them in a scene graph.

I also will be looking into what features of modern C++ can bring to the table 
to make our lives as graphics developers easier and more productive, C++11, 14 
and 17 are all under consideration.

There also all the scene graph design elements that have been bubbling around 
in my head for the last five years that I'd like to try out to see what might 
be possible.

Once this Exploration Phase is complete I will have a more concrete idea of 
what needs to be done next and will write a design document to share with the 
community to give everyone a clearer idea of where we are going next.  During 
this phase I will spend most of my time working quietly away learning, testing, 
thinking, learning, testing, thinking.  It's not a period that I am looking for 
lots of external input on, the best software designs don't come from committees 
but from a coherent and calm contemplation.  I guess I need to go find myself a 
mediation rock on Skellig Michael :-)

If you are keen to help out VulkanSceneGraph then this is something you can 
help out with right away, without needing me to complete any design docs or to 
publish any code.  What all good software needs during development and through 
into maintenance phase are unit tests that test features and performance.  To 
this end I can created a new SceneGraphTestBed repository to collect together 
in one place a set of data and test programs that we can run to test out 
features and performance of both the OpenSceneGraph and the VulkanSceneGraph 
once it starts becoming usable.

   https://github.com/openscenegraph/SceneGraphTestBed

I don't have any data or test programs written at this point, so this repo is 
an empty room waiting to be filled.  My thought is that we would initially just 
create OpenSceneGraph based test data and programs that test various features 
and performance of the OpenSceneGraph.  If you have a particular tests that 
illustrate the problems areas that you have in performance, or things that are 
awkward to implement but shouldn't be then you could submit this as unit tests 
that stress the OpenSceneGraph.

As the VulkanSceneGraph project evolves we tackle recreating these 
OpenSceneGraph test programs using the new scene graph and the have an ability 
to compare OpenGL/OpenSceneGraph with Vulkan/VulkanSceneGraph, as well as have 
a set of unit tests that we can run prior to each release of the OpenScenGraph 
or VulkanSceneGraph.

I don't have any specific plans of how to layout or manage the 
SceneGraphTestBed, if you feel like it's something you'd like to pick up the 
lead on then let us know - I'm already have plenty to juggle myself so being 
able to let others manage sub projects is great way of 

Re: [osg-users] EXTERNAL: Re: FBO setup not working..

2018-05-10 Thread Rowley, Marlin R
Robert,

Could you do me a favor and see if the example in the OpenSceneGraph 3 
Cookbook, page 242 works on your computer?  I was originally wanting to test 
with that but when I get totally white on the left side of the screen (when it 
should have been showing the depth buffer), I went to trying the 
osgpackeddepthstencil.cpp file.

I just want to make sure I’m overlooking something simple.

-M


Marlin Rowley
Software Engineer, Staff
[cid:image002.jpg@01D39374.DEC5A2E0]
Missiles and Fire Control
972-603-1931 (office)
214-926-0622 (mobile)
marlin.r.row...@lmco.com<mailto:marlin.r.row...@lmco.com>

From: osg-users [mailto:osg-users-boun...@lists.openscenegraph.org] On Behalf 
Of Robert Osfield
Sent: Thursday, May 10, 2018 2:58 AM
To: OpenSceneGraph Users <osg-users@lists.openscenegraph.org>
Subject: EXTERNAL: Re: [osg-users] FBO setup not working..

Hi Marlin,

On 9 May 2018 at 18:46, Rowley, Marlin R 
<marlin.r.row...@lmco.com<mailto:marlin.r.row...@lmco.com>> wrote:
Hello,

I get the following error when running the example: osgpackeddepthstencil.cpp

RenderStage::runCameraSetUp(), FBO setup failed, FBO status= 0x8cdd

I have a AMD Radeon RX580.

I have just tested osgpackeddepthstencil on my Linux/NVidia system and it runs 
without errors.

Camera::attach() is the mechanism that the OSG uses to tell the OSG's rendering 
back-end how to set up FBO's, there isn't another route for this.  Perhaps it's 
an issue with the enum values used with the attach calls, perhaps 
GL_STENCIL_INDEX8_EXT isn't supported by your system.
With driver/hardware specific issues like this having feedback from a range of 
users is helpful as it can give us an idea on what OS/drivers/hardware hard 
problems, this then gives clues as to what direction to look into.
Robert.
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] FBO setup not working..

2018-05-09 Thread Rowley, Marlin R
So I've tracked the error message down to attaching the render-to-target camera 
with the components:

// this doesn't work on NVIDIA/Vista 64-bit
// FBO status = 0x8cd6 (FRAMEBUFFER_INCOMPLETE_ATTACHMENT_EXT)
rttCamera->attach(osg::Camera::DEPTH_BUFFER, GL_DEPTH_COMPONENT);
rttCamera->attach(osg::Camera::STENCIL_BUFFER, GL_STENCIL_INDEX8_EXT);

Is there another way to attach buffer bits to a camera?

-M

Marlin Rowley
Software Engineer, Staff
[cid:image002.jpg@01D39374.DEC5A2E0]
Missiles and Fire Control
972-603-1931 (office)
214-926-0622 (mobile)
marlin.r.row...@lmco.com<mailto:marlin.r.row...@lmco.com>

From: osg-users [mailto:osg-users-boun...@lists.openscenegraph.org] On Behalf 
Of Rowley, Marlin R (US)
Sent: Wednesday, May 9, 2018 12:47 PM
To: OpenSceneGraph Users <osg-users@lists.openscenegraph.org>
Subject: EXTERNAL: [osg-users] FBO setup not working..

Hello,

I get the following error when running the example: osgpackeddepthstencil.cpp

RenderStage::runCameraSetUp(), FBO setup failed, FBO status= 0x8cdd

I have a AMD Radeon RX580.


Marlin Rowley
Software Engineer, Staff
[cid:image002.jpg@01D39374.DEC5A2E0]
Missiles and Fire Control
972-603-1931 (office)
214-926-0622 (mobile)
marlin.r.row...@lmco.com<mailto:marlin.r.row...@lmco.com>

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


[osg-users] FBO setup not working..

2018-05-09 Thread Rowley, Marlin R
Hello,

I get the following error when running the example: osgpackeddepthstencil.cpp

RenderStage::runCameraSetUp(), FBO setup failed, FBO status= 0x8cdd

I have a AMD Radeon RX580.


Marlin Rowley
Software Engineer, Staff
[cid:image002.jpg@01D39374.DEC5A2E0]
Missiles and Fire Control
972-603-1931 (office)
214-926-0622 (mobile)
marlin.r.row...@lmco.com

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


Re: [osg-users] EXTERNAL: Re: Getting the combined matrix from a Node?

2018-05-08 Thread Rowley, Marlin R
Yes, I used this way.

Thanks,

-M


Marlin Rowley
Software Engineer, Staff
[cid:image002.jpg@01D39374.DEC5A2E0]
Missiles and Fire Control
972-603-1931 (office)
214-926-0622 (mobile)
marlin.r.row...@lmco.com<mailto:marlin.r.row...@lmco.com>

From: osg-users [mailto:osg-users-boun...@lists.openscenegraph.org] On Behalf 
Of Robert Osfield
Sent: Tuesday, May 8, 2018 2:24 AM
To: OpenSceneGraph Users <osg-users@lists.openscenegraph.org>
Subject: EXTERNAL: Re: [osg-users] Getting the combined matrix from a Node?

Hi Marlin,
The Transform class and it's subclasses are designed to be used as part of 
scene graph, this allow Transform subclasses that are absolute (ignore 
transforms+camera matrices above them) or relative (multiple the inherited 
modelview matrix) to enable this in a generic way the Transform class has two 
helper methods Transform::computeLocalToWorld(osg::Matrix& matrix, NodeVistor*) 
and computeWorldToLocal(osg::Matrix& matrix, NodeVisior*). Only some Transform 
implementations need to check the NodeVisitor for extra data, most will just 
ignore that parameter and just do the matrix maths required.
The computeLocalToWorld() method returns a bool on success, and you pass in the 
matrix you want to apply,  You're code segment appears to confuse things in 
this regard.

If you want to transform of any node in the scene graph you can do 
Node::getWorldMatrices(), this finds all the parental NodePaths of that node 
and then returns a vector containing a matrix for each NodePath found.
Robert.


On 7 May 2018 at 19:58, Rowley, Marlin R 
<marlin.r.row...@lmco.com<mailto:marlin.r.row...@lmco.com>> wrote:
Hello,

I’m trying to figure out how to retrieve the combined matrix from a node that 
is of a PositionAttitudeTransform node type.  I can get it converted to a 
Transform() class, but there is no clear way of getting the combined matrix 
from local to world.  For example,

Osg::PositionAttitudeTransform trans;
Trans.setScale(2,2,2);
Trans.setPosition(0,10,0);

Osg::Matrixd temp = getCombinedTransform(trans);
Osg::Matrixd getCombinedTransform(const osg::ref_ptr & mat)
{
  Auto m = mat->asTransform();
  Return m->computeLocalToWorldMatrix (m, ???); << == why use a 
node visitor on yourself?

  Or

  Return m->getCombinedMatrix()?? <<  = is there such a thing?
}


Marlin Rowley
Software Engineer, Staff
[cid:image002.jpg@01D39374.DEC5A2E0]
Missiles and Fire Control
972-603-1931 (office)
214-926-0622 (mobile)
marlin.r.row...@lmco.com<mailto:marlin.r.row...@lmco.com>


___
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


[osg-users] Getting the combined matrix from a Node?

2018-05-07 Thread Rowley, Marlin R
Hello,

I'm trying to figure out how to retrieve the combined matrix from a node that 
is of a PositionAttitudeTransform node type.  I can get it converted to a 
Transform() class, but there is no clear way of getting the combined matrix 
from local to world.  For example,

Osg::PositionAttitudeTransform trans;
Trans.setScale(2,2,2);
Trans.setPosition(0,10,0);

Osg::Matrixd temp = getCombinedTransform(trans);
Osg::Matrixd getCombinedTransform(const osg::ref_ptr & mat)
{
  Auto m = mat->asTransform();
  Return m->computeLocalToWorldMatrix (m, ???); << == why use a 
node visitor on yourself?

  Or

  Return m->getCombinedMatrix()?? <<  = is there such a thing?
}


Marlin Rowley
Software Engineer, Staff
[cid:image002.jpg@01D39374.DEC5A2E0]
Missiles and Fire Control
972-603-1931 (office)
214-926-0622 (mobile)
marlin.r.row...@lmco.com

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


Re: [osg-users] Getting the main camera.

2018-05-02 Thread Rowley, Marlin R
Here is a more informed email of what I'm trying to accomplish:

We have some old code that inherits from the ShadowMapTechnique to do most of 
it's work which is based on the fixed-function pipeline.  It uses the shadow 
map's camera for projection of textures (among other things) and we are 
redesigning it so that the base class is independent of the shadow map class.  
I thought I had everything working when I gutted out this function in the 
ViewData override function called addShadowReceivingTexGen():

_texgen->setMode(osg::TexGen::EYE_LINEAR);

// compute the matrix which takes a vertex from view coords into tex coords
_texgen->setPlanesFromMatrix(
  mClampCallback->getLastProjection() *
  osg::Matrix::translate(1.0, 1.0, 1.0) *
  osg::Matrix::scale(0.5f, 0.5f, 0.5f));

osg::RefMatrix * refMatrix = new osg::RefMatrix
  (_camera->getInverseViewMatrix() * *_cv->getModelViewMatrix());

_cv->getRenderStage()->getPositionalStateContainer()->
  addPositionedTextureAttribute
  (*_shadowTextureUnitPtr, refMatrix, _texgen.get());

This is evidently stored in OpenGL's built-in variables because it's used in 
the vertex shader like this:

{
gl_TexCoord[1].s = dot(ecPosition, gl_EyePlaneS[1]);
gl_TexCoord[1].t = dot(ecPosition, gl_EyePlaneT[1]);
gl_TexCoord[1].p = dot(ecPosition, gl_EyePlaneR[1]);
gl_TexCoord[1].q = dot(ecPosition, gl_EyePlaneQ[1]);
}

My new solution for the addShadowReceivingTexGen() is a simple 
updateTextureCoordinates() function:

mTexGenMatrix = mCamera->getViewMatrix() *mCamera->getProjectionMatrix() * 
osg::Matrixd::translate(osg::Vec3d(1.0, 1.0, 1.0)) *
osg::Matrixd::scale(0.5, 0.5, 0.5);

And in the new vertex shader, I do this:

TexCoords[0] = TexGenMatrix0 * gl_Vertex;

Which goes from modelspace all the way to clip space.  This works on simple 
objects created at the origin in modelspace, but it does NOT work with an 
entire world with large terrain.

I'd like to continue NOT using the gl_EyePlaneSTRQ and just doing a regular 
transformation.  However, going back to the old code for any clues is leading 
me nowhere.  I traced the 'addPositionedTextureAttribute' to this:

virtual void addPositionedTextureAttribute(unsigned int textureUnit, 
osg::RefMatrix* matrix,const osg::StateAttribute* attr)
{
_texAttrListMap[textureUnit].push_back(AttrMatrixPair(attr,matrix));
}

.. but I'm not sure what it's doing here.  The attr is the texgen object but 
that's used to store a matrix.  So what does the vertex shader 'see' from this 
function?

I apologize for the long and drawn out email but I've been thinking on this for 
a few hours now and am really new to OpenGL and not sure what some of this code 
is trying to do.

Thanks,

-M


Marlin Rowley
Software Engineer, Staff
[cid:image002.jpg@01D39374.DEC5A2E0]
Missiles and Fire Control
972-603-1931 (office)
214-926-0622 (mobile)
marlin.r.row...@lmco.com<mailto:marlin.r.row...@lmco.com>

From: osg-users [mailto:osg-users-boun...@lists.openscenegraph.org] On Behalf 
Of Rowley, Marlin R (US)
Sent: Wednesday, May 2, 2018 12:05 PM
To: OpenSceneGraph Users <osg-users@lists.openscenegraph.org>
Subject: EXTERNAL: [osg-users] Getting the main camera.

Is there a way to get a pointer to the main rendering camera without passing 
the Viewer around through classes and functions?

Thanks,

-M


Marlin Rowley
Software Engineer, Staff
[cid:image002.jpg@01D39374.DEC5A2E0]
Missiles and Fire Control
972-603-1931 (office)
214-926-0622 (mobile)
marlin.r.row...@lmco.com<mailto:marlin.r.row...@lmco.com>

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


[osg-users] Getting the main camera.

2018-05-02 Thread Rowley, Marlin R
Is there a way to get a pointer to the main rendering camera without passing 
the Viewer around through classes and functions?

Thanks,

-M


Marlin Rowley
Software Engineer, Staff
[cid:image002.jpg@01D39374.DEC5A2E0]
Missiles and Fire Control
972-603-1931 (office)
214-926-0622 (mobile)
marlin.r.row...@lmco.com

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


Re: [osg-users] EXTERNAL: Re: EXTERNAL: Re: Help on multitexturing..

2018-04-23 Thread Rowley, Marlin R
Thanks Robert.  I got it working and will do text only for code in the future.

-M


Marlin Rowley
Software Engineer, Staff
[cid:image002.jpg@01D39374.DEC5A2E0]
Missiles and Fire Control
972-603-1931 (office)
214-926-0622 (mobile)
marlin.r.row...@lmco.com<mailto:marlin.r.row...@lmco.com>

From: osg-users [mailto:osg-users-boun...@lists.openscenegraph.org] On Behalf 
Of Robert Osfield
Sent: Friday, April 20, 2018 2:06 AM
To: OpenSceneGraph Users <osg-users@lists.openscenegraph.org>
Subject: EXTERNAL: Re: [osg-users] EXTERNAL: Re: Help on multitexturing..

On 19 April 2018 at 20:30, Rowley, Marlin R 
<marlin.r.row...@lmco.com<mailto:marlin.r.row...@lmco.com>> wrote:
I thought the sampler value was a pointer to a texture?

Where did you get that idea?  None of the OSG example attempt this.  When using 
OpenGL you pass the sampler uniforms as int, when it comes to OpenGL the OSG is 
just a lightweight wrapper around it.


I set the texture unit to 1 because we’ll need the base texture unit 0 later 
on.  My goal is to turn on up to 10 texture units and blend them all together.

To be more clear, he is some more code:

mGroupState = mBoundGeometry->getOrCreateStateSet();
  mGroupState->getOrCreateUniform("BaseTexSampler", 
osg::Uniform::SAMPLER_2D)->set(mBaseColor.get());
  mGroupState->getOrCreateUniform("BaseWeight", 
osg::Uniform::FLOAT)->set(mBaseWeight);
  mGroupState->setTextureAttributeAndModes(BASE_TEXTURE_UNIT, mBaseColor, 
osg::StateAttribute::ON);

This sets the base texture unit 1 to be bound to the mBaseColor (which is a 
osg::ref_ptr) created before the function call.

I tell you want the problem is and you copy and paste more code with that exact 
problem in.  Pass in an int value for the sampler texture unit, so 
BASE_TEXTURE_UNIT, not the texture pointer.
For future reference, could you refrrame from using this black and white 
blocks, it's painful to look at.  Just putting everything in plain texture but 
using indentation for code is perfectly fine.
Robert.

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


Re: [osg-users] EXTERNAL: Re: EXTERNAL: Re: EXTERNAL: Re: EXTERNAL: Re: Help on multitexturing..

2018-04-19 Thread Rowley, Marlin R
Robert,

This problem has been solved.

Answer:


  1.  Passing strings to set a uniform name will NOT automatically convert 
numbers to strings (i.e. getOrCreateUniform(“some_string” + 4, … ) will not 
work.  It must be converted first. (i.e. getOrCreateUniform(“some_string” + 
std::to_string(4), … )
  2.  You can NOT index an array when setting a uniform’s value (i.e. 
uniform->set(num_array[0])).. It needs to be copied first (i.e. int x = 
num_array[0]; uniform->set(x);

Hope this helps others who are getting their feet wet with OSG.

Cheers,

-M


Marlin Rowley
Software Engineer, Staff
[cid:image002.jpg@01D39374.DEC5A2E0]
Missiles and Fire Control
972-603-1931 (office)
214-926-0622 (mobile)
marlin.r.row...@lmco.com<mailto:marlin.r.row...@lmco.com>

From: osg-users [mailto:osg-users-boun...@lists.openscenegraph.org] On Behalf 
Of Rowley, Marlin R (US)
Sent: Thursday, April 19, 2018 3:54 PM
To: OpenSceneGraph Users <osg-users@lists.openscenegraph.org>
Subject: EXTERNAL: Re: [osg-users] EXTERNAL: Re: EXTERNAL: Re: EXTERNAL: Re: 
Help on multitexturing..

Robert,

I’ve investigated further and believe I’ve found the problem but not sure how 
to fix it.

I have a constructor for a layered texture class where I pass it an image as 
the base layer.  I set the texture mode and create a texture in this 
constructor for the base class.  I also assign BASE_TEXTURE_UNIT to the 
sampler2D as an id to bind the texture to it for the shader (thanks for this..).

I run a function called updateShaders() (which I’ve sent snippets of code for) 
at the bottom of my constructor class.  If I access this base sampler texture 
in the shader, I get what I expect on the geometry.

Now, when I call a function to create a layer for this layered class (i.e. 
createLayer(some image, weight, etc..)) from the application, I create a 
texture from this function and I run the updateShaders() function again binding 
the BASE_TEXTURE_UNIT + 1 to my second sampler node and trying to bind it to 
the texture I just created.  THIS is what’s NOT working properly.  When I run 
GPUPerf debugger, I see that the texture unit is assigned the correct #2, but 
the BoundID isn’t equal to the unit number.  So when I sample from the texture 
in the shader, it’s just black because it can’t see this new binding (assume no 
blending in the shader just an overwrite).

To test this, I reconfigured my constructor to take 2 images instead of 1 image 
for the base and I forego the call to createLayer() in my application.  Sure 
enough, the binding is properly set.  Am I missing some kind of callback that 
should force a rebind when I call updateShaders()?

-M


Marlin Rowley
Software Engineer, Staff
[cid:image002.jpg@01D39374.DEC5A2E0]
Missiles and Fire Control
972-603-1931 (office)
214-926-0622 (mobile)
marlin.r.row...@lmco.com<mailto:marlin.r.row...@lmco.com>

From: osg-users [mailto:osg-users-boun...@lists.openscenegraph.org] On Behalf 
Of Rowley, Marlin R (US)
Sent: Thursday, April 19, 2018 3:25 PM
To: OpenSceneGraph Users 
<osg-users@lists.openscenegraph.org<mailto:osg-users@lists.openscenegraph.org>>
Subject: EXTERNAL: Re: [osg-users] EXTERNAL: Re: EXTERNAL: Re: Help on 
multitexturing..

Robert,

Changing the sampler_2d to an (int) doesn’t seem to fix the problem.  I still 
get a black texture in the scene.

Here is my updated code:

mGroupState->getOrCreateUniform("MySecondSampler", 
osg::Uniform::SAMPLER_2D)->set(BASE_TEXTURE_UNIT + 1);
mGroupState->setTextureAttributeAndModes(BASE_TEXTURE_UNIT + 1, 
mSecondColor, osg::StateAttribute::OVERRIDE);

I want to write this second texture to unit 2.  (base_texture_unit = 1 + 1).  I 
still get a black object.


Marlin Rowley
Software Engineer, Staff
[cid:image002.jpg@01D39374.DEC5A2E0]
Missiles and Fire Control
972-603-1931 (office)
214-926-0622 (mobile)
marlin.r.row...@lmco.com<mailto:marlin.r.row...@lmco.com>

From: osg-users [mailto:osg-users-boun...@lists.openscenegraph.org] On Behalf 
Of Rowley, Marlin R (US)
Sent: Thursday, April 19, 2018 2:30 PM
To: OpenSceneGraph Users 
<osg-users@lists.openscenegraph.org<mailto:osg-users@lists.openscenegraph.org>>
Subject: EXTERNAL: Re: [osg-users] EXTERNAL: Re: Help on multitexturing..

I thought the sampler value was a pointer to a texture?

I set the texture unit to 1 because we’ll need the base texture unit 0 later 
on.  My goal is to turn on up to 10 texture units and blend them all together.

To be more clear, he is some more code:

mGroupState = mBoundGeometry->getOrCreateStateSet();
  mGroupState->getOrCreateUniform("BaseTexSampler", 
osg::Uniform::SAMPLER_2D)->set(mBaseColor.get());
  mGroupState->getOrCreateUniform("BaseWeight", 
osg::Uniform::FLOAT)->set(mBaseWeight);
  mGroupState->setTextureAttributeAn

Re: [osg-users] EXTERNAL: Re: EXTERNAL: Re: EXTERNAL: Re: Help on multitexturing..

2018-04-19 Thread Rowley, Marlin R
Robert,

I’ve investigated further and believe I’ve found the problem but not sure how 
to fix it.

I have a constructor for a layered texture class where I pass it an image as 
the base layer.  I set the texture mode and create a texture in this 
constructor for the base class.  I also assign BASE_TEXTURE_UNIT to the 
sampler2D as an id to bind the texture to it for the shader (thanks for this..).

I run a function called updateShaders() (which I’ve sent snippets of code for) 
at the bottom of my constructor class.  If I access this base sampler texture 
in the shader, I get what I expect on the geometry.

Now, when I call a function to create a layer for this layered class (i.e. 
createLayer(some image, weight, etc..)) from the application, I create a 
texture from this function and I run the updateShaders() function again binding 
the BASE_TEXTURE_UNIT + 1 to my second sampler node and trying to bind it to 
the texture I just created.  THIS is what’s NOT working properly.  When I run 
GPUPerf debugger, I see that the texture unit is assigned the correct #2, but 
the BoundID isn’t equal to the unit number.  So when I sample from the texture 
in the shader, it’s just black because it can’t see this new binding (assume no 
blending in the shader just an overwrite).

To test this, I reconfigured my constructor to take 2 images instead of 1 image 
for the base and I forego the call to createLayer() in my application.  Sure 
enough, the binding is properly set.  Am I missing some kind of callback that 
should force a rebind when I call updateShaders()?

-M


Marlin Rowley
Software Engineer, Staff
[cid:image002.jpg@01D39374.DEC5A2E0]
Missiles and Fire Control
972-603-1931 (office)
214-926-0622 (mobile)
marlin.r.row...@lmco.com<mailto:marlin.r.row...@lmco.com>

From: osg-users [mailto:osg-users-boun...@lists.openscenegraph.org] On Behalf 
Of Rowley, Marlin R (US)
Sent: Thursday, April 19, 2018 3:25 PM
To: OpenSceneGraph Users <osg-users@lists.openscenegraph.org>
Subject: EXTERNAL: Re: [osg-users] EXTERNAL: Re: EXTERNAL: Re: Help on 
multitexturing..

Robert,

Changing the sampler_2d to an (int) doesn’t seem to fix the problem.  I still 
get a black texture in the scene.

Here is my updated code:

mGroupState->getOrCreateUniform("MySecondSampler", 
osg::Uniform::SAMPLER_2D)->set(BASE_TEXTURE_UNIT + 1);
mGroupState->setTextureAttributeAndModes(BASE_TEXTURE_UNIT + 1, 
mSecondColor, osg::StateAttribute::OVERRIDE);

I want to write this second texture to unit 2.  (base_texture_unit = 1 + 1).  I 
still get a black object.


Marlin Rowley
Software Engineer, Staff
[cid:image002.jpg@01D39374.DEC5A2E0]
Missiles and Fire Control
972-603-1931 (office)
214-926-0622 (mobile)
marlin.r.row...@lmco.com<mailto:marlin.r.row...@lmco.com>

From: osg-users [mailto:osg-users-boun...@lists.openscenegraph.org] On Behalf 
Of Rowley, Marlin R (US)
Sent: Thursday, April 19, 2018 2:30 PM
To: OpenSceneGraph Users 
<osg-users@lists.openscenegraph.org<mailto:osg-users@lists.openscenegraph.org>>
Subject: EXTERNAL: Re: [osg-users] EXTERNAL: Re: Help on multitexturing..

I thought the sampler value was a pointer to a texture?

I set the texture unit to 1 because we’ll need the base texture unit 0 later 
on.  My goal is to turn on up to 10 texture units and blend them all together.

To be more clear, he is some more code:

mGroupState = mBoundGeometry->getOrCreateStateSet();
  mGroupState->getOrCreateUniform("BaseTexSampler", 
osg::Uniform::SAMPLER_2D)->set(mBaseColor.get());
  mGroupState->getOrCreateUniform("BaseWeight", 
osg::Uniform::FLOAT)->set(mBaseWeight);
  mGroupState->setTextureAttributeAndModes(BASE_TEXTURE_UNIT, mBaseColor, 
osg::StateAttribute::ON);

This sets the base texture unit 1 to be bound to the mBaseColor (which is a 
osg::ref_ptr) created before the function call.

Then, I do this right afterwards:

if (mNumLayers)
  {
int indx = 0;
  osg::ref_ptr tex = mTextureMap[indx];// iter->second;
mGroupState->getOrCreateUniform("TexLayerSampler0", 
osg::Uniform::SAMPLER_2D)->set(tex.get());
mGroupState->setTextureAttributeAndModes(BASE_TEXTURE_UNIT + 1, 
tex, osg::StateAttribute::OVERRIDE);
  }

Here I get the texture from a std::map.  And then I set the sampler to be bound 
to the texture.  I then bind the texture unit 2 to the texture.

-M


Marlin Rowley
Software Engineer, Staff
[cid:image002.jpg@01D39374.DEC5A2E0]
Missiles and Fire Control
972-603-1931 (office)
214-926-0622 (mobile)
marlin.r.row...@lmco.com<mailto:marlin.r.row...@lmco.com>

From: osg-users [mailto:osg-users-boun...@lists.openscenegraph.org] On Behalf 
Of Robert Osfield
Sent: Thursday, April 19, 2018 2:05 PM
To: OpenSceneGraph Users 
<osg-users@lists.openscen

Re: [osg-users] EXTERNAL: Re: EXTERNAL: Re: Help on multitexturing..

2018-04-19 Thread Rowley, Marlin R
Robert,

Changing the sampler_2d to an (int) doesn’t seem to fix the problem.  I still 
get a black texture in the scene.

Here is my updated code:

mGroupState->getOrCreateUniform("MySecondSampler", 
osg::Uniform::SAMPLER_2D)->set(BASE_TEXTURE_UNIT + 1);
mGroupState->setTextureAttributeAndModes(BASE_TEXTURE_UNIT + 1, 
mSecondColor, osg::StateAttribute::OVERRIDE);

I want to write this second texture to unit 2.  (base_texture_unit = 1 + 1).  I 
still get a black object.


Marlin Rowley
Software Engineer, Staff
[cid:image002.jpg@01D39374.DEC5A2E0]
Missiles and Fire Control
972-603-1931 (office)
214-926-0622 (mobile)
marlin.r.row...@lmco.com<mailto:marlin.r.row...@lmco.com>

From: osg-users [mailto:osg-users-boun...@lists.openscenegraph.org] On Behalf 
Of Rowley, Marlin R (US)
Sent: Thursday, April 19, 2018 2:30 PM
To: OpenSceneGraph Users <osg-users@lists.openscenegraph.org>
Subject: EXTERNAL: Re: [osg-users] EXTERNAL: Re: Help on multitexturing..

I thought the sampler value was a pointer to a texture?

I set the texture unit to 1 because we’ll need the base texture unit 0 later 
on.  My goal is to turn on up to 10 texture units and blend them all together.

To be more clear, he is some more code:

mGroupState = mBoundGeometry->getOrCreateStateSet();
  mGroupState->getOrCreateUniform("BaseTexSampler", 
osg::Uniform::SAMPLER_2D)->set(mBaseColor.get());
  mGroupState->getOrCreateUniform("BaseWeight", 
osg::Uniform::FLOAT)->set(mBaseWeight);
  mGroupState->setTextureAttributeAndModes(BASE_TEXTURE_UNIT, mBaseColor, 
osg::StateAttribute::ON);

This sets the base texture unit 1 to be bound to the mBaseColor (which is a 
osg::ref_ptr) created before the function call.

Then, I do this right afterwards:

if (mNumLayers)
  {
int indx = 0;
  osg::ref_ptr tex = mTextureMap[indx];// iter->second;
mGroupState->getOrCreateUniform("TexLayerSampler0", 
osg::Uniform::SAMPLER_2D)->set(tex.get());
mGroupState->setTextureAttributeAndModes(BASE_TEXTURE_UNIT + 1, 
tex, osg::StateAttribute::OVERRIDE);
  }

Here I get the texture from a std::map.  And then I set the sampler to be bound 
to the texture.  I then bind the texture unit 2 to the texture.

-M


Marlin Rowley
Software Engineer, Staff
[cid:image002.jpg@01D39374.DEC5A2E0]
Missiles and Fire Control
972-603-1931 (office)
214-926-0622 (mobile)
marlin.r.row...@lmco.com<mailto:marlin.r.row...@lmco.com>

From: osg-users [mailto:osg-users-boun...@lists.openscenegraph.org] On Behalf 
Of Robert Osfield
Sent: Thursday, April 19, 2018 2:05 PM
To: OpenSceneGraph Users 
<osg-users@lists.openscenegraph.org<mailto:osg-users@lists.openscenegraph.org>>
Subject: EXTERNAL: Re: [osg-users] Help on multitexturing..

Hi Marlin,
The sampler value should be an int, so you shouldn't pass a texture pointer to 
your setting of the TexLayerSampler0 second sampler.  Perhaps this was just a 
copy and paste error.
As a general note, normally one would assign a base texture on texture unit 0 
rather than 1.

Robert.


On 19 April 2018 at 19:06, Rowley, Marlin R 
<marlin.r.row...@lmco.com<mailto:marlin.r.row...@lmco.com>> wrote:
Hello,

I’ve been wracking my brain all day on trying to figure out how to do this with 
no clear examples found online.

I have this set of calls in my C++:

mGroupState = mBoundGeometry->getOrCreateStateSet();
  mGroupState->getOrCreateUniform("BaseTexSampler", 
osg::Uniform::SAMPLER_2D)->set(mBaseColor);
  mGroupState->getOrCreateUniform("BaseWeight", 
osg::Uniform::FLOAT)->set(mBaseWeight);
  mGroupState->setTextureAttributeAndModes(BASE_TEXTURE_UNIT, mBaseColor, 
osg::StateAttribute::ON);

I’ve bound this base texture to texture unit (BASE_TEXTURE_UNIT = 1).

Later in the code, I have this in another function if I create another layer 
with another texture:


mGroupState->getOrCreateUniform("TexLayerSampler0", 
osg::Uniform::SAMPLER_2D)->set(tex);

mGroupState->setTextureAttribute(BASE_TEXTURE_UNIT + 1, tex, 
osg::StateAttribute::ON);

Where I’ve created a second texture and want it to reside in texture unit 2.

However, in my shader code when indexing the TexLayerSampler0, I only get base 
texture.

finalColor = texture(TexLayerSampler0, LayeredTexCoords[0].st);

Which is wrong.  I’m stil trying to figure out OpenGL and how it works along 
with OSG so sorry for the inexperience.

-M


Marlin Rowley
Software Engineer, Staff
[cid:image002.jpg@01D39374.DEC5A2E0]
Missiles and Fire Control
972-603-1931 (office)
214-926-0622 (mobile)
marlin.r.row...@lmco.com<mailto:marlin.r.row...@lmco.com>


___
osg-users mailing list
osg-users@lists.open

Re: [osg-users] EXTERNAL: Re: Help on multitexturing..

2018-04-19 Thread Rowley, Marlin R
I thought the sampler value was a pointer to a texture?

I set the texture unit to 1 because we’ll need the base texture unit 0 later 
on.  My goal is to turn on up to 10 texture units and blend them all together.

To be more clear, he is some more code:

mGroupState = mBoundGeometry->getOrCreateStateSet();
  mGroupState->getOrCreateUniform("BaseTexSampler", 
osg::Uniform::SAMPLER_2D)->set(mBaseColor.get());
  mGroupState->getOrCreateUniform("BaseWeight", 
osg::Uniform::FLOAT)->set(mBaseWeight);
  mGroupState->setTextureAttributeAndModes(BASE_TEXTURE_UNIT, mBaseColor, 
osg::StateAttribute::ON);

This sets the base texture unit 1 to be bound to the mBaseColor (which is a 
osg::ref_ptr) created before the function call.

Then, I do this right afterwards:

if (mNumLayers)
  {
int indx = 0;
  osg::ref_ptr tex = mTextureMap[indx];// iter->second;
mGroupState->getOrCreateUniform("TexLayerSampler0", 
osg::Uniform::SAMPLER_2D)->set(tex.get());
mGroupState->setTextureAttributeAndModes(BASE_TEXTURE_UNIT + 1, 
tex, osg::StateAttribute::OVERRIDE);
  }

Here I get the texture from a std::map.  And then I set the sampler to be bound 
to the texture.  I then bind the texture unit 2 to the texture.

-M


Marlin Rowley
Software Engineer, Staff
[cid:image002.jpg@01D39374.DEC5A2E0]
Missiles and Fire Control
972-603-1931 (office)
214-926-0622 (mobile)
marlin.r.row...@lmco.com<mailto:marlin.r.row...@lmco.com>

From: osg-users [mailto:osg-users-boun...@lists.openscenegraph.org] On Behalf 
Of Robert Osfield
Sent: Thursday, April 19, 2018 2:05 PM
To: OpenSceneGraph Users <osg-users@lists.openscenegraph.org>
Subject: EXTERNAL: Re: [osg-users] Help on multitexturing..

Hi Marlin,
The sampler value should be an int, so you shouldn't pass a texture pointer to 
your setting of the TexLayerSampler0 second sampler.  Perhaps this was just a 
copy and paste error.
As a general note, normally one would assign a base texture on texture unit 0 
rather than 1.

Robert.


On 19 April 2018 at 19:06, Rowley, Marlin R 
<marlin.r.row...@lmco.com<mailto:marlin.r.row...@lmco.com>> wrote:
Hello,

I’ve been wracking my brain all day on trying to figure out how to do this with 
no clear examples found online.

I have this set of calls in my C++:

mGroupState = mBoundGeometry->getOrCreateStateSet();
  mGroupState->getOrCreateUniform("BaseTexSampler", 
osg::Uniform::SAMPLER_2D)->set(mBaseColor);
  mGroupState->getOrCreateUniform("BaseWeight", 
osg::Uniform::FLOAT)->set(mBaseWeight);
  mGroupState->setTextureAttributeAndModes(BASE_TEXTURE_UNIT, mBaseColor, 
osg::StateAttribute::ON);

I’ve bound this base texture to texture unit (BASE_TEXTURE_UNIT = 1).

Later in the code, I have this in another function if I create another layer 
with another texture:


mGroupState->getOrCreateUniform("TexLayerSampler0", 
osg::Uniform::SAMPLER_2D)->set(tex);

mGroupState->setTextureAttribute(BASE_TEXTURE_UNIT + 1, tex, 
osg::StateAttribute::ON);

Where I’ve created a second texture and want it to reside in texture unit 2.

However, in my shader code when indexing the TexLayerSampler0, I only get base 
texture.

finalColor = texture(TexLayerSampler0, LayeredTexCoords[0].st);

Which is wrong.  I’m stil trying to figure out OpenGL and how it works along 
with OSG so sorry for the inexperience.

-M


Marlin Rowley
Software Engineer, Staff
[cid:image002.jpg@01D39374.DEC5A2E0]
Missiles and Fire Control
972-603-1931 (office)
214-926-0622 (mobile)
marlin.r.row...@lmco.com<mailto:marlin.r.row...@lmco.com>


___
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


[osg-users] Help on multitexturing..

2018-04-19 Thread Rowley, Marlin R
Hello,

I've been wracking my brain all day on trying to figure out how to do this with 
no clear examples found online.

I have this set of calls in my C++:

mGroupState = mBoundGeometry->getOrCreateStateSet();
  mGroupState->getOrCreateUniform("BaseTexSampler", 
osg::Uniform::SAMPLER_2D)->set(mBaseColor);
  mGroupState->getOrCreateUniform("BaseWeight", 
osg::Uniform::FLOAT)->set(mBaseWeight);
  mGroupState->setTextureAttributeAndModes(BASE_TEXTURE_UNIT, mBaseColor, 
osg::StateAttribute::ON);

I've bound this base texture to texture unit (BASE_TEXTURE_UNIT = 1).

Later in the code, I have this in another function if I create another layer 
with another texture:


mGroupState->getOrCreateUniform("TexLayerSampler0", 
osg::Uniform::SAMPLER_2D)->set(tex);

mGroupState->setTextureAttribute(BASE_TEXTURE_UNIT + 1, tex, 
osg::StateAttribute::ON);

Where I've created a second texture and want it to reside in texture unit 2.

However, in my shader code when indexing the TexLayerSampler0, I only get base 
texture.

finalColor = texture(TexLayerSampler0, LayeredTexCoords[0].st);

Which is wrong.  I'm stil trying to figure out OpenGL and how it works along 
with OSG so sorry for the inexperience.

-M


Marlin Rowley
Software Engineer, Staff
[cid:image002.jpg@01D39374.DEC5A2E0]
Missiles and Fire Control
972-603-1931 (office)
214-926-0622 (mobile)
marlin.r.row...@lmco.com

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


Re: [osg-users] EXTERNAL: Re: Array of structs

2018-04-18 Thread Rowley, Marlin R
Thanks for this.  I’ll do more R and let you know what I come up with.


Marlin Rowley
Software Engineer, Staff
[cid:image002.jpg@01D39374.DEC5A2E0]
Missiles and Fire Control
972-603-1931 (office)
214-926-0622 (mobile)
marlin.r.row...@lmco.com<mailto:marlin.r.row...@lmco.com>

From: osg-users [mailto:osg-users-boun...@lists.openscenegraph.org] On Behalf 
Of Robert Osfield
Sent: Wednesday, April 18, 2018 9:39 AM
To: OpenSceneGraph Users <osg-users@lists.openscenegraph.org>
Subject: EXTERNAL: Re: [osg-users] Array of structs

Hi Marln,

On 18 April 2018 at 15:31, Rowley, Marlin R 
<marlin.r.row...@lmco.com<mailto:marlin.r.row...@lmco.com>> wrote:
Is there an example of setting values in a uniform struct to pass to the 
shaders along with the shader code that uses these values?

I don't recall if we have an example illustrating setting of uniform struct - I 
haven't written all the OSG examples or other parts of the OSG code base so can 
only easily speak off the top of my head of what I've written or have worked 
closely with, the rest I just look up using grep :-)
Although I don't have an example I can point you at, I have used struct in 
Uniforms before by declaring the struct in the shader source, then in the 
osg::Uniform setup  use a separate osg::Uniform for each uniform i.e.

-- GLSL code:
struct MyStruct
{
   float a;
   float b;
};

uniform MyStruct mystruct;
--- C++ code :

stateset->addUniform(new osg::Uniform("mystruct.a", 1.0f));
stateset->addUniform(new osg::Uniform("mystruct.b", 2.5f));
Hope this helps.
Robert.
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


[osg-users] Array of structs

2018-04-18 Thread Rowley, Marlin R
Robert,

Is there an example of setting values in a uniform struct to pass to the 
shaders along with the shader code that uses these values?

Thanks,

-M


Marlin Rowley
Software Engineer, Staff
[cid:image002.jpg@01D39374.DEC5A2E0]
Missiles and Fire Control
972-603-1931 (office)
214-926-0622 (mobile)
marlin.r.row...@lmco.com

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


Re: [osg-users] EXTERNAL: Re: EXTERNAL: Re: Writing texture coordinates on a mesh without going through traversal code?

2018-04-18 Thread Rowley, Marlin R
Robert,

Excellent tips!  And I totally agree.  It’s a steep learning curve for sure.

Will keep in touch with my development here..

Thanks,

-M


Marlin Rowley
Software Engineer, Staff
[cid:image002.jpg@01D39374.DEC5A2E0]
Missiles and Fire Control
972-603-1931 (office)
214-926-0622 (mobile)
marlin.r.row...@lmco.com<mailto:marlin.r.row...@lmco.com>

From: osg-users [mailto:osg-users-boun...@lists.openscenegraph.org] On Behalf 
Of Robert Osfield
Sent: Saturday, April 14, 2018 12:46 PM
To: OpenSceneGraph Users <osg-users@lists.openscenegraph.org>
Subject: EXTERNAL: Re: [osg-users] EXTERNAL: Re: Writing texture coordinates on 
a mesh without going through traversal code?



On 14 April 2018 at 17:27, Rowley, Marlin R 
<marlin.r.row...@lmco.com<mailto:marlin.r.row...@lmco.com>> wrote:
Hi Robert!

After a lot of hours staying up last night, this morning I found the solution.  
It was surprisingly easy.

When I get back to work on Monday I will post the code that hopefully will help 
other people in the future.  It didn’t have to be as complicated as we were 
going from before.  Especially not with VS/PS 3.0+.  Fixed-function pipeline is 
all but obsolete these days.

Fixed function is still widely used, some OSG users still just use 100% fixed 
function and get on fine, other mix both, others go 100% shaders.  I don't know 
your background, skills or the real requirements of your application so at this 
point it's inappropriate to make assumptions about your particular needs.

For you it might be that a mix of fixed function and shaders will be the most 
productive approach, for instance you can mix fixed function with shaders via 
the built in uniforms that it provides.   So with my suggestion of looking at 
osg::ClipNode / osgclip example is starting place, to illustrate an example of 
positional state, osg::TexGenNode would be another.  Both of these are fixed 
function but also can be used directly in shaders when you use the compatible 
profile or GL2 builds.

As a general note, I'm here trying to help you.  I have almost 17 years of 
experience with helping new OSG users along the path of using the OSG 
effectively.  One the most common troubles that I see is in users getting a bit 
of ahead of themselves trying to solve the more complicated problems before 
understanding the basics of the OSG, this often leads to trying to force the 
OSG to work in a way that is far more complex than is actually required.  The 
best way to help is not to trying a resolve the complex route they have chosen 
for themselves but to get them to take a step back and explain the end goal 
that they are trying to achieve rather than solution that they have decided 
upon.

Once you know where they are going you can start point them in a more 
productive route and then help them take baby steps along this path.  Once they 
get on the right path they get to know the OSG API better and also how to think 
about solutions to problems.

Robert.





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


Re: [osg-users] EXTERNAL: Re: Writing texture coordinates on a mesh without going through traversal code?

2018-04-14 Thread Rowley, Marlin R
Hi Robert!

After a lot of hours staying up last night, this morning I found the solution.  
It was surprisingly easy.

When I get back to work on Monday I will post the code that hopefully will help 
other people in the future.  It didn’t have to be as complicated as we were 
going from before.  Especially not with VS/PS 3.0+.  Fixed-function pipeline is 
all but obsolete these days.

-M

From: osg-users [mailto:osg-users-boun...@lists.openscenegraph.org] On Behalf 
Of Robert Osfield
Sent: Saturday, April 14, 2018 2:15 AM
To: OpenSceneGraph Users <osg-users@lists.openscenegraph.org>
Subject: EXTERNAL: Re: [osg-users] Writing texture coordinates on a mesh 
without going through traversal code?

HI Marlin,

I would hope that you can implement what you need without getting your hands 
dirty with internals of the OSG. It sound like you want something similar to 
osg::ClipPlaneNode.  Have a look at osgclip to see how it works.

Robert.

On 13 April 2018 at 22:30, Rowley, Marlin R 
<marlin.r.row...@lmco.com<mailto:marlin.r.row...@lmco.com>> wrote:
Hello!

I’m trying to generate my own texture coordinates (on-the-fly) by having a 
callback that runs when a piece of geometry intersects my object.  So for 
example, I create a realworld frustum and when my frustum has a shader that’s 
bound to some arbitrary object in the world.  When my frustum intersects this 
object, I would like to generate texture coordinates on this object based on 
how far or near I am to the frustum’s near/far planes (it’s perspective 
frustum).  We had the following code for doing this:

void ViewshedOSG::updateTextureCoordinates()
{
// write the plane equation for all 3 planes
// that make up the camera view frustum.  We can
// then access this from the shader to test whether
// we are in the frustum's volume or not.
osg::Matrixd projection = mCamera->getViewMatrix();
  mTexGen->setPlanesFromMatrix(projection *
  osg::Matrix::translate(1.0, 1.0, 1.0) *
  osg::Matrix::scale(0.5f, 0.5f, 0.5f));
// Bring our models viewspace coordinates back
// into model space coordinate of the camera frustum
osg::RefMatrix * refMatrix = new osg::RefMatrix
   (mCamera->getInverseViewMatrix() * *_cv->getModelViewMatrix());
// Copy the texture generator to the mesh where you
// can index it's coordinates from the ViewshedID
  _cv->getRenderStage()->getPositionalStateContainer()->
addPositionedTextureAttribute
(mId, refMatrix, mTexGen.get());
}


However, this code was based on a cull visitor calling this function from a 
callback.  I have my own callback and it’s not based on a visitor. Is there 
anyway to get the objects modelview matrix() without calling it from a cull 
visitor?  Also only need to write the ‘addPositionedTextureAttribute’ on the 
geometry in order to access the coordinates through a shader.

I’m trying to keep this simple.  Am I in the right direction?

Thanks,

-M

Marlin Rowley
Software Engineer, Staff
[cid:image002.jpg@01D39374.DEC5A2E0]
Missiles and Fire Control
972-603-1931 (office)
214-926-0622 (mobile)
marlin.r.row...@lmco.com<mailto:marlin.r.row...@lmco.com>


___
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


[osg-users] Writing texture coordinates on a mesh without going through traversal code?

2018-04-13 Thread Rowley, Marlin R
Hello!

I'm trying to generate my own texture coordinates (on-the-fly) by having a 
callback that runs when a piece of geometry intersects my object.  So for 
example, I create a realworld frustum and when my frustum has a shader that's 
bound to some arbitrary object in the world.  When my frustum intersects this 
object, I would like to generate texture coordinates on this object based on 
how far or near I am to the frustum's near/far planes (it's perspective 
frustum).  We had the following code for doing this:

void ViewshedOSG::updateTextureCoordinates()
{
// write the plane equation for all 3 planes
// that make up the camera view frustum.  We can
// then access this from the shader to test whether
// we are in the frustum's volume or not.
osg::Matrixd projection = mCamera->getViewMatrix();
  mTexGen->setPlanesFromMatrix(projection *
  osg::Matrix::translate(1.0, 1.0, 1.0) *
  osg::Matrix::scale(0.5f, 0.5f, 0.5f));
// Bring our models viewspace coordinates back
// into model space coordinate of the camera frustum
osg::RefMatrix * refMatrix = new osg::RefMatrix
   (mCamera->getInverseViewMatrix() * *_cv->getModelViewMatrix());
// Copy the texture generator to the mesh where you
// can index it's coordinates from the ViewshedID
  _cv->getRenderStage()->getPositionalStateContainer()->
addPositionedTextureAttribute
(mId, refMatrix, mTexGen.get());
}


However, this code was based on a cull visitor calling this function from a 
callback.  I have my own callback and it's not based on a visitor. Is there 
anyway to get the objects modelview matrix() without calling it from a cull 
visitor?  Also only need to write the 'addPositionedTextureAttribute' on the 
geometry in order to access the coordinates through a shader.

I'm trying to keep this simple.  Am I in the right direction?

Thanks,

-M

Marlin Rowley
Software Engineer, Staff
[cid:image002.jpg@01D39374.DEC5A2E0]
Missiles and Fire Control
972-603-1931 (office)
214-926-0622 (mobile)
marlin.r.row...@lmco.com

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


Re: [osg-users] EXTERNAL: Re: What coordinate system does OSG use?

2018-04-10 Thread Rowley, Marlin R
Robert,

The camera manipulators is probably what we are basing our coordinate system 
off of.  Thanks for the answer there.  I’ll try to remember that going forward.

I understand the model, world, view, projection, divide-by-w, and screen space 
coordinate transformations.  When dealing with matrices though, you just have 
either a left or right handed system, row or column major ordering.  I was just 
a little stumped with how some of these matrices look after going through the 
model, world, and view space transformations.

It’s going to be hard to be too specific with questions and issues as I’m sure 
all of us are working on applications that have several library dependencies.  
It would be more troublesome to create an example unless we can isolate it by 
writing another smaller program.  Not saying I wouldn’t, but I think going the 
general question route first and then getting more specific as we go along 
without any solution should be OK, right?

Thanks for the quick feedback though! 


Marlin Rowley
Software Engineer, Staff
[cid:image002.jpg@01D39374.DEC5A2E0]
Missiles and Fire Control
972-603-1931 (office)
214-926-0622 (mobile)
marlin.r.row...@lmco.com<mailto:marlin.r.row...@lmco.com>

From: osg-users [mailto:osg-users-boun...@lists.openscenegraph.org] On Behalf 
Of Robert Osfield
Sent: Tuesday, April 10, 2018 2:56 PM
To: OpenSceneGraph Users <osg-users@lists.openscenegraph.org>
Subject: EXTERNAL: Re: [osg-users] What coordinate system does OSG use?

There is nothing magical about what the OSG does.  It just loads data, sets up 
the camera view and project matrices that you application sets and passes them 
to OpenGL without any modifications.

Now if you are loading data for standard OSG plugoins like OpenFlight then 
these models will be loaded in world coords where Z is up, Y is north, X is 
east, and the OSG camera manipulators default to this convention so they set 
the view so it looks north, Z up, X to the right.

OpenGL coordinate frame is not a fixed thing, the coordinate frame that objects 
are in depends upon their modelview matrix.  The only thing that is fixed in 
OpenGL coordinate frames is the eye coordinate frame that is Y up, X to the 
right and Z out from the screen.  Eye coordinates and world coordinates are a 
very different thing though and you shouldn't conflate the two.  It sounds like 
to me like you assume that OpenGL eye coordinates is what all OpenGL coordinate 
fame are.   I'm afraid this is just a common misconception about coordinate 
frames in OpenGL and real time graphics in general.

As to what to suggest for you it's difficult to guess what you do and don't 
know about OpenGL, the OSG and graphics in general, so it's hard to know where 
to start when explain stuff.

Robert.

On 10 April 2018 at 21:03, Rowley, Marlin R 
<marlin.r.row...@lmco.com<mailto:marlin.r.row...@lmco.com>> wrote:
Hello,

I’m very confused by this coordinate system.  It appears that our conventional 
left-handed and right-handed systems are NOT used, which causes havoc with the 
OpenGL coordinate frame.

It seems like getting the view matrix at the origin looking down what would be 
a left-handed +z-axis but rotated 90-degress about the x-axis so that z is 
pointing up seems to be the coordinate frame.

In a function call for getting the view matrix from a camera, for example. You 
get these values for the matrix (assuming it’s column-major order)

Mat[2] : [0, -1, 0] <== LOOK
Mat[1]: [0, 0, 1] <==UP
Mat[0]: [1, 0, 0] <== RIGHT

This is confusing me with getting transforms and moving them into the vertex 
shaders.

-M


Marlin Rowley
Software Engineer, Staff
[cid:image002.jpg@01D39374.DEC5A2E0]
Missiles and Fire Control
972-603-1931 (office)
214-926-0622 (mobile)
marlin.r.row...@lmco.com<mailto:marlin.r.row...@lmco.com>


___
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


[osg-users] What coordinate system does OSG use?

2018-04-10 Thread Rowley, Marlin R
Hello,

I'm very confused by this coordinate system.  It appears that our conventional 
left-handed and right-handed systems are NOT used, which causes havoc with the 
OpenGL coordinate frame.

It seems like getting the view matrix at the origin looking down what would be 
a left-handed +z-axis but rotated 90-degress about the x-axis so that z is 
pointing up seems to be the coordinate frame.

In a function call for getting the view matrix from a camera, for example. You 
get these values for the matrix (assuming it's column-major order)

Mat[2] : [0, -1, 0] <== LOOK
Mat[1]: [0, 0, 1] <==UP
Mat[0]: [1, 0, 0] <== RIGHT

This is confusing me with getting transforms and moving them into the vertex 
shaders.

-M


Marlin Rowley
Software Engineer, Staff
[cid:image002.jpg@01D39374.DEC5A2E0]
Missiles and Fire Control
972-603-1931 (office)
214-926-0622 (mobile)
marlin.r.row...@lmco.com

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


Re: [osg-users] EXTERNAL: Re: Getting a callback to update shaders?

2018-04-10 Thread Rowley, Marlin R
No, I have still need the built-in matrices.  I know those get updated.

-M


Marlin Rowley
Software Engineer, Staff
[cid:image002.jpg@01D39374.DEC5A2E0]
Missiles and Fire Control
972-603-1931 (office)
214-926-0622 (mobile)
marlin.r.row...@lmco.com<mailto:marlin.r.row...@lmco.com>

From: osg-users [mailto:osg-users-boun...@lists.openscenegraph.org] On Behalf 
Of Robert Osfield
Sent: Tuesday, April 10, 2018 11:53 AM
To: OpenSceneGraph Users <osg-users@lists.openscenegraph.org>
Subject: EXTERNAL: Re: [osg-users] Getting a callback to update shaders?

On 10 April 2018 at 16:55, Rowley, Marlin R 
<marlin.r.row...@lmco.com<mailto:marlin.r.row...@lmco.com>> wrote:
Nevermind.  I figured out that I need to update the shader state variables on 
every refresh. I thought that an initial binding was all that was needed, but 
they have to be “Set” every frame.

It all depends what data you are needing to pass to the shader via uniforms.  
The OSG provides standard replacements for the likes of gl_ModelViewMatrix 
automatically as osg_ModelViewMatrix etc. if you enable it via osg::State.  See 
the osgsimplegl3 example.

Robert.


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


Re: [osg-users] Getting a callback to update shaders?

2018-04-10 Thread Rowley, Marlin R
Nevermind.  I figured out that I need to update the shader state variables on 
every refresh. I thought that an initial binding was all that was needed, but 
they have to be "Set" every frame.



Marlin Rowley
Software Engineer, Staff
[cid:image002.jpg@01D39374.DEC5A2E0]
Missiles and Fire Control
972-603-1931 (office)
214-926-0622 (mobile)
marlin.r.row...@lmco.com<mailto:marlin.r.row...@lmco.com>

From: osg-users [mailto:osg-users-boun...@lists.openscenegraph.org] On Behalf 
Of Rowley, Marlin R (US)
Sent: Tuesday, April 10, 2018 7:43 AM
To: OpenSceneGraph Users <osg-users@lists.openscenegraph.org>
Subject: EXTERNAL: [osg-users] Getting a callback to update shaders?

Hi,

I have a camera in the scene that I made. It has geometry attached to it to 
represent it.  I also have a shader attached to some geometry in a scene where 
it uses the camera's view/projection matrix.  I've set up a callback (event 
driven) that when I move the camera with keyboard keys, it redraws the object 
correctly, but the shader on the geometry doesn't update from the 
view/projection matrix change.  What am I missing? I've been at this for 9hrs 
and can't find any example that implements that I'm trying to do.

Thanks,

-M


Marlin Rowley
Software Engineer, Staff
[cid:image002.jpg@01D39374.DEC5A2E0]
Missiles and Fire Control
972-603-1931 (office)
214-926-0622 (mobile)
marlin.r.row...@lmco.com<mailto:marlin.r.row...@lmco.com>

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


[osg-users] Getting a callback to update shaders?

2018-04-10 Thread Rowley, Marlin R
Hi,

I have a camera in the scene that I made. It has geometry attached to it to 
represent it.  I also have a shader attached to some geometry in a scene where 
it uses the camera's view/projection matrix.  I've set up a callback (event 
driven) that when I move the camera with keyboard keys, it redraws the object 
correctly, but the shader on the geometry doesn't update from the 
view/projection matrix change.  What am I missing? I've been at this for 9hrs 
and can't find any example that implements that I'm trying to do.

Thanks,

-M


Marlin Rowley
Software Engineer, Staff
[cid:image002.jpg@01D39374.DEC5A2E0]
Missiles and Fire Control
972-603-1931 (office)
214-926-0622 (mobile)
marlin.r.row...@lmco.com

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


Re: [osg-users] EXTERNAL: Re: Examples of using CTRL+Arrow keys?

2018-04-05 Thread Rowley, Marlin R
So where exactly would that go in this order of code?  As an extra case for the 
ea.getEventType()?


Marlin Rowley
Software Engineer, Staff
[cid:image002.jpg@01D39374.DEC5A2E0]
Missiles and Fire Control
972-603-1931 (office)
214-926-0622 (mobile)
marlin.r.row...@lmco.com<mailto:marlin.r.row...@lmco.com>

From: osg-users [mailto:osg-users-boun...@lists.openscenegraph.org] On Behalf 
Of Robert Osfield
Sent: Thursday, April 5, 2018 10:05 AM
To: OpenSceneGraph Users <osg-users@lists.openscenegraph.org>
Subject: EXTERNAL: Re: [osg-users] Examples of using CTRL+Arrow keys?

Hi Marlin,
The osgGA::GUIEventAdapter has a getModKeyMask() that tells you about which of 
the key modifiers are pressed, and getKey() or getUnmodifiedKey() tells you the 
key.
Robert

On 5 April 2018 at 15:59, Rowley, Marlin R 
<marlin.r.row...@lmco.com<mailto:marlin.r.row...@lmco.com>> wrote:
Hi,

I’m trying to write code that will read the CTRL+Arrow key to do an action.  
I’ve looked at the keyboard example but it doesn’t fit what I have currently:

switch (ea.getEventType())
  {
  case osgGA::GUIEventAdapter::KEYDOWN:
   {
 switch (ea.getKey())
 {


Any help would be appreciated,

Thanks,

-M

Marlin Rowley
Software Engineer, Staff
[cid:image002.jpg@01D39374.DEC5A2E0]
Missiles and Fire Control
972-603-1931 (office)
214-926-0622 (mobile)
marlin.r.row...@lmco.com<mailto:marlin.r.row...@lmco.com>


___
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


[osg-users] Examples of using CTRL+Arrow keys?

2018-04-05 Thread Rowley, Marlin R
Hi,

I'm trying to write code that will read the CTRL+Arrow key to do an action.  
I've looked at the keyboard example but it doesn't fit what I have currently:

switch (ea.getEventType())
  {
  case osgGA::GUIEventAdapter::KEYDOWN:
   {
 switch (ea.getKey())
 {


Any help would be appreciated,

Thanks,

-M

Marlin Rowley
Software Engineer, Staff
[cid:image002.jpg@01D39374.DEC5A2E0]
Missiles and Fire Control
972-603-1931 (office)
214-926-0622 (mobile)
marlin.r.row...@lmco.com

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