• Advertisement

Limedark

Member
  • Content count

    7
  • Joined

  • Last visited

Community Reputation

100 Neutral

About Limedark

  • Rank
    Newbie
  1. OpenGL Rendering the depth buffer?

    [quote name='swiftcoder' timestamp='1330823583' post='4919034'] You should just just be able to allocate a texture with an internal format of GL_DEPTH_COMPONENT, and call glCopyTexSubImage2D to copy the contents of the depth buffer into that texture. After that, you can render a fullscreen quad with the texture, or whatever else you want...[/quote] This looks like exactly what I was thinking. However, I cannot find the proper code for it, and I fear guessing it from scratch will end in utter failure (I am not a veteran). Is there an example or perhaps even a tutorial of this exact method somewhere? [quote]However, unless you are restricted to an ancient version of OpenGL, I would recommend using an FBO (Frame Buffer Object), to render the depth buffer directly to a texture in the first place. Or even a shader, to render the z coordinate into the colour buffer, and save having to render multiple passes at all. [/quote] Partly due to my not being veteran, but also because of a long and boring story about what I'm doing (which I'll spare you), I would like to at least try without FBOs or shaders first, if there is a way?
  2. OpenGL Rendering the depth buffer?

    The buffer copy or swap is something I've looked at, but found no syntax on. If anyone has the slightest thread on this, I'm all ears! The fog is not going to do it, since it is not just to fake the look, it's an actual depiction of distances that I need :-/ However, the basic idea miiiight have something to it, if I can find no other option...
  3. OpenGL Rendering the depth buffer?

    I'm not using shaders. I thought that since the Z-buffer exists somewhere (I assume, or things would overlap, and my clearing the depth buffer would affect nothing), I should be able to simply(??) swap it for the color buffer. I clear the two things in the same line (glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)), so they should be using similar logic... or am I making wild assumptions?
  4. 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: [url="http://en.wikipedia.org/wiki/File:Z_buffer.svg"]http://en.wikipedia....le:Z_buffer.svg[/url] (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?
  5. PBuffer Alpha

    (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: [url="http://www.codesampler.com/oglsrc/oglsrc_7.htm"]http://www.codesampl...rc/oglsrc_7.htm[/url] (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: [code] 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); [/code] ... and this is what the pbuffer works with: [code] 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); [/code] 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 :-)
  6. Great, I am sure it will many happy And don't worry about the hovers, they are not a matter of life and death, the site is fantastic both with and without. But they are indeed icing on the yummy cake ;) Thank you for a marvelous site, keep up the excellent work!!!
  7. 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
  • Advertisement