Results 1 to 2 of 2

Thread: transition between two texture opengl + delphi

  1. #1

    transition between two texture opengl + delphi

    Hi
    i work on an myst-like game engine with opengl and delphi 7
    i try to do transition between two texture but i dont know how in OpenGl
    anyone can help me?
    i want to blend two texture into one.

    Thanks
    JP

  2. #2

    transition between two texture opengl + delphi

    The simplest way is like this:

    Code:
    (initalisation)
    Set Orthographic Projection mode.
    Load Texture into Tex1
    Load Texture into Tex2
    
    glDisable(GL_LIGHTING);
    glEnable(GL_TEXTURE_2D);
    glDisable(GL_DEPTH_TEST);
    glEnable(GL_BLEND);
    glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
    
    
    (drawing)
    
    Fade := (a number ranging from 0.0 to 1.0 where 0 means Tex1 is visible, 1 = Tex2 visible.)
    
    glBindTexture2D(GL_TEXTURE_2D, Tex1);
    glColor4f(1,1,1, Fade);
    
    glBegin(GL_QUADS);
     glTexCoord2f(0, 1); glVertex2f(0,0);
     glTexCoord2f(1, 1); glVertex2f(Width,0);
     glTexCoord2f(1, 0); glVertex2f(Width,Height);
     glTexCoord2f(0, 0); glVertex2f(0,Height);
    glEnd;
    
    glBindTexture2D(GL_TEXTURE_2D, Tex2);
    glColor4f(1,1,1, 1-Fade);
    
    glBegin(GL_QUADS);
     glTexCoord2f(0, 1); glVertex2f(0,0);
     glTexCoord2f(1, 1); glVertex2f(Width,0);
     glTexCoord2f(1, 0); glVertex2f(Width,Height);
     glTexCoord2f(0, 0); glVertex2f(0,Height);
    glEnd;
    My site: DelphiTuts.com (coming soon)...

    Download Font Studio 4.21 here.

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
  •