Jump to content

  • Log In with Google      Sign In   
  • Create Account

We're offering banner ads on our site from just $5!

1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


Using glDrawPixels and GL_DEPTH_COMPONENT


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
1 reply to this topic

#1 d9930380   Members   -  Reputation: 122

Like
Likes
Like

Posted 24 July 2001 - 10:55 PM

I want to load a photographic background and depth information into the Color Buffer and the Depth Buffer however I seem to be having a problem with the depth buffer so I just tried the easiest thing I could test.

int size = pDepth->GetWidth() * pDepth->GetHeight();
float* zBuffer = new float[size];
for( int i=0; i zBuffer = 0.0f; // At The beginning

glColorMask( GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE );
{
glDrawPixels( pDepth->GetWidth(),
pDepth->GetHeight(),
GL_DEPTH_COMPONENT,
GL_FLOAT,
zBuffer );
}
glColorMask( GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE );
delete[] zBuffer;
glFlush();

Now when I draw an object with glDepthFunc( GL_LESS ); I shouldn''t see any objects, right ?

Well I do, so can anyone help me out in finding a simple sample that does something similar.

Oh, as these are "slow" commands. I have assumed that when I come to optimizing I can use glCopyPixels to blt between video memory requiring no conversion and no transfer over bus.
Therefore being quick as the background and the depth info doesn''t change.

Is this correct also?

Thanks.


Sponsor:

#2 d9930380   Members   -  Reputation: 122

Like
Likes
Like

Posted 25 July 2001 - 07:06 AM

WTF

I finnaly sorted it out.

It appears you have to:

glEnable( GL_DEPTH_TEST );

before the call:

glDrawPixels( pDepth->GetWidth(),
pDepth->GetHeight(),
GL_DEPTH_COMPONENT,
GL_FLOAT,
zBuffer );

Why, and where is this written.

Arrrrgggghhhh :-)




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS