Results 1 to 10 of 12

Thread: frontend for emulators in opengl

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    First of all, PLEASE put empty lines between your procedures/functions. Without them, the code is quite hard to read (for me atleast).

    You should be looking here:
    Code:
    Procedure DrawQuadRT(X, Y, Wid, Hgt, Lev, Tu, Tu2, Tv,Tv2: single);
    begin
      Tv := 1-Tv;  //<< comment this line and the next one
      Tv2 := 1-Tv2;
      glBegin(GL_QUADS);
        glTexCoord2f(Tu,  Tv); glVertex3f(X,     Y, -lev);
        glTexCoord2f(Tu2, Tv); glVertex3f(X+Wid, Y, -lev);
        glTexCoord2f(Tu2,Tv2); glVertex3f(X+Wid, Y-Hgt, -lev);
        glTexCoord2f(Tu, Tv2); glVertex3f(X,     Y-Hgt, -lev);
      glEnd;
    end;
    The calls to glTexcoord2f() are used to specify texture coordinates. If your text is upside down, you should flip the coordinates to make it work. Play arround with this. Try to remove the first two lines, or swap Tv by Tv2.

    Good luck!
    Coders rule nr 1: Face ur bugz.. dont cage them with code, kill'em with ur cursor.

  2. #2
    I think what sometimes causes confusion with OpenGL is difference to perspective and ortho coordinates. Perspective is the default way to render, with positive side going up and ortho positive is to down side.

    I don't know if you use perspective but same draw function is usually not good for both. It is possible to play around with:
    glScale(1,-1,1) // You can flip the coordinate system around if you want
    glRotate(180,1,0,0)
    glCullFace // You can rotate the image 180 around X axis and draw only the back face
    glDisable(GL_CULL_FACE) // Or you can use this to simply draw both sides
    (and enable back when needed for example 3D models)

  3. #3
    Quote Originally Posted by chronozphere View Post
    First of all, PLEASE put empty lines between your procedures/functions. Without them, the code is quite hard to read (for me atleast).

    You should be looking here:
    Code:
    Procedure DrawQuadRT(X, Y, Wid, Hgt, Lev, Tu, Tu2, Tv,Tv2: single);
    begin
      Tv := 1-Tv;  //<< comment this line and the next one
      Tv2 := 1-Tv2;
      glBegin(GL_QUADS);
        glTexCoord2f(Tu,  Tv); glVertex3f(X,     Y, -lev);
        glTexCoord2f(Tu2, Tv); glVertex3f(X+Wid, Y, -lev);
        glTexCoord2f(Tu2,Tv2); glVertex3f(X+Wid, Y-Hgt, -lev);
        glTexCoord2f(Tu, Tv2); glVertex3f(X,     Y-Hgt, -lev);
      glEnd;
    end;
    The calls to glTexcoord2f() are used to specify texture coordinates. If your text is upside down, you should flip the coordinates to make it work. Play arround with this. Try to remove the first two lines, or swap Tv by Tv2.

    Good luck!
    Thank you my friend as you say i change the Tv by Tv2 and the opposite and it works...

    I still have the problem with the text position from different fonts but i think i found and awnser...

    Thank you all of you for helping me.

    Soon i'll post the the .exe file if you want to try it ....

  4. #4
    If you are using Font4.pas to render out the Font Studio fonts (that procedure above comes from / was derived from Font4.pas) then it will draw the bitmap font characters upside down by default because of this line:

    Code:
    const
          USE_INVERTED = true; //Use this if you use inverted GL coordinates
                                         //where (0,0) is the top left corner.
    I see you've just fixed it manually, but setting that to false may have fixed it too.
    Last edited by Nitrogen; 07-10-2010 at 08:48 PM.
    My site: DelphiTuts.com (coming soon)...

    Download Font Studio 4.21 here.

  5. #5
    Interesting. I faced this problem a long time ago, but I probably overlooked that constant. Thanks for the heads up.
    Coders rule nr 1: Face ur bugz.. dont cage them with code, kill'em with ur cursor.

  6. #6
    Quote Originally Posted by chronozphere View Post
    Interesting. I faced this problem a long time ago, but I probably overlooked that constant. Thanks for the heads up.
    What can i say me too

  7. #7
    Quote Originally Posted by Nitrogen View Post
    If you are using Font4.pas to render out the Font Studio fonts (that procedure above comes from / was derived from Font4.pas) then it will draw the bitmap font characters upside down by default because of this line:

    Code:
    const
          USE_INVERTED = true; //Use this if you use inverted GL coordinates
                                         //where (0,0) is the top left corner.
    I see you've just fixed it manually, but setting that to false may have fixed it too.
    Oh my god so simply so simply
    Thanks nitrogen...

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
  •