PDA

View Full Version : problem with ALPHA blending



Hallo99
09-09-2003, 07:27 PM
I have made a own script language for opengl programming
i don't understand, why the boot is transparent
glcolor4f|1|1|1|1| I think it means taht the following things are white and non transparent

function|rendering| means that the programm loops

glClearColor(0,0,0,0);
glClear(GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT);
glLoadidentity;
op_function('rendering');

this is the full text in my script language
function|dotimer|
var|winkel|$winkel+1|
end|function|dotimer|

function|programmstart|
var|winkel@dotimer|0|
var|timer|0|
end|function|programmstart|


function|boot|
glpushmatrix|
gltranslatef|0|0|'-1,5'|
glbegin|GL_POLYGON|
glcolor4f|1|1|1|1|
glvertex3f|0,5|0,5|'0'|
glvertex3f|0,5|'-0,5'|'0'|
glvertex3f|'-0,5'|'-0,5'|'0'|
glvertex3f|'-1'|'0'|'0'|
glvertex3f|'-0,5'|0,5|'0'|
glend|
glbegin|GL_QUADS|
glvertex3f|0,5|0,5|'0,5'|1|
glvertex3f|0,5|'-0,5'|'0,5'|
glvertex3f|0,5|'-0,5'|0|
glvertex3f|0,5|0,5|0|
glvertex3f|0,5|'-0,5'|'0,5'|
glvertex3f|'-0,5'|'-0,5'|'0,5'|
glvertex3f|'-0,5'|'-0,5'|0|
glvertex3f|0,5|'-0,5'|0|
glvertex3f|'-0,5'|'-0,5'|'0,5'|
glvertex3f|'-1,5'|'0'|'0,5'|
glvertex3f|'-1'|'0'|0|
glvertex3f|'-0,5'|'-0,5'|0|
glvertex3f|'-0,5'|'0,5'|'0,5'|
glvertex3f|'-1,5'|'0'|'0,5'|
glvertex3f|'-1'|'0'|0|
glvertex3f|'-0,5'|'0,5'|0|
glvertex3f|'-0,5'|0,5|0|
glvertex3f|'-0,5'|0,5|'0,5'|
glvertex3f|0,5|0,5|'0,5'|
glvertex3f|0,5|0,5|0|
glend|
glpopmatrix|
end|function|boot|

function|landschaft|
glbegin|GL_QUADS|
glcolor4f|0|1|0|1|
glvertex3f|5|2|'-0'|
glvertex3f|5|'-0'|'-5'|
glvertex3f|'-5'|'-0'|'-5'|
glvertex3f|'-5'|2|'-0'|
glvertex3f|5|'-2'|'-0'|
glvertex3f|5|'-0'|'-5'|
glvertex3f|'-5'|'-0'|'-5'|
glvertex3f|'-5'|'-2'|'-0'|
glcolor4f|'0'|0|2|'1'|
glvertex3f|5|1,5|'-1,25'|
glvertex3f|5|'-1,5'|'-1,25'|
glvertex3f|'-5'|'-1,5'|'-1,25'|
glvertex3f|'-5'|1,5|'-1,25'|
glend|
end|function|landschaft|

function|'rendering'|
if|$timer@programmstart=0|
settimer|100|dotimer|
var|timer@programmstart|1|
end|if|
gltranslatef|0|'0'|'-10'|
glrotatef|'-60'|1|0|0|
glrotatef|$winkel@dotimer|0|0|1|
glenable|GL_BLEND|
glblendfunc|GL_SRC_ALPHA|GL_ONE|
landschaft|
boot|
end|function|rendering|

lithander
12-09-2003, 04:27 PM
Well, you enable blending, right? So it's no surprise that the Boot is transparent. Your blending-function adds the Color of the Source (the polygons you are drawing) multiplied with Alpha (in your case 1) of the Source to the Backbuffer. Thus adds the colors up!

If you don't want blending just disable it! ;)

-lith