Results 1 to 4 of 4

Thread: BAD texture mapping troubles! (with "on-screen" sprite render)

  1. #1
    Junior Member Newbie
    Join Date
    Sep 2005
    Posts
    6

    BAD texture mapping troubles! (with "on-screen" sprite render)

    I have some big (for me) trouble! Belive or not - it is a question of life and death for me!

    How can I render a quad with texture with accurate smoothing (may be totally without smoothing... ...with 100% scale...)???
    That it has as a result turned out also as after glDrawPixels... I need exactly this result, but without this function... I know that is possible! But how?

    Anyone hears about GLScene??? It's a visual components lib for working with OpenGL in Delphi... This library have TGLHUDSprite and TGLHUDText components... And TGLHUDText renders texture without smoothing!!! (in 100% scale)

    Please! PLEASE!!! PP-LL-EE-AA-SS-EE!!!!
    HELP ME!!!! If you can...

  2. #2
    Senior Member Regular Contributor
    Join Date
    Jul 2005
    Location
    Berlin, Germany
    Posts
    188

    Re: BAD texture mapping troubles! (with "on-screen" sprite render)

    Use orthographic projection and draw a quad in the correct size. To make that easier, make the view frustum size match your window resolution. Then you can specify your quad size/position in pixels.

    Code :
    glLoadIdentity();
    glOrtho(0, width, 0, height, -1, 1);
     
    glBegin(GL_QUADS);
    glTexCoord2i(0, 1)
    glVertex2i(0, 0);
     
    glTexCoord2i(1, 1);
    glVertex2i(tex_width, 0);
     
    glTexCoord2i(1, 0);
    glVertex2i(tex_width, tex_height);
     
    glTexCoord2i(0, 0);
    glVertex2i(0, tex_height);
    glEnd();
    355/113 -- Not the famous irrational number PI, but an incredible simulation!

  3. #3
    Senior Member OpenGL Guru Relic's Avatar
    Join Date
    Apr 2000
    Posts
    2,450

    Re: BAD texture mapping troubles! (with "on-screen" sprite render)

    And switch texture filtering to GL_NEAREST for min and mag filter to get the same result as a glDrawPixels.

  4. #4
    Junior Member Newbie
    Join Date
    Sep 2005
    Posts
    6

    Re: BAD texture mapping troubles! (with "on-screen" sprite render)

    Yeah... Yeah... glOrtho... Correct size... I know this... But problem was not here!

    I load a non power of two textures and use gluScaleImage function... And it was wrong! As a result there was a smoothing! It was my own oversight.

    Now I use my own function and enlarge size of texture with adding transparent borders (not scaling). And with that - all forks fine...

    Many thanx to everyone who has answered me.

Similar Threads

  1. Best practices to render multiple 2D Sprite with VBO
    By SirusDoma in forum OpenGL: Basic Coding
    Replies: 12
    Last Post: 11-16-2015, 11:07 PM
  2. Render to texture + GL_DEPTH_TEST = Black screen
    By Brokenmind in forum OpenGL: Advanced Coding
    Replies: 4
    Last Post: 02-28-2014, 02:31 PM
  3. Is it possible to render a texture on screen?
    By SagoO in forum OpenGL: Basic Coding
    Replies: 2
    Last Post: 04-13-2011, 12:25 PM
  4. BAD texture mapping troubles! (with "on-screen" sprite render)
    By Dimitry in forum OpenGL: Advanced Coding
    Replies: 0
    Last Post: 09-13-2005, 09:21 AM
  5. texture & screen mapping
    By Lisa Grecco in forum OpenGL: Basic Coding
    Replies: 4
    Last Post: 05-04-2005, 07:22 PM

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