[Mesa3d-users] Normalized Device Coordinates From: John Prudden - 2000-06-30 17:01:53 ```Hi Everyone, I am writing a driver for a specific piece of hardware. My sticking point has been the Normalized Device Coordinates (ndc). Lets say my hardware running at 640x480 frame and z-buffer. It has a 32 bit Z-buffer so z is expected from 0 to 2^32 and the X and Y have to be between say 0 and 16383(14 bits). If I have a point in my world coordinates that falls at (-1,-1,1) where and how in Mesa 3.2 does that point get transformed to ndc and is there any specific values I need to set to have them come out right. I know there is a #define DEPTH_BITS in config.h that tells how many bits we have for the Z-buffer but what about the X and Y restrictions. Does the transformation happen with the WindowMap matrix? If so I guess I need to set the scale and translation values or is it set properly with glViewport and I need to change something else? Also it seems that if I have a point in the world coordinates that is 1 in z it gets transformed to the max z value and if it is at 2 it gets transformed to max z * 1.5. This is coming from the transformation in do_vertex_pipeline. Im guessing this is because openGL z coordinates run from [0,1] and they are not getting transformed correctly somewhere else. Well any help is much appreciated and I'm sorry its kind of long and sorry if this has been addressed before. If so it has please just point me to the place I can read the answer. John Prudden ```
 [Mesa3d-users] Normalized Device Coordinates From: John Prudden - 2000-06-30 17:01:53 ```Hi Everyone, I am writing a driver for a specific piece of hardware. My sticking point has been the Normalized Device Coordinates (ndc). Lets say my hardware running at 640x480 frame and z-buffer. It has a 32 bit Z-buffer so z is expected from 0 to 2^32 and the X and Y have to be between say 0 and 16383(14 bits). If I have a point in my world coordinates that falls at (-1,-1,1) where and how in Mesa 3.2 does that point get transformed to ndc and is there any specific values I need to set to have them come out right. I know there is a #define DEPTH_BITS in config.h that tells how many bits we have for the Z-buffer but what about the X and Y restrictions. Does the transformation happen with the WindowMap matrix? If so I guess I need to set the scale and translation values or is it set properly with glViewport and I need to change something else? Also it seems that if I have a point in the world coordinates that is 1 in z it gets transformed to the max z value and if it is at 2 it gets transformed to max z * 1.5. This is coming from the transformation in do_vertex_pipeline. Im guessing this is because openGL z coordinates run from [0,1] and they are not getting transformed correctly somewhere else. Well any help is much appreciated and I'm sorry its kind of long and sorry if this has been addressed before. If so it has please just point me to the place I can read the answer. John Prudden ```