• FEATURED

View more

View more

View more

### Image of the Day Submit

IOTD | Top Screenshots

### The latest, straight to your Inbox.

Subscribe to GameDev.net Direct to receive the latest updates and exclusive content.

# Newbie to programming

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.

2 replies to this topic

Posted 25 December 2011 - 04:07 PM

Hello GameDev.net

I am new to game development (In the sense of programing) and I have recently chosen JAVA as my language of choice for learning programming.

I am currently starting a book called "Game Programming for the Evil Genius".

Which focuses on JAVA exclusively.

However when I finish this book I want to make a small Isometric game in Java.

I would want to use the LWJGL but I am unsure at this point.

So this is where the Questions start

What is a Z Buffer?

I have heard this term thrown around a few times when it comes to 2D games on LWJGL and I have not been able to find a clear answer.

I will have more questions when I get into the meat of the book.

Ben

### #2FXACE  Members

Posted 25 December 2011 - 05:58 PM

What is a Z Buffer?

This helps you to construct a solid 3D scene. P.S. If did you know OpenGL (and Direct3D too) is\are triangle rasterizer(s)....

EXAMPLE: (without Z - Buffer)

Lets draw 2 different triangles (where 1st triangle which is closer to viewer than 2nd triangle (which is behind of 1st triangle)) like this:

1: set up viewer;

2: translateMatrix(in z order);

3: select green color;

3: drawTriangle(); // draws a white triangle

4: translateMatrix(in z order);

3: select red color;

5: drawTriangle(); // draws a red triangle

As a result we would have a red triangle on the screen (but we expected to see a green triangle which is closer to viewer).

NOW we set a use of Z Buffer. And a result is : yes, a green triangle on the screen. (where is a red triangle ?: - behind it)

WHAT HOLDS Z BUFFER?

That holds "z" values (something like "distance from camera/eye" but produced from multiplication of matrix (mvp = ProjectionMatrix * ModelViewMatrix) and input vertex (of primitive)).

There are many references and tutorials over the internet.

Best wishes, FXACE.

Posted 25 December 2011 - 09:57 PM

What is a Z Buffer?

This helps you to construct a solid 3D scene. P.S. If did you know OpenGL (and Direct3D too) is\are triangle rasterizer(s)....

EXAMPLE: (without Z - Buffer)

Lets draw 2 different triangles (where 1st triangle which is closer to viewer than 2nd triangle (which is behind of 1st triangle)) like this:

1: set up viewer;

2: translateMatrix(in z order);

3: select green color;

3: drawTriangle(); // draws a white triangle

4: translateMatrix(in z order);

3: select red color;

5: drawTriangle(); // draws a red triangle

As a result we would have a red triangle on the screen (but we expected to see a green triangle which is closer to viewer).

NOW we set a use of Z Buffer. And a result is : yes, a green triangle on the screen. (where is a red triangle ?: - behind it)

WHAT HOLDS Z BUFFER?

That holds "z" values (something like "distance from camera/eye" but produced from multiplication of matrix (mvp = ProjectionMatrix * ModelViewMatrix) and input vertex (of primitive)).

There are many references and tutorials over the internet.

Best wishes, FXACE.

Hey thanks for the in depth explanation of what the Z Buffer is.

Really Appreciate it

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.