Discussion:
HUD with perspective
arnaud houegbelo
2008-02-19 13:18:06 UTC
Permalink
Hello,

I want to display a HUD without text but with perspective.
I used the code exemple osghud.cpp. Instead of creating
a geode with text I create a geode with a shape like sphere or
box. It woks fine. But I want to display it with a perspective.
When I create the osg::Camera instead of using ortho2D projection
I want to use perspective or frustnum projection.

In osghud.cpp

- camera->setProjectionMatrix(osg::Matrix::ortho2D(0,1280,0,1024));

I tried to use a perspective like

- camera->setProjectionMatrixAsPerspective(50.0, 1.0, 1.0, 1000.0); or
- camera->setProjectionMatrix(osg::Matrix::perspective(50.0,aspectRatio,1.0,1000.0));

but my object disapear.

It is possible to display an object like HUD (on the front of the scene) with perspective?

Best regards
Arnaud


____________________________________________________________________________________
Looking for last minute shopping deals?
Find them fast with Yahoo! Search. http://tools.search.yahoo.com/newsearch/category.php?category=shopping
Robert Osfield
2008-02-19 13:23:49 UTC
Permalink
Hi Arnuad,

You'll need to specify a view matrix for the camera to position the
view frustum over the part of the HUD scene you want.

Robert.
Post by arnaud houegbelo
Hello,
I want to display a HUD without text but with perspective.
I used the code exemple osghud.cpp. Instead of creating
a geode with text I create a geode with a shape like sphere or
box. It woks fine. But I want to display it with a perspective.
When I create the osg::Camera instead of using ortho2D projection
I want to use perspective or frustnum projection.
In osghud.cpp
- camera->setProjectionMatrix(osg::Matrix::ortho2D(0,1280,0,1024));
I tried to use a perspective like
- camera->setProjectionMatrixAsPerspective(50.0, 1.0, 1.0, 1000.0); or
- camera->setProjectionMatrix(osg::Matrix::perspective(50.0,aspectRatio,1.0,1000.0));
but my object disapear.
It is possible to display an object like HUD (on the front of the scene) with perspective?
Best regards
Arnaud
____________________________________________________________________________________
Looking for last minute shopping deals?
Find them fast with Yahoo! Search. http://tools.search.yahoo.com/newsearch/category.php?category=shopping
_______________________________________________
osg-users mailing list
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
arnaud houegbelo
2008-02-19 13:31:28 UTC
Permalink
Hi Robert,

Many Thanks for your answer but can you give me a small code exemple?

Best Regards
Arnaud


____________________________________________________________________________________
Never miss a thing. Make Yahoo your home page.
http://www.yahoo.com/r/hs
Robert Osfield
2008-02-19 13:40:14 UTC
Permalink
Post by arnaud houegbelo
Hi Robert,
Many Thanks for your answer but can you give me a small code exemple?
How long is a piece of string?

What is the sound of one hand clapping?

Both questions one can't really answer... and code example that does
what? Just set the view matrix, or set the view matrix to exactly what
you require? I suspect that later, but since I know nothing about the
position and size of the scene that you wish to frame there is no way
I can provide an answer.

If the former then just do a search for setViewMatrix in examples/*/*.cpp.

Robert.
arnaud houegbelo
2008-02-19 13:58:58 UTC
Permalink
Many Thanks for the funny answer :)

I knwo that I must use setViewMatrix(), but I already
tried to use it with a perpective matrix with no good result.
But perhaps my parameter are wrong. But if you said that
I can use the osghud.cpp exemple and apply a view matrix
on the camera is going to be fine, I'm going to tried it. It could
be useful to have a osghud code exemple with perpective.

Best regards,

Arnaud


____________________________________________________________________________________
Looking for last minute shopping deals?
Find them fast with Yahoo! Search. http://tools.search.yahoo.com/newsearch/category.php?category=shopping
Per Rosengren
2008-02-19 15:37:41 UTC
Permalink
You have to set both the view matrix and the projection matrix of the
camera.

The view matrix is the pose of the scene coordinate system in the camera
coordinate system.
Use

void setViewMatrixAsLookAt (const osg::Vec3 &eye, const osg::Vec3
&center, const osg::Vec3 &up)

and provide it with the position for the camera (eye) and your HUD
object (center), and the vector that points in the up direction of the
HUD (up), all un the scene coordinate system.

The projection matrix sets the projection from 3d to 2d. Use

void setProjectionMatrixAsPerspective (double fovy, double aspectRatio,
double zNear, double zFar)
Post by arnaud houegbelo
Hello,
I want to display a HUD without text but with perspective.
I used the code exemple osghud.cpp. Instead of creating
a geode with text I create a geode with a shape like sphere or
box. It woks fine. But I want to display it with a perspective.
When I create the osg::Camera instead of using ortho2D projection
I want to use perspective or frustnum projection.
In osghud.cpp
- camera->setProjectionMatrix(osg::Matrix::ortho2D(0,1280,0,1024));
I tried to use a perspective like
- camera->setProjectionMatrixAsPerspective(50.0, 1.0, 1.0, 1000.0); or
- camera->setProjectionMatrix(osg::Matrix::perspective(50.0,aspectRatio,1.0,1000.0));
but my object disapear.
It is possible to display an object like HUD (on the front of the scene) with perspective?
Best regards
Arnaud
____________________________________________________________________________________
Looking for last minute shopping deals?
Find them fast with Yahoo! Search. http://tools.search.yahoo.com/newsearch/category.php?category=shopping
_______________________________________________
osg-users mailing list
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
arnaud houegbelo
2008-02-19 16:19:34 UTC
Permalink
Hi Robert,

In the code exemple osghud.cpp we have the possibility to avoid to the
camera to grab the event of the main camera viewers with
camera->setAllowEventFocus(false); I want that my HUD oject
use my trackball event for dipslay (eg if I make rotation the HUD follow the
trackball rotation). I used this function like this camera->setAllowEventFocus(true);
but the HUD object don't follow the trackball. Do you have any idea ?

regards
Arnaud


____________________________________________________________________________________
Never miss a thing. Make Yahoo your home page.
http://www.yahoo.com/r/hs
Robert Osfield
2008-02-19 16:42:12 UTC
Permalink
Post by arnaud houegbelo
In the code exemple osghud.cpp we have the possibility to avoid to the
camera to grab the event of the main camera viewers with
camera->setAllowEventFocus(false); I want that my HUD oject
use my trackball event for dipslay (eg if I make rotation the HUD follow the
trackball rotation). I used this function like this camera->setAllowEventFocus(true);
but the HUD object don't follow the trackball. Do you have any idea ?
No.

Robert.
arnaud houegbelo
2008-02-19 16:59:01 UTC
Permalink
Many thanks for your answer Per Rosengren,
I tried it and it works fine. Sorry, but I forgot to use
the Look at function.

Many thanks

Best Regards
Arnaud
Post by Per Rosengren
You have to set both the view matrix and the projection matrix of the
camera.
The view matrix is the pose of the scene coordinate system in the camera
cordinate system.
Use
void setViewMatrixAsLookAt (const osg::Vec3 &eye, const osg::Vec3
&center, const osg::Vec3 &up)
and provide it with the position for the camera (eye) and your HUD
object (center), and the vector that points in the up direction of the
HUD (up), all un the scene coordinate system.
The projection matrix sets the projection from 3d to 2d. Use
void setProjectionMatrixAsPerspective (double fovy, double aspectRatio,
double zNear, double zFar)
____________________________________________________________________________________
Looking for last minute shopping deals?
Find them fast with Yahoo! Search. http://tools.search.yahoo.com/newsearch/category.php?category=shopping
Guy
2008-02-20 13:00:30 UTC
Permalink
Yes, that can be cool "Star Wars"-like text effect!!
The force is strong with this one...


-----Original Message-----
From: osg-users-bounces-***@public.gmane.org
[mailto:osg-users-bounces-***@public.gmane.org] On Behalf Of arnaud
houegbelo
Sent: Tuesday, February 19, 2008 3:59 PM
To: osg-users-***@public.gmane.org
Subject: [osg-users] HUD with perspective

Many Thanks for the funny answer :)

I knwo that I must use setViewMatrix(), but I already
tried to use it with a perpective matrix with no good result.
But perhaps my parameter are wrong. But if you said that
I can use the osghud.cpp exemple and apply a view matrix
on the camera is going to be fine, I'm going to tried it. It could
be useful to have a osghud code exemple with perpective.

Best regards,

Arnaud



________________________________________________________________________
____________
Looking for last minute shopping deals?
Find them fast with Yahoo! Search.
http://tools.search.yahoo.com/newsearch/category.php?category=shopping
Kremser, Andreas (Praktikant)
2008-02-20 13:23:51 UTC
Permalink
hi,

is there a possibilty to store/restore the current server/clientstates
besides glgetIntegerv() and glPushClient/ServerAttrib?
"opengl es" does not provide these functions.

if for example a normal array is set in a function - and another
function called after this is not using normal arrays - then these
should be disabled after their use.

Or will osgES always have to keep track off the current states by
itself?

thanks,

andi

*******************************************
Diese E-Mail enthaelt vertrauliche und/oder rechtlich geschuetzte Informationen. Wenn Sie nicht der richtige Adressat sind oder diese E-Mail irrtuemlich erhalten haben, informieren Sie bitte sofort den Absender und loeschen Sie diese Mail. Das unerlaubte Kopieren sowie die unbefugte Weitergabe dieser Mail ist nicht gestattet.

This e-mail may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error) please notify the sender immediately and delete this e-mail. Any unauthorized copying, disclosure or distribution of the contents in this e-mail is strictly forbidden.
*******************************************
Robert Osfield
2008-02-20 13:41:51 UTC
Permalink
Hi Andi,

On Feb 20, 2008 1:23 PM, Kremser, Andreas (Praktikant)
Post by Kremser, Andreas (Praktikant)
hi,
is there a possibilty to store/restore the current server/clientstates
besides glgetIntegerv() and glPushClient/ServerAttrib?
"opengl es" does not provide these functions.
osg::State is used to track OpenGL state including the client state,
so you can use this.
Post by Kremser, Andreas (Praktikant)
if for example a normal array is set in a function - and another
function called after this is not using normal arrays - then these
should be disabled after their use.
Or will osgES always have to keep track off the current states by
itself?
It might be that more state tracking needs to be put into osg::State
to help out with the OpenGL ES, but not being really familiar with
OpenGL ES yet, and not knowing what precise problems you are hitting
up against I can't really say beyond point you in the direction of
osg::State as the object for tracking a graphics contexts current
state.

Robert.
Kremser, Andreas (Praktikant)
2008-02-20 13:54:47 UTC
Permalink
thanks - i completely overlooked that :)
-----Ursprüngliche Nachricht-----
von Robert Osfield
Gesendet: Mittwoch, 20. Februar 2008 14:42
An: OpenSceneGraph Users
Betreff: Re: [osg-users] osg es : store/restore states
Hi Andi,
On Feb 20, 2008 1:23 PM, Kremser, Andreas (Praktikant)
Post by Kremser, Andreas (Praktikant)
hi,
is there a possibilty to store/restore the current
server/clientstates
Post by Kremser, Andreas (Praktikant)
besides glgetIntegerv() and glPushClient/ServerAttrib?
"opengl es" does not provide these functions.
osg::State is used to track OpenGL state including the client
state, so you can use this.
Post by Kremser, Andreas (Praktikant)
if for example a normal array is set in a function - and another
function called after this is not using normal arrays - then these
should be disabled after their use.
Or will osgES always have to keep track off the current states by
itself?
It might be that more state tracking needs to be put into
osg::State to help out with the OpenGL ES, but not being
really familiar with OpenGL ES yet, and not knowing what
precise problems you are hitting up against I can't really say
beyond point you in the direction of osg::State as the object
for tracking a graphics contexts current state.
Robert.
_______________________________________________
osg-users mailing list
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscen
egraph.org
*******************************************
Diese E-Mail enthaelt vertrauliche und/oder rechtlich geschuetzte Informationen. Wenn Sie nicht der richtige Adressat sind oder diese E-Mail irrtuemlich erhalten haben, informieren Sie bitte sofort den Absender und loeschen Sie diese Mail. Das unerlaubte Kopieren sowie die unbefugte Weitergabe dieser Mail ist nicht gestattet.

This e-mail may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error) please notify the sender immediately and delete this e-mail. Any unauthorized copying, disclosure or distribution of the contents in this e-mail is strictly forbidden.
*******************************************

Loading...