Reading/writing z-Buffer

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

You're doing quite a lot inside the beginScene/endScene part, it's usually better to do things outside the render part. But besides that, I guess that you only draw the float values as colors without conversion, which won't help much. Simply because teh colors are interpreted as 8bit per color element.
tomkeus
Posts: 25
Joined: Thu Nov 12, 2009 9:50 pm

Post by tomkeus »

hybrid wrote:You're doing quite a lot inside the beginScene/endScene part, it's usually better to do things outside the render part
I know, but this is just showcasing weird behavior of near/far clipping planes.
hybrid wrote:thout conversion, which won't help much. Simply because teh colors are interpreted as 8bit per color element.
Are you trying to say that when I call for example,

Code: Select all

float data[] = {0.124, 0.456, 0.432, 0.956};

glDrawPixels(2, 2, GL_DEPTH_COMPONENT, GL_FLOAT, data)
some other values will be drawn to z-buffer? I'm not referring to how z-buffer is stored internally but if I read z-buffer back, will I get the same data I put in with 32-bit precision?
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

Most zbuffers have 24bit precision, so you won't get much more. However, I don't know which values you compare, and how. So I thought that you access the values wrongly, and interpret only parts of the values.
tomkeus
Posts: 25
Joined: Thu Nov 12, 2009 9:50 pm

Post by tomkeus »

Does anyone have anything do say about that weird near/far clipping plane behavior in program I posted?

Is it my code or Irrlicht does something weird internally?
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

If you pass in an ortho projection, you have to set the camera projection flag for ortho matrices. otherwise, really weird stuff can happen.
tomkeus
Posts: 25
Joined: Thu Nov 12, 2009 9:50 pm

Post by tomkeus »

It ain't doing the trick. Also, when perspective camera is used, near and far clipping planes settings don't seem to correspond with actual clipping.
Post Reply