about overlay and queries

Anything and everything that's related to OGRE or the wider graphics field that doesn't fit into the other forums.
Post Reply
idhan
Halfling
Posts: 83
Joined: Mon Dec 10, 2007 2:51 pm

about overlay and queries

Post by idhan » Wed Jan 09, 2008 5:43 pm

Hi,

I'm 100% new on agre and basically I'm moving an opengl application to ogre to get easily shadows effects. I have read about the 2D possibilities of ogre with overlay elements, unfortunately all the documentation I have read point me to CEGUI but I don't want to use this library. So I have a couple of question:

1. Can I put any type of image (such as icon with alpha channels) into an overlay element?
2. If I execute a query when the mouse is upon a 2D overlay element, is the 2D element detected? or only the 3D element behind?
3. If 2=true, which query should be? Ray-Type?

Thanks in advance...
0 x

User avatar
xavier
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 9481
Joined: Fri Feb 18, 2005 2:03 am
Location: Dublin, CA, US

Post by xavier » Wed Jan 09, 2008 6:09 pm

You "put images in an overlay" via materials, which use textures, which are loaded by the Freeimage library (plus Ogre's DXT implementation), so you can put anything that Freeimage understands in a texture. The list of supported formats is enumerated in Ogre.log when Ogre starts up.

Scene queries return only movables and world fragments -- since Overlay is neither, it would not be returned.
0 x
Do you need help? What have you tried?

Image

Angels can fly because they take themselves lightly.

idhan
Halfling
Posts: 83
Joined: Mon Dec 10, 2007 2:51 pm

Post by idhan » Wed Jan 09, 2008 6:34 pm

Hi Xavier,

thanks for you help in advance.

So far on opengl after you render 3D scene, you can render 2D element creating new viewport with a fixed camera (of course without cleaning the current render buffer). The results is a combination of 3D and 2D elements and if you make the opengl "query" you can detect any element behind the mouse position independently if was render on the first or second render process. My question is:

How can I achieve the same with ogre?

thanks.
0 x

User avatar
xavier
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 9481
Joined: Fri Feb 18, 2005 2:03 am
Location: Dublin, CA, US

Post by xavier » Wed Jan 09, 2008 7:00 pm

You don't in Ogre -- Overlays are different than movable objects.
0 x
Do you need help? What have you tried?

Image

Angels can fly because they take themselves lightly.

idhan
Halfling
Posts: 83
Joined: Mon Dec 10, 2007 2:51 pm

Post by idhan » Wed Jan 09, 2008 7:04 pm

I understood that Overlays are different than movable objects, the question is:

How can I archive the same idea with ogre, if isn't with overlays which one is the way??

thanks.
0 x

User avatar
xavier
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 9481
Joined: Fri Feb 18, 2005 2:03 am
Location: Dublin, CA, US

Post by xavier » Wed Jan 09, 2008 8:04 pm

It sounds as if you are trying to use Overlays for a UI solution? Don't -- the reason that you see everyone telling you to use an external library for UI is because Ogre Overlays are not suited for interactive user interface tasks. There is no hit-testing, for one. If you want hit-testing (and it sounds like you do) then you have to implement it yourself.

If this is not the intent, then please educate us so we can offer better assistance.
0 x
Do you need help? What have you tried?

Image

Angels can fly because they take themselves lightly.

idhan
Halfling
Posts: 83
Joined: Mon Dec 10, 2007 2:51 pm

Post by idhan » Wed Jan 09, 2008 8:47 pm

I am not in the move to create an UI solution, actually my question correspond to a normal feature for 3D APIs (at least it is possible in populars 3D APIs such as Opengl and DirectX). Of course Ogre offers a higher level of 3D features, that's way I thought the answer should be there just that I'm to new ogre to know it.

To create my own solution in combination with ogre means a lot of work and time, unfortunately I lack of time due to other projects.

Thanks for you time and advices.
0 x

User avatar
xavier
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 9481
Joined: Fri Feb 18, 2005 2:03 am
Location: Dublin, CA, US

Post by xavier » Wed Jan 09, 2008 8:54 pm

OpenGL and Direct3D do not provide ray scene queries, which is the focus of your question as I understand it: "can I get a hit on overlay elements in a ray scene query?"
2. If I execute a query when the mouse is upon a 2D overlay element, is the 2D element detected? or only the 3D element behind?
The answer is "only the 3D objects in the scene are returned from a scene manager query", and if you are trying to say that Direct3D and OpenGL give you ray scene queries, then I am afraid I do not believe you.

If you would explain what it is you actually want to do, we can probably tell you how to do it, but if you continue to speak in obtuse terms, then we will just wish you good luck with whatever it is you are working on.
0 x
Do you need help? What have you tried?

Image

Angels can fly because they take themselves lightly.

idhan
Halfling
Posts: 83
Joined: Mon Dec 10, 2007 2:51 pm

Post by idhan » Wed Jan 09, 2008 9:06 pm

I am a bit confuse, because I didn't say opengl execute Ray-queries.
Actually I use the word query as; "query" as an analogy to ogre
documentation. I did say you can detect any render object using
opengl with the mouse coordinate, furthermore, everything I wrote
about ray-queries were questions, not affirmations.

So, you are right, opengl doesn't provide this feature.

If I "speak in obtuse terms" you don't have to answer my question, actually I will appreciate it, if your answers are in such terms. Thanks for "then we will just wish you good luck with whatever it is you are working on."

I wish you the same...
0 x

User avatar
xavier
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 9481
Joined: Fri Feb 18, 2005 2:03 am
Location: Dublin, CA, US

Post by xavier » Wed Jan 09, 2008 10:06 pm

idhan wrote:I did say you can detect any render object using
opengl with the mouse coordinate,
Glut and GL are different concepts. One builds on top of the other; it's not correct to say that "GL lets me do screen-space hit testing" because it doesn't.

It is rather an important thing, especially in a persistent, text-based context such as forums, to be precise about what you mean and what you are saying, because the people who are going to look at your questions don't know you, or what you are working on, and have no other context on which to base an answer other than the exact words you type here.

I'm sorry if you think I'm being an ass, but from my perspective on the conversation, you've changed what you have said, and what you are asking, multiple times so far.

Ogre does not provide screen-space hit-testing. Does that answer your question?
0 x
Do you need help? What have you tried?

Image

Angels can fly because they take themselves lightly.

idhan
Halfling
Posts: 83
Joined: Mon Dec 10, 2007 2:51 pm

Post by idhan » Wed Jan 09, 2008 10:37 pm

Glut, why now is glut on this subject?

Opengl does let you do "screen-space hit testing"
if that is the right name for what I have explain.
I have done it my self so I am sure about it (and glut
doesn't have anything to do whit that). Actually for
me is very normal that a 3D-API that let you render a X
object (3D or 2D), should give you the possibility to
make a "hit testing" on the same X object (well if you
can do it on opengl I am not the only one how thing
the same).

I don't thing you are an ass, so relax.

I got that "Ogre does not provide screen-space hit-testing",
and I wrote "Thanks for you time and advices." few replies
ago.

My question it was directly and specific and from my point
of view doesn't need more details to understand it, but (again)
if isn't that way for you (at this point is very clear) you don't
need to reply anything.

So, that is clear for you and me, I did get that "ogre doesn't
provide the feature I ask for".

Finally, again thanks for you time, take it easy because I really
don't thing you are an ass or anything like that, Actually I thing
you are a collaborative person, perhaps too temperamental in
everything you are very involve, but nothing else.

best greetings.
Last edited by idhan on Tue Mar 24, 2009 10:27 pm, edited 2 times in total.
0 x

User avatar
xavier
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 9481
Joined: Fri Feb 18, 2005 2:03 am
Location: Dublin, CA, US

Post by xavier » Thu Jan 10, 2008 1:09 am

Ok, sorry, I see what you are saying.

No, Ogre does not provide this because it's GL-specific. If something is not available in both GL and Direct3D, it likely will not end up in the Ogre API.
0 x
Do you need help? What have you tried?

Image

Angels can fly because they take themselves lightly.

User avatar
nullsquared
Old One
Posts: 3245
Joined: Tue Apr 24, 2007 8:23 pm
Location: NY, NY, USA

Post by nullsquared » Thu Jan 10, 2008 1:21 am

Can't you just fake what you're trying to do?

As in, make a ManualObject with 4 vertices. Put a material on it. Disable depth writing or testing on it. Use an orthographic projection matrix for it specifically, and just sync it every from to "in front" of the camera. Now you have an object that is always above everything and ray-query-able.
0 x

idhan
Halfling
Posts: 83
Joined: Mon Dec 10, 2007 2:51 pm

Post by idhan » Thu Jan 10, 2008 11:17 am

Hi nullsquared,

Thanks a lot, you information give me the direction to search for.

I am thinking in bay the ogre-book, do you know if there is
information about how to create ManualObjet, disable depth test
and so on??

Thanks again.
0 x

User avatar
nullsquared
Old One
Posts: 3245
Joined: Tue Apr 24, 2007 8:23 pm
Location: NY, NY, USA

Post by nullsquared » Thu Jan 10, 2008 12:17 pm

The manual: http://www.ogre3d.org/docs/manual/
Materials in the manual: http://www.ogre3d.org/docs/manual/manual_14.html#SEC23
You'll want to look at the "pass" section on there, specifically for depth_write and depth_test.

Manual object creation: http://www.ogre3d.org/docs/api/html/cla ... Managera33
Manual object: http://www.ogre3d.org/docs/api/html/cla ... bject.html

Just read up on the tutorials to get groovy with Ogre in general, and then the above stuff should just make sense. Also, look at the example applications.
0 x

idhan
Halfling
Posts: 83
Joined: Mon Dec 10, 2007 2:51 pm

Post by idhan » Fri Jan 25, 2008 6:19 pm

Hi nullsquared,

I have walked from the theory to the practical thing. I have achieved partially you last replay:
make a ManualObject with 4 vertices. Put a material on it. Disable depth writing or testing on it. Use an orthographic projection matrix for it specifically, and just sync it every from to "in front" of the camera. Now you have an object that is always above everything and ray-query-able.
You'll want to look at the "pass" section on there, specifically for depth_write and depth_test.
I have found in the documentation the orthographic projection only for a camera and not only for a single object, also, even when I know how to disable the dept_write, I can't find depth_test on the documentation.

definitively I don't see the light :P , can you help me ??

thanks
0 x

banal
Halfling
Posts: 59
Joined: Tue Jan 22, 2008 11:06 am

Post by banal » Fri Jan 25, 2008 9:01 pm

Hi.
Well, i guess the orthographic projection in combination with a plane mesh would be a working solution. But why do you need to query it with a ray? If you're going for a rectangle shaped object you could as well use overlays and check the coordinates and mouse-position. Couldn't you?
If you want a simple Menu or clickable Element without using a GUI Library, this should work for you.
0 x

User avatar
nullsquared
Old One
Posts: 3245
Joined: Tue Apr 24, 2007 8:23 pm
Location: NY, NY, USA

Post by nullsquared » Fri Jan 25, 2008 9:54 pm

idhan wrote: I have found in the documentation the orthographic projection only for a camera and not only for a single object,
I remember there was a way to use a special matrix for certain objects... for now, just try it with a usual camera.
idhan wrote:also, even when I know how to disable the dept_write, I can't find depth_test on the documentation.
http://www.ogre3d.org/docs/api/html/cla ... 1_1Passa62
Or just in a material script:

Code: Select all

// in a pass {}
depth_check false
0 x

Post Reply