PDA

View Full Version : glEnable(GL_BLEND); is really necessary?



arthurprs
31-10-2007, 08:12 PM
Hello im using openGL to 2d drawning on my framework and im typing to much ->

glEnable(GL_BLEND);

// stuff

glDisable(GL_BLEND);


its really necessary :?:

or i can just enable it at the openGL setup?

User137
31-10-2007, 09:33 PM
I have it always enabled on my projects. Why disable it? It is needed for alpha channeled textures that are farely common.

JernejL
31-10-2007, 09:39 PM
I have it always enabled on my projects. Why disable it? It is needed for alpha channeled textures that are farely common.

disable it so that you save the gpu from using unneccesary alpha calc. when unneeded.. perhaps to speed things up?

arthurprs
01-11-2007, 12:57 AM
I have it always enabled on my projects. Why disable it? It is needed for alpha channeled textures that are farely common.

disable it so that you save the gpu from using unneccesary alpha calc. when unneeded.. perhaps to speed things up?

i will let it enabled at the begining, 80% of blits uses alpha...

WILL
01-11-2007, 09:02 PM
A trick I use to get rid of some artifacts caused by displaying scaled or rotated transparent textures in my 2D games is as follows.

glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glDisable(GL_ALPHA_TEST);

This is just so much better than playing with Alpha Test. Especially when you are using a pre-rendering method of creating sprites.