Jump to content

  • Log In with Google      Sign In   
  • Create Account

Awesome job so far everyone! Please give us your feedback on how our article efforts are going. We still need more finished articles for our May contest theme: Remake the Classics

Limedark

Member Since 14 Aug 2011
Offline Last Active Mar 04 2012 07:06 AM
-----

Topics I've Started

Rendering the depth buffer?

03 March 2012 - 02:25 PM

Well, the question is very simple, so I hope that the answer might also be (I am going for "glass half full" mentality): I want to see my OpenGL graphics rendered not by their color or textures, but by their z-buffer value. I.e. closer pixels are darker, distant are brighter (or vice versa if easier). Like this image from Wikipedia: http://en.wikipedia....le:Z_buffer.svg (the lower one, of course). I already have the code to draw the things I want, but it draws it in color and textures. I want to see the Z-buffer instead.

What are my options?

PBuffer Alpha

22 August 2011 - 12:38 PM

(Edit: No worry, I found the answer. And the answer is "I'm dumb" :-P I'll see if I can delete this silly question and save face :-D )

Hello, I came to this place from Neon Helium's excellent lessons/tutorials, and if someone here can help me even a fraction of how much the NeHe page has, I will be forever grateful, and humbled :-)

I am dabbling with one of the few non-NeHe sources I have located for a project of mine. It deals with PBuffers: http://www.codesampl...rc/oglsrc_7.htm (I use the version #1 code they have).

I have made it work, and it works rather nicely, but a problem remains: When I use my dynamically updated texture (the one that is derived from the pbuffer), the alpha background becomes non-alpha, a flat surface using the color of the window (i.e. not the pbuffer) for background. If I reduce pbuffer glClearColor's alpha, it simply blends the two set background colors together, it does _not_ make the dynamic texture transparent :-( All other texture alphas work without any problems. It's only the dynamic texture, and I do not know why...

I will spare you the entirety of my setup, but this is the basic settings for the main window:

	glEnable(GL_TEXTURE_2D);
	glShadeModel(GL_SMOOTH);
	glClearColor(0.5f, 0.75f, 1.0f, 0.0f);
	glClearDepth(1.0f);
	glEnable(GL_DEPTH_TEST);
	glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
	glEnable(GL_BLEND);
	glDepthFunc(GL_LEQUAL);
	glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);
... and this is what the pbuffer works with:
	glEnable(GL_TEXTURE_2D);
	glShadeModel(GL_SMOOTH);
	glClearColor(1.0f, 1.0f, 1.0f, 0.4f);
	glClearDepth(1.0f);
	glEnable(GL_DEPTH_TEST);
	glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
	glEnable(GL_BLEND);
	glDepthFunc(GL_LEQUAL);
	glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);
I'm not skilled enough to do anything more elegant, but it has taken me pretty far, and I would love it if something or someone could let me go farther, by helping me enable dynamic texture transparency!

For anything you may think, thanks in advance :-)

Small problem with the lessons (all of them, I think)

14 August 2011 - 03:18 PM

I'm a big fan, and happy to see the site is still active, considering how long these lessons have been my guiding C++ light!

One thing, people who use Dev-C++ get a 404 when clicking lesson download. Seems a pesky "/data/lessons/" got pasted in between 'de' and 'vc' in the whole bunch :)

Also, would you consider having the lesson names appear when mouseovering the list on the main page? That was a really great feature of the old site. Other than that, you guys/gals rock, bigtime ;D

Limedark

PARTNERS