Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7786897
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T20:30:19+00:00 2026-06-01T20:30:19+00:00

I noticed that if I bind my depth buffer before the color buffer, the

  • 0

I noticed that if I bind my depth buffer before the color buffer, the application works as intended:

glGenRenderbuffers(1, &_depthbuffer);
glBindRenderbuffer(GL_RENDERBUFFER, _depthbuffer);
glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH_COMPONENT16, _sw, _sh);
glGenRenderbuffers(1, &_renderbuffer);
glBindRenderbuffer(GL_RENDERBUFFER, _renderbuffer);
[_context renderbufferStorage:GL_RENDERBUFFER fromDrawable:_eaglLayer];

However, binding the depth buffer afterwards causes nothing to render, even my glClearColor setting is ignored:

glGenRenderbuffers(1, &_renderbuffer);
glBindRenderbuffer(GL_RENDERBUFFER, _renderbuffer);
[_context renderbufferStorage:GL_RENDERBUFFER fromDrawable:_eaglLayer];
glGenRenderbuffers(1, &_depthbuffer);
glBindRenderbuffer(GL_RENDERBUFFER, _depthbuffer);
glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH_COMPONENT16, _sw, _sh);

I’ve gotten to understand some of the flow of how OpenGL ES 2.0 works by researching the individual components thoroughly, but this seems as if it’s the only thing that everyone just does in their tutorials/books, but doesn’t explain why. Any ideas? Is this even an issue, or possibly something wrong in the rest of my setup? (if so I’ll include all the code)

EDIT

@cli_hlt – the depth buffer is already being added to the framebuffer:

glGenFramebuffers(1, &_framebuffer);
glBindFramebuffer(GL_FRAMEBUFFER, _framebuffer);
glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, _depthbuffer);
glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, _renderbuffer);

EDIT

Depth bound before:

enter image description here
enter image description here

Depth bound after:

enter image description here

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T20:30:20+00:00Added an answer on June 1, 2026 at 8:30 pm

    I may be totally wrong—I’m just getting a handle on this stuff myself—but as I understand it, glBind commands only tell OpenGL which renderbuffer/texture/whatever to use for subsequent functions. It’s a weird model if you’re used to object-oriented programming. In the boilerplate setup code you have to bind the buffer you created to the GL_RENDERBUFFER “slot” so the next glRenderbufferStorage() or -[EAGLContext renderbufferStorage:fromDrawable:] call knows what buffer to use. I think the problem is just that you’re not binding the active GL_RENDERBUFFER back to your color buffer before you’re calling -[EAGLContext presentRenderBuffer:], so you’re actually showing the depth buffer. Adding

    glBindRenderbuffer(GL_RENDERBUFFER, _renderbuffer);
    

    before the presentRenderBuffer: call should fix this. …I think.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I noticed the other day that I cannot bind variables when using PDO with
I've noticed that in .Net 4 , WPF FrameworkElements are able to bind to
I noticed that when passing reference parameters to boost bind, those parameters won't act
I've noticed that some libraries such as clojure-twitter use special vars (the ones intended
I've noticed that when you bind keys in tkinter (python3.2 winxp), the binds are
I noticed that the Ninject API has calls such as Bind<ISomething>().DoSomethingElse(); How is this
I noticed that various systems use various characters as the replacent for illegal ones
I noticed that on my Vista and XP machines, the automatic update is asking
I noticed that JavaScript's new Date() function is very smart in accepting dates in
I noticed that every time that I restart my computer I have to do

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.