Results 1 to 2 of 2

Thread: Transparent, blend help

  1. #1
    Member Newbie
    Join Date
    Jul 2003
    Posts
    33

    Transparent, blend help

    I am able to do some blending and stuff but i want it to be more efficient cuz the current method i use costs me 2 mutch cpu power.

    Here you see the scene im working on.
    http://members.home.nl/skynet2097/Im...tation%202.jpg

    The logo in the left lower corner is made with this code :

    ================================================== ==========================================

    void drawFrame(int x, int y, int width, int height, int textID, int blendID)
    {
    glBlendFunc(GL_DST_COLOR,GL_ZERO);
    glEnable(GL_BLEND);

    (*glActiveTextureARB)(GL_TEXTURE1_ARB);
    glDisable(GL_TEXTURE_2D);

    (*glActiveTextureARB)(GL_TEXTURE0_ARB);
    glBindTexture(GL_TEXTURE_2D, texture[textID]);

    glBegin(GL_QUADS);
    glTexCoord2f(0.0f, 1.0f); glVertex2f(0 + x, 0 + y);
    glTexCoord2f(0.0f, 0.0f); glVertex2f(0 + x, height + y);
    glTexCoord2f(1.0f, 0.0f); glVertex2f(width + x, height + y);
    glTexCoord2f(1.0f, 1.0f); glVertex2f(width + x, 0 + y);
    glEnd();

    glBlendFunc(GL_ONE,GL_ONE);

    (*glActiveTextureARB)(GL_TEXTURE0_ARB);
    glBindTexture(GL_TEXTURE_2D, texture[blendID]);

    glBegin(GL_QUADS);
    glTexCoord2f(0.0f, 1.0f); glVertex2f(0 + x, 0 + y);
    glTexCoord2f(0.0f, 0.0f); glVertex2f(0 + x, height + y);
    glTexCoord2f(1.0f, 0.0f); glVertex2f(width + x, height + y);
    glTexCoord2f(1.0f, 1.0f); glVertex2f(width + x, 0 + y);
    glEnd();

    glDisable(GL_BLEND);

    (*glActiveTextureARB)(GL_TEXTURE1_ARB);
    glEnable(GL_TEXTURE_2D);
    }

    ================================================== ==========================================

    Basicly im drawing the same quad object twice, and its a waste of cpu power. So i was thinking there has 2 be antoher way. How can i blend the tetxture and draw only the object once??

    Edit

    once more thing, i disable the GL_TEXTURE1_ARB because its for the multi texturing. But i wanna use it blend the textures.. but how and is it possible?

    [This message has been edited by GL_ZERO (edited 07-25-2003).]

  2. #2
    Member Newbie
    Join Date
    Jul 2003
    Posts
    33

    Re: Transparent, blend help

    lol i fixed it

    ================================================== ==========================================
    void drawFrame(int x, int y, int width, int height, int textID, int blendID)
    {
    glBlendFunc(GL_DST_COLOR,GL_ZERO);
    glEnable(GL_BLEND);

    (*glActiveTextureARB)(GL_TEXTURE1_ARB);
    glBindTexture(GL_TEXTURE_2D, texture[textID]);

    glBlendFunc(GL_ONE,GL_ONE);

    (*glActiveTextureARB)(GL_TEXTURE0_ARB);
    glBindTexture(GL_TEXTURE_2D, texture[blendID]);

    glBegin(GL_QUADS);
    glTexCoord2f(0.0f, 1.0f); glVertex2f(0 + x, 0 + y);
    glTexCoord2f(0.0f, 0.0f); glVertex2f(0 + x, height + y);
    glTexCoord2f(1.0f, 0.0f); glVertex2f(width + x, height + y);
    glTexCoord2f(1.0f, 1.0f); glVertex2f(width + x, 0 + y);
    glEnd();
    glDisable(GL_BLEND);
    }
    ==============================================

    [This message has been edited by GL_ZERO (edited 07-25-2003).]

    [This message has been edited by GL_ZERO (edited 07-25-2003).]

Similar Threads

  1. Replies: 3
    Last Post: 05-11-2014, 07:53 AM
  2. about blend, Need help.
    By linuxgirl in forum OpenGL: Linux
    Replies: 3
    Last Post: 01-13-2005, 02:19 PM
  3. texture map and blend
    By yqs2002 in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 11-21-2002, 01:04 AM
  4. overlaying transparent and non transparent bitmaps
    By dodgyposse in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 09-13-2000, 01:35 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Proudly hosted by Digital Ocean