Hello Guest

Plain colored quad with glBlendFunc()

  • 3 Replies
  • 5933 Views
Plain colored quad with glBlendFunc()
« on: June 17, 2013, 16:04:25 »
I've put glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); in my OpenGL initialization code so the transparent part of my textures remains so. But I now want to add a simple colored quad, without any texture. This won't show up as long as I keep the glBlendFunc line. How do I fix it?

*

Offline quew8

  • *****
  • 569
  • Because Square Eyes Look More Real
Re: Plain colored quad with glBlendFunc()
« Reply #1 on: June 18, 2013, 07:49:39 »
Disable blend function, disable textures, draw quad, enable blend function, enable textures.

Re: Plain colored quad with glBlendFunc()
« Reply #2 on: June 18, 2013, 12:22:19 »
You should be able to keep the blend function enabled and just disable the textures. Just make sure you don't use a color with a zero alpha channel.
Programmers will, one day, rule the world... and the world won't notice until its too late.Just testing the marquee option ;D

*

Offline quew8

  • *****
  • 569
  • Because Square Eyes Look More Real
Re: Plain colored quad with glBlendFunc()
« Reply #3 on: June 19, 2013, 10:48:53 »
I was thinking along the lines of performance. If it's just the one non-blended quad, don't bother disabling blend. If there are a lot of them, I think disabling blend would be a fair amount quicker.

But maybe not. If nothing else, disabling blend is less error prone.