Z-Buffering manual calculation

Hi guys!

Now I'm working at a 3D ASCII graphics library from scratch(sounds interesting not?).
Here's what I've done:
-projecting a 3d point on the screen
-displaying filled/wireframe triangles
-lighting (flat shading)
-Z-buffering - STUCK

All I need is a function like that
double getZ(double x1,double y1,double z1,
double x2,double y2,double z2,
double x3,double y3,double z3,
int screenx,int screeny) // 0<=screenx<=80 and 0<=screeny<=25
{
[...]
}

NOTE:
-I don't want to use any library such as OpenGL or DirectX
-I don't want to do the z-buffering calculation using a projection matrix. Just a triangle and screen coordinates.

PLS answer as soon as you can
Pls faster
Read this Pages:

https://www.scratchapixel.com/lessons/3d-basic-rendering/computing-pixel-coordinates-of-3d-point/mathematics-computing-2d-coordinates-of-3d-points

https://www.opengl.org/discussion_boards/showthread.php/135581-How-does-OpenGL-project-a-3D-point-to-screen

https://www.opengl.org/discussion_boards/showthread.php/130033-Getting-2D-to-3D

first you must read and find how the OpenGL implement it, for example from this Reference

https://www.opengl.org/resources/libraries/glut/spec3/spec3.html

search to find corresponding Function in OpenGl

if not lead to answer
at last i think you must use assembly to draw line as i write some simple 8086 Graphic in college.
feel free to any question.
Last edited on
Topic archived. No new replies allowed.