Results 1 to 2 of 2

Thread: problem with ALPHA blending

  1. #1

    problem with ALPHA blending

    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
    [pascal]
    glClearColor(0,0,0,0);
    glClear(GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT);
    glLoadidentity;
    op_function('rendering');[/pascal]

    this is the full text in my script language
    [pascal]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|[/pascal]

  2. #2

    problem with ALPHA blending

    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
    programming is more than copy and paste!

Bookmarks

Posting Permissions

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