COMPGROUPS.NET | Search | Post Question | Groups | Stream | About | Register

### Writing to depth buffer 147247

• Email
• Follow

Hi!

I'm writing an application which needs to write depth information to the
depth buffer. AFAIK is there no linear mapping from depth to the value, I
must write to the buffer. Therefore: How can I compute the depth
buffer-value from the depth value?

thx

Markus Doerschmidt


 0

See related articles to this posting

Markus D�rschmidt wrote:
> Hi!
>
> I'm writing an application which needs to write depth information to the
> depth buffer. AFAIK is there no linear mapping from depth to the value, I
> must write to the buffer. Therefore: How can I compute the depth
> buffer-value from the depth value?
>

It's not easy...

You could use gluProject() to generate a table
of depth values to use as a base for a table
based lookup.

--
<\___/>          For email, remove my socks.
/ O O \
\_____/  FTB.    The Cheat is not dead!


 0

On Mon, 8 Nov 2004 08:46:23 +0100, "Markus D�rschmidt"
<markus.doerschmidt@gmx.de> wrote:

>I'm writing an application which needs to write depth information to the
>depth buffer. AFAIK is there no linear mapping from depth to the value, I
>must write to the buffer. Therefore: How can I compute the depth
>buffer-value from the depth value?

Isn't it true that  that you can apply -any- monotonically increasing
mapping between  your desired value and the 'depth' you write into the
depth buffer & it will have the same effect (apart from resolution)?
Um, and-- as long as the endpoint mapping is 0.0-> 0.0 and 1.0->1.0.
I'd think that would give you enough freedom to find a linear mapping
that would do the job...

Matt Feinstein

--
There is no virtue in believing something that can be proved to be true.

 0

Matt Feinstein wrote:
> On Mon, 8 Nov 2004 08:46:23 +0100, "Markus D�rschmidt"
> <markus.doerschmidt@gmx.de> wrote:
>
>
>>I'm writing an application which needs to write depth information to the
>>depth buffer. AFAIK is there no linear mapping from depth to the value, I
>>must write to the buffer. Therefore: How can I compute the depth
>>buffer-value from the depth value?
>
>
> Isn't it true that  that you can apply -any- monotonically increasing
> mapping between  your desired value and the 'depth' you write into the
> depth buffer & it will have the same effect (apart from resolution)?
>
>

Yes, but people who do this usually want to draw
something else on the top of it.

--
<\___/>          For email, remove my socks.
/ O O \
\_____/  FTB.    The Cheat is not dead!


 0

Writing depth values with an any monotonically increasing mapping would
cause problems in drawing an object in the scene.

Is there no specification how the depth values are mapped to the depth
buffer? Does each OpenGL implementation handle this in another way?

thx
Markus


 0

Markus D�rschmidt wrote:
> Writing depth values with an any monotonically increasing mapping would
> cause problems in drawing an object in the scene.
>

Correct.

> Is there no specification how the depth values are mapped to the depth
> buffer? Does each OpenGL implementation handle this in another way?
>

They all do it the same way (I think), the
problem is that there's no nice simple formula
for it.

--
<\___/>          For email, remove my socks.
/ O O \
\_____/  FTB.    The Cheat is not dead!


 0

fungus wrote:

> Markus D�rschmidt wrote:
>
>> Writing depth values with an any monotonically increasing mapping would
>> cause problems in drawing an object in the scene.
>>
>
> Correct.
>
>> Is there no specification how the depth values are mapped to the depth
>> buffer? Does each OpenGL implementation handle this in another way?
>>
>
> They all do it the same way (I think), the
> problem is that there's no nice simple formula
> for it.

Well, there have been implementations that used a W buffer instead of a
Z buffer, and there may well be differences in how the z values are
calculated. However, since many applications rely on gluProject and
gluUnProject (or similar code), the implementations would get lots of
bug reports unless they were at least close to the "usual" calculation.

floating point or integer formats. However, my accuracy needs are fairly
low.

--
Andy V


 0

6 Replies
212 Views

Similar Articles

12/6/2013 10:09:08 AM
[PageSpeed]

Similar Artilces:

identify buffer data
Is there any way to identified how many tables and records are in DB buffer cache. On Jan 23, 12:06 pm, "Steve Robin" <ocma...@gmail.com> wrote: > Is there any way to identified how many tables and records are in DB > buffer cache. v$bh in most versions. Note you need to link the objd column to the data_object_id column in dba_objects. I guess it is too difficult and cumbersome to include your version? -- Sybrand Bakker Senior Oracle DBA On Jan 23, 6:06 am, "Steve Robin" <ocma...@gmail.com> wrote: > Is there any way to identified how many tables and records are in DB > buffer cache. You can see which tables and how many blocks or how much memory is used in the cache using v$db_object_cache; v$cache if you are running RAC. Steve Robin wrote: > Is there any way to identified how many tables and records are in DB > buffer cache. It is possible to determine what objects have blocks in the buffer cache and the number of blocks, but not number of rows contained in the blocks (at least not easily). See: http://jonathanlewis.wordpress.com/2006/11/02/but-its-in-the-manual/ Charles Hooper PC Support Specialist K&M changing height\depth of sub- and superscripts I *think* I've seen this discussed in an earlier post, but despite my better efforts, I can't seem to track it down. I'm interested in techniques/options for changing the height (for superscripts) or depth (for subscripts) from the LaTeX defaults - in other words, change (overrride) the default vertical spacing rules for sub- and superscripts. I ask because quite often, my students make mistakes on assignments by confusing what should have been subscripts as separate variables in an equation. For example,$\rho\gamma_{PH}\$. The PH product should be a subscript for \gamma, but in \cm font, if you're not paying attention when reading, it looks a lot like rho * gamma* PH. In other words, the subscript depth for {PH} isn't 'deep' enough for the reader to unambiguously see that the {PH} is a subscript. THis would be solved, I think, if I could make the subscript a bit deeper (same being true in reverse for superscripts). Suggestions? Pointers to the obvious? Thanks in advance... <cooch17@NOSPAMverizon.net> wrote: > I *think* I've seen this discussed in an earlier post, but despite my > better efforts, I can't seem to track

DeepSec In-Depth Security Conference
Top brass of hackers and IT security meet in Vienna DeepSec conference set on closing dangerous security leaks Vienna - Usually you won't find them on the same side: hackers and security specialists who fend off their attacks. Yet the security conference DeepSec, which takes place from November 11 to 14, is one of the rare events they have joined forces for. "Despite what is generally believed, hackers are not necessarily criminals. Many have made it their goal to point out potentially dangerous security leaks that need to be closed as soon as possible in everyone's interest&qu