Page 1 of 2 12 LastLast
Results 1 to 10 of 15

Thread: Slow performance with non power of 2 texture

  1. #1
    Junior Member Newbie
    Join Date
    Feb 2009
    Posts
    4

    Slow performance with non power of 2 texture

    Hi All,

    Why am I getting such low FPS when I try to draw a Non power of 2 texture? I am using a Radeon Mobility x700 which supports OpenGL 2.0.

    I initialise the textures and OpenGL where I already have a bitmap loaded into memory:

    Code :
    glGenTextures( 1, &this->texId );
    glBindTexture( GL_TEXTURE_2D, this->texId );
    glTexImage2D(GL_TEXTURE_2D, 0, 3, imgWidth(), imgHeight(), 0, GL_RGB, GL_UNSIGNED_BYTE, imgBuffer );
    	glEnable(GL_TEXTURE_2D);						
    glTexParameterf(GL_TEXTURE_2D,GL_TEXTURE_WRAP_S, GL_REPEAT);
    glTexParameterf(GL_TEXTURE_2D,GL_TEXTURE_WRAP_T, GL_REPEAT);
    glTexParameterf(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER, GL_LINEAR);
    glTexParameterf(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER, GL_LINEAR);
     
    glClearColor( 0.0f, 0.0f, 0.0f, 0.0f );
    glShadeModel(GL_FLAT);
     
    this->object = glGenLists( 1 );
     
    glNewList( this->object, GL_COMPILE );
     
    glTranslatef(-1.5f,0.0f,-15.0f);	
    glBegin(GL_QUADS);					
    	glTexCoord2f(0.0f, 0.0f);
    	glVertex3f(-1.0f, 1.0f, 0.0f);				// Top Left
    	glTexCoord2f(1.0f, 0.0f);
    	glVertex3f( 1.0f, 1.0f, 0.0f);				// Top Right
    	glTexCoord2f(1.0f, 1.0f);
    	glVertex3f( 1.0f,-1.0f, 0.0f);				// Bottom Right
    	glTexCoord2f(0.0f, 1.0f);
    	glVertex3f(-1.0f,-1.0f, 0.0f);				// Bottom Left
    glEnd();							
    glEndList();

    I then run a timer which updates the scene:

    Code :
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
    glLoadIdentity();
    glCallList( this->object );

    If I use an image with a resolution of 512x512 then everything runs nice and fast, if I use an image of 500x500 then it just slows down to like 5 FPS!

    What am I doing wrong?

    Thanks in advance
    Andy

  2. #2
    Senior Member OpenGL Pro
    Join Date
    Sep 2004
    Location
    Prombaatu
    Posts
    1,386

    Re: Slow performance with non power of 2 texture

    Sounds like you're hitting a software path. Check your extension string for NPOT support?

    Just tried delphi3d.net for support on that card, but they seem to be experiencing difficulties. Anyone know if that site is still being maintained?

  3. #3
    Super Moderator OpenGL Lord
    Join Date
    Dec 2003
    Location
    Grenoble - France
    Posts
    5,574

    Re: Slow performance with non power of 2 texture

    Radeon Mobility x700 supports OpenGL 2.0 yes, but NPOT is not done in hardware ... not your fault.
    Check this :
    http://www.opengl.org/wiki/NPOT_Textures
    If you can live with GL_CLAMP_TO_EDGE and no mipmaps, you may use NPOT like on the RECTANGLE extension.
    Otherwise, pad your texture up to POT, and adjust texture coordinates accordingly.

  4. #4
    Senior Member OpenGL Pro dletozeun's Avatar
    Join Date
    Jan 2006
    Location
    FRANCE
    Posts
    1,367

    Re: Slow performance with non power of 2 texture

    Quote Originally Posted by modus
    Anyone know if that site is still being maintained?
    Looks like the server is crashed for days even weeks (months, who knows?)... since the last time I went on this site.

    Useful utilites are for me, glxinfo on linux or realtech glview windows and mac.

  5. #5
    Senior Member OpenGL Pro
    Join Date
    Sep 2004
    Location
    Prombaatu
    Posts
    1,386

    Re: Slow performance with non power of 2 texture

    I miss the hw database they have - mighty nice if you're on a limited budget

  6. #6
    Senior Member OpenGL Pro dletozeun's Avatar
    Join Date
    Jan 2006
    Location
    FRANCE
    Posts
    1,367

    Re: Slow performance with non power of 2 texture

    Yes that was really useful... although I have found the direct link to the hardware registry which is finally accessible! But it does not look like to be still maintained... too bad.

    I have seen on realteach site that glview should run on linux with wine. Just for fun I have tried to install it Ubuntu 8.04. It requires .net framework whose installation program literally crash... oh no! That is very surprising! Anyway, I should not have to bother with that.

  7. #7
    Senior Member OpenGL Pro
    Join Date
    Sep 2004
    Location
    Prombaatu
    Posts
    1,386

    Re: Slow performance with non power of 2 texture

    Who has the time and energy to whip up something like this in the wiki? Is there a way to make submission of hardware configs and capabilities really easy and readily available to everyone?

    I'm too busy picking the leaves out of my tropical tea.


  8. #8
    Junior Member Newbie
    Join Date
    Feb 2009
    Posts
    4

    Re: Slow performance with non power of 2 texture

    Thanks for the clarifictation. How does one detect whether NPOT is supported in the hardware and is not implemented in software? Do I simply time a frame and make an assumption on that?

  9. #9
    Senior Member OpenGL Pro
    Join Date
    Sep 2004
    Location
    Prombaatu
    Posts
    1,386

    Re: Slow performance with non power of 2 texture

    If your hardware isn't doing what you think it ought to be doing, please tell your vendor about it - only way to change anything.


  10. #10
    Junior Member Newbie
    Join Date
    Feb 2009
    Posts
    4

    Re: Slow performance with non power of 2 texture

    I am intending to stream video into the texture so padding or resizing the image is something I want to avoid. I am intending to support OpenGL 2.0 upwards but I want to avoid the issue of running into a software path, as I have with the current card I am working with. Is there a way to detect at runtime if the NPOT is being rendered using software or hardware? I am assuming I can use the RECTANGLE extension for when it runs into a software path.

Page 1 of 2 12 LastLast

Similar Threads

  1. Performance of Non-Power-of-2 Textures
    By DigitalDative in forum Vulkan
    Replies: 18
    Last Post: 01-24-2017, 03:47 PM
  2. non power of two texture loading slow
    By shivmitra in forum OpenGL: Basic Coding
    Replies: 5
    Last Post: 07-05-2011, 07:11 AM
  3. PBO performance very slow
    By mobeen in forum OpenGL: Basic Coding
    Replies: 6
    Last Post: 12-29-2010, 01:07 AM
  4. non-power of two performance?
    By canuckle in forum OpenGL: Advanced Coding
    Replies: 0
    Last Post: 07-21-2005, 08:25 PM
  5. Slow performance due to large background image (texture).
    By VuurSnikkel in forum OpenGL: Advanced Coding
    Replies: 11
    Last Post: 06-01-2003, 04:19 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