You Like My Tutorials? Click The Banner To Keep 'Em Coming!

glGameDeveloper(): The Game Developer's Source for OpenGL Coding
Main Menu
Latest News
Archived News
Tutorials
Links
E-Mail Me

Other
Message Board
My Guestbook

Tutorials -- glFeedbackBuffer
 


Using glFeedbackBuffer Page 3 of 3
< Previous Jump to Page: 1 | 2 | 3 Next >

How to use glFeedbackBuffer's Feedback

After we render anything while in GL_FEEDBACK, our variable buf is updated with the new information.

  • buf[0] = extra variable (mentioned earlier), unused
  • buf[1] = X screen coordinate of the object rendered
  • buf[2] = Y screen coordinate
  • buf[3] = Z value (between 0 and 1, 0 being close to the viewer)

The Z value represents how OpenGL does Z Buffer, or Depth Testing. Since glFeedbackBuffer pretends to render things to the screen, we can see how Depth Testing actually works. What it does is, each time anything is rendered to the screen, OpenGL stores it's Depth value (between 0 and 1) and keeps track of it. Next time it has to render something to that pixel, it checks if the new pixel to be rendered has a different Z value. If the new value is greater (farther away) than the stored pixel value, it won't render the pixel. Otherwise, it renders it and stores the new value in the Depth Buffer.

That's it for this tutorial. Click here to return to the tutorials index.

Using glFeedbackBuffer Page 3 of 3
< Previous Jump to Page: 1 | 2 | 3 Next >

This site best viewed with MS Internet Explorer 5.0 at 16-bit color and at least 800x600.

All Contents of this site are Copyright 1999, 2000 Joe Zimmerman. No part of this site (code, HTML, etc.) may be reproduced without my permission.

Click Here!