Results 1 to 4 of 4

Thread: I am wondering if there is a bug in the drawalpha routine?

  1. #1

    I am wondering if there is a bug in the drawalpha routine?

    I was hoping to upload a bitmap to show what I mean, but I seem to be having a spot of bother.

    And now after quickly reading the FAQ I find out I cannot remove my post
    The views expressed on this programme are bloody good ones. - Fred Dagg

  2. #2

    Quick update

    Still not 100% sure that there is a bug in the drawalpha or drawadd but after looking up a page on deja I made a few changes to the drawadd function, and bang it works as I want it to work. Here is the code

    [pascal]
    procedure TGLXImageItem.DrawAdd(X, Y, PatternIndex: Integer; Alpha: Single);
    begin
    glColor4f(1.0,1.0,1.0,Alpha);

    glPushAttrib(GL_ENABLE_BIT);
    glEnable (GL_TEXTURE_2D);
    glEnable (GL_BLEND);
    glDisable (GL_DEPTH_TEST);

    // glBlendFunc(GL_SRC_ALPHA,GL_ONE);

    {next two lines added by myself}

    glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
    glAlphaFunc(GL_GREATER, 0);

    Bind;

    glBegin(GL_QUADS);
    with FPatterns[PatternIndex] do begin
    glTexCoord2f(Left , Bottom); glVertex2i(X , Y);
    glTexCoord2f(Right, Bottom); glVertex2i(X+PatternWidth, Y);
    glTexCoord2f(Right, Top ); glVertex2i(X+PatternWidth, Y+PatternHeight);
    glTexCoord2f(Left , Top ); glVertex2i(X , Y+PatternHeight);
    end;
    glEnd();
    glPopAttrib();
    glColor4f(1.0,1.0,1.0,1.0);
    end;
    [/pascal]
    The views expressed on this programme are bloody good ones. - Fred Dagg

  3. #3

    I am wondering if there is a bug in the drawalpha routine?

    no it's not an bug in the drawadd, what you are trying to do should be done as following:
    Code:
        GLXDraw1.UseColor(1.0, 1.0, 1.0, 0.2);
        GLXImageList1.Items.Find('Wood.jpg').Draw(20,20, 0);
        GLXDraw1.UseColor(1.0, 1.0, 1.0, 1.0);
    Amnoxx

    Oh, and this code appears to be an approximate replacement for return(random() & 0x01);

    Phoenix Wiki
    http://www.phoenixlib.net/

    Phoenix Forum
    http://www.pascalgamedevelopment.com/viewforum.php?f=71

  4. #4

    Ta

    Thanks for the help. I tried it and thats works fine.
    The views expressed on this programme are bloody good ones. - Fred Dagg

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
  •