Results 1 to 3 of 3

Thread: How does the Current shader affect glClear ?

  1. #1
    Junior Member
    Join Date
    May 2009
    Posts
    3

    How does the Current shader affect glClear ?

    How would the currently bind shaders affect following code ?
    Should i use glUseProgram(0) before making following calls ?

    glClearColor (0.f, 0.f ,0.f, 0.f);
    glClear (GL_COLOR_BUFFER_BIT)

  2. #2
    Senior Member
    Join Date
    May 2006
    Posts
    353

    Re: How does the Current shader affect glClear ?

    The current shader does not affect glClear.
    Georg Kolling, Imagination Technologies
    Please ask questions specific to PowerVR hardware or SDKs on the PowerVR Insider Forum
    DevTech@imgtec.com | http://www.powervrinsider.com

  3. #3
    Senior Member
    Join Date
    May 2010
    Posts
    207

    Re: How does the Current shader affect glClear ?

    Right.

    If you want the effect of a clear - but with a shader - you need to draw a screen-sized quad, with Z-testing (and possibly a bunch of other stuff) disabled.

    Clear is special because it needs to be super-fast. Most GPU's have special hardware for doing fast screen-clears. Some systems may not even literally clear the screen but just mark it cleared so that subsequent operations read "cleared data" from the buffer for pixels that haven't been written to since the last clear. Burdening it with the requirement to run shaders would be incredibly inefficient...and unnecessary since you can always draw a screen-sized quad if that's what you want.

Similar Threads

  1. glClear() seg. faults with ES 2 context
    By Teraslilja in forum Cross API and window system integration
    Replies: 0
    Last Post: 05-26-2011, 04:04 AM
  2. Replies: 6
    Last Post: 11-18-2010, 11:52 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •