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

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 
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 
> 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


___
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] render to a texure bound to an FBO and re-generate mipmaps every frame

2018-04-10 Thread Julius Ziegler

Hello Robert,

thank you for your reply.

I will try to put together a minimal example that people can test.

Note that I do not suspect this to be a bug in OSG at all. I assume that 
points "1" and "2" that I describe are probably the well defined, 
absolutely normal behaviour that OSG exhibits. I just hope that there is 
a work around, e.g. by exploiting the callback mechanism.


Thanks again,
Julius


On 04/10/2018 10:06 PM, Robert Osfield wrote:

Hi Julius,

There isn't much we can do to help at this stage as you don't provide
any information about the hadware, OS, driver, OSG version, all we
know is that you are using a render to texture technique and there is
some issue with mipmapping and some unspecified hardware, OS and OSG
version.  We don't have your sofftware, data or hardware configuration
to test against.

It could be a driver bug, it could be a scene graph set up issue, it
could be a data problem, it could be an OSG  bug, at this stage that's
all anyone could say with the information provided.

The most productive way for others to help would be if you could
provide a small test program that illustrates the problem so that
others can run this test on their own systems to see if problem
appears, this then should shine more light on the nature of the
problem and give us a better chance of getting a solution.  Sometimes
issues like this turn out to hardware/driver/OS specific so wider
testing can show this.  If it's a OSG bug then we can then use this a
unit test for testing any fixes that will be made.

Failing a means to tests things ourselves, the only workaround I an
suggest is to not using mipmapping on the texture you are rendering
to.

Robert.



On 10 April 2018 at 20:45, Julius Ziegler  wrote:

Dear OSG-friends,

I currently have a scene graph set up where a pre-render camera renders
content to a texture via an FBO, and the main camera uses this texture to
texture a quad with it. This works, in principle.

However I need mipmapping for that texture, and all but the 0th mipmap level
of the texture are empty.

With an apitracer, I found out that the glGenerateMipMap call happens

1. only in the first frame (but I want it to be called every frame).
2. before any draw calls towards the FBO (but I want it after the draw
calls).

I tried to inject a glGenerateMipMap via a DrawCallback which I attached to
the quad, and which just extends the original draw implementation
(glGenerateMipMap immediately before the original draw implementation).

With the apitracer, I validated that, at the position where I injected the
glGenerateMipMap

a. the correct texture is bound
b. the frame buffer is un-bound.

But glGenerateMipMap just seg'faults. Because of the seg'fault (I mean we
are all used to GL_ERRORS, but seg'faults?) I suspected a driver issue, but
I tried it on an alternative platform (one is Intel Graphics, one is Nvidia,
both on Linux). Both to the same result.

Can you please help? Maybe I overlooked a simple osg-ish way to achieve this
(maybe I just have to set something dirty()?)

Thanks!

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

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



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


Re: [osg-users] render to a texure bound to an FBO and re-generate mipmaps every frame

2018-04-10 Thread Robert Osfield
Hi Julius,

There isn't much we can do to help at this stage as you don't provide
any information about the hadware, OS, driver, OSG version, all we
know is that you are using a render to texture technique and there is
some issue with mipmapping and some unspecified hardware, OS and OSG
version.  We don't have your sofftware, data or hardware configuration
to test against.

It could be a driver bug, it could be a scene graph set up issue, it
could be a data problem, it could be an OSG  bug, at this stage that's
all anyone could say with the information provided.

The most productive way for others to help would be if you could
provide a small test program that illustrates the problem so that
others can run this test on their own systems to see if problem
appears, this then should shine more light on the nature of the
problem and give us a better chance of getting a solution.  Sometimes
issues like this turn out to hardware/driver/OS specific so wider
testing can show this.  If it's a OSG bug then we can then use this a
unit test for testing any fixes that will be made.

Failing a means to tests things ourselves, the only workaround I an
suggest is to not using mipmapping on the texture you are rendering
to.

Robert.



On 10 April 2018 at 20:45, Julius Ziegler  wrote:
> Dear OSG-friends,
>
> I currently have a scene graph set up where a pre-render camera renders
> content to a texture via an FBO, and the main camera uses this texture to
> texture a quad with it. This works, in principle.
>
> However I need mipmapping for that texture, and all but the 0th mipmap level
> of the texture are empty.
>
> With an apitracer, I found out that the glGenerateMipMap call happens
>
> 1. only in the first frame (but I want it to be called every frame).
> 2. before any draw calls towards the FBO (but I want it after the draw
> calls).
>
> I tried to inject a glGenerateMipMap via a DrawCallback which I attached to
> the quad, and which just extends the original draw implementation
> (glGenerateMipMap immediately before the original draw implementation).
>
> With the apitracer, I validated that, at the position where I injected the
> glGenerateMipMap
>
> a. the correct texture is bound
> b. the frame buffer is un-bound.
>
> But glGenerateMipMap just seg'faults. Because of the seg'fault (I mean we
> are all used to GL_ERRORS, but seg'faults?) I suspected a driver issue, but
> I tried it on an alternative platform (one is Intel Graphics, one is Nvidia,
> both on Linux). Both to the same result.
>
> Can you please help? Maybe I overlooked a simple osg-ish way to achieve this
> (maybe I just have to set something dirty()?)
>
> Thanks!
>
> Julius
> ___
> 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] What coordinate system does OSG use?

2018-04-10 Thread Robert Osfield
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 
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
>
> [image: 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
>
>
___
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 Robert Osfield
On 10 April 2018 at 20:52, Rowley, Marlin R 
wrote:

> No, I have still need the built-in matrices.  I know those get updated.
>
>
You can;t wave your arms around without telling anybody what specifically
have a problem with and I expect us to know what the problems you are and
how to answer them.

We can only guess at what you mean and point you in roughly the right
direction of what we think might be appropriate.

So please be specific about what you are looking for - tell us what data
you want to input into your shaders.

Robert.
___
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

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 
Subject: EXTERNAL: Re: [osg-users] Getting a callback to update shaders?

On 10 April 2018 at 16:55, Rowley, Marlin R 
> 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


[osg-users] render to a texure bound to an FBO and re-generate mipmaps every frame

2018-04-10 Thread Julius Ziegler

Dear OSG-friends,

I currently have a scene graph set up where a pre-render camera renders 
content to a texture via an FBO, and the main camera uses this texture 
to texture a quad with it. This works, in principle.


However I need mipmapping for that texture, and all but the 0th mipmap 
level of the texture are empty.


With an apitracer, I found out that the glGenerateMipMap call happens

1. only in the first frame (but I want it to be called every frame).
2. before any draw calls towards the FBO (but I want it after the draw 
calls).


I tried to inject a glGenerateMipMap via a DrawCallback which I attached 
to the quad, and which just extends the original draw implementation 
(glGenerateMipMap immediately before the original draw implementation).


With the apitracer, I validated that, at the position where I injected 
the glGenerateMipMap


a. the correct texture is bound
b. the frame buffer is un-bound.

But glGenerateMipMap just seg'faults. Because of the seg'fault (I mean 
we are all used to GL_ERRORS, but seg'faults?) I suspected a driver 
issue, but I tried it on an alternative platform (one is Intel Graphics, 
one is Nvidia, both on Linux). Both to the same result.


Can you please help? Maybe I overlooked a simple osg-ish way to achieve 
this (maybe I just have to set something dirty()?)


Thanks!

Julius
___
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 Robert Osfield
On 10 April 2018 at 16:55, Rowley, Marlin R 
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

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 
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

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


Re: [osg-users] [ANN] Cross-platform examples for Linux, macOS, Windows, Android, iOS, and Web

2018-04-10 Thread HITESH KUMAR SINGHAL
On Mon, 9 Apr 2018 15:01 michael kapelko,  wrote:

> Hi.
>
> TL;DR
> All hail the first cross-platform example on how to embed a binary
> resource into executable:
>
> https://github.com/OGStudio/openscenegraph-cross-platform-examples/blob/master/01.EmbedResource/README.md
>
> Lengthy explanation.
>
> Once the OpenSceneGraph cross-platform guide (
> https://ogstudio.github.io/openscenegraph-cross-platform-guide/ ) has
> been finished, I started developing a cross-platform game (
> https://ogstudio.github.io/game-mahjong/ ).
>
> Overtime I started to face different issues across platforms like
> loading resources, loading images, etc.. It became clear that I should
> share this knowledge. That's how cross-platform examples appeared:
> https://github.com/OGStudio/openscenegraph-cross-platform-examples
>
> Unlike the guide, examples are brief, don't provide videos and
> screenshots for each step. Instead, each example focuses on the
> crucial code necessary to perform a task.
>
> I would be glad to hear of any specific thing you wanted explained for
> OpenSceneGraph that might make a good addition to the examples.
> ___
> osg-users mailing list
> osg-users@lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


[osg-users] Getting 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