Re: Identifying pixels



Athanasios Mantes wrote:
Hi all,

I have a 3d scene with various objects rendered, and I'm trying to do the following: render a small tooltip that shows the distance of the camera to the point in 3d space that corresponds to the pixel the mouse points. I know that I have to get the z buffer for the pixel, use gluUnproject etc, but my problem is this: since moving the mouse doesn't cause the scene to re-render, I can't get the z buffer value for an arbitrary pixel, without rendering the scene first, and reading the depth component pixel value for the specific pixel. Of course, rendering the scene for every mouse move is not desired (as many of you pointed out in a previous post), but I don't see another way, and reading the depth value for all pixels, is slow.


Why can't you read the depth buffer more than once (ie. without re-rendering)?

--
<\___/>
/ O O \
\_____/  FTB.    For email, remove my socks.

In science it often happens that scientists say, 'You know
that's a really good argument; my position is mistaken,'
and then they actually change their minds and you never
hear that old view from them again.  They really do it.
It doesn't happen as often as it should, because scientists
are human and change is sometimes painful.  But it happens
every day.  I cannot recall the last time something like
that happened in politics or religion.

- Carl Sagan, 1987 CSICOP keynote address

.



Relevant Pages

  • Identifying pixels
    ... I have a 3d scene with various objects rendered, and I'm trying to do the following: render a small tooltip that shows the distance of the camera to the point in 3d space that corresponds to the pixel the mouse points. ... I know that I have to get the z buffer for the pixel, use gluUnproject etc, but my problem is this: since moving the mouse doesn't cause the scene to re-render, I can't get the z buffer value for an arbitrary pixel, without rendering the scene first, and reading the depth component pixel value for the specific pixel. ... Of course, rendering the scene for every mouse move is not desired, but I don't see another way, and reading the depth value for all pixels, is slow. ...
    (comp.graphics.api.opengl)
  • Re: Pixels Coordinates to World ones (Newbie question)
    ... through that pixel. ... you can pass into gluUnProject, too, giving you the 3D world coordinates. ... overhead of rendering the scene). ...
    (comp.graphics.api.opengl)
  • Re: Identifying pixels
    ... I know that I have to get the z buffer for the pixel, ... >>> for an arbitrary pixel, without rendering the scene first, and reading ...
    (comp.graphics.api.opengl)
  • Re: Identifying pixels
    ... I have a 3d scene with various objects rendered, and I'm trying to do the following: render a small tooltip that shows the distance of the camera to the point in 3d space that corresponds to the pixel the mouse points. ... I know that I have to get the z buffer for the pixel, use gluUnproject etc, but my problem is this: since moving the mouse doesn't cause the scene to re-render, I can't get the z buffer value for an arbitrary pixel, without rendering the scene first, and reading the depth component pixel value for the specific pixel. ... Of course, rendering the scene for every mouse move is not desired, but I don't see another way, and reading the depth value for all pixels, is slow. ...
    (comp.graphics.api.opengl)
  • Re: OpenGL Optimization and Lighting
    ... scene lacks a certain realism. ... Even if it isn't (eg. with software rendering), ... triangles is giving you performance problems, you need to back up and write ...
    (comp.graphics.api.opengl)