Page 1 of 4 1234 LastLast
Results 1 to 10 of 34

Thread: I find the Secret of openGL Texture.Am i right?

  1. #1
    Member Contributor
    Join Date
    Dec 2000
    Location
    Kaifeng,He'nan,PRC
    Posts
    69

    I find the Secret of openGL Texture.Am i right?

    I find many image can not be texture correctly.So i try and try,and find a tip:

    as following:
    The width or the height of the image must be hte power of 2,such as:1,2,4,8,16,32,64,128,256,512,1024.If >1024,OpenGL1.1 will wrong.

    Wish my find will help you,friends.

    Chinese believe in the friendship.If all we share the tip we find instead of hiding them in the heart of heart,the road to OpenGL expert will be broad and straight.
    ========================
    As an old Chinese saying:One Live a Short while Die a Long...
    If I am useful to this world,I am reasonable to myself.
    =========================

  2. #2
    Member Contributor
    Join Date
    Jan 2001
    Posts
    60

    Re: I find the Secret of openGL Texture.Am i right?

    Yes, You are right, they must be power of 2.

    I'm sorry to say but... That's written everywhere!

  3. #3
    Member Contributor
    Join Date
    Dec 2000
    Location
    Kaifeng,He'nan,PRC
    Posts
    69

    Re: I find the Secret of openGL Texture.Am i right?

    ---------------------
    That's written everywhere!
    ---------------------

    [Tune pattern as the pet detector: ACE Ventura ]R-e-a-l-l-y~~~~~~?!

    Well,but..En...that is very..zigzig~~It embarrass me so much where is the gap in the ground?show me it and i will get into..

    OK,Maybe somebody will say:The 1300000000 people will be shamed by your stupid action.;(
    ========================
    As an old Chinese saying:One Live a Short while Die a Long...
    If I am useful to this world,I am reasonable to myself.
    =========================

  4. #4
    Senior Member OpenGL Guru
    Join Date
    Feb 2000
    Location
    Sweden
    Posts
    2,978

    Re: I find the Secret of openGL Texture.Am i right?

    Just made a quick search in the OpenGL specification document. There is no place where can find where it says a texture's dimension has to be a power of two. I think this is a driver-limitation, and not something OpenGL requires. I have heard NVidia is planning support for non-power of two sizes, but think that should be clasified as a rumor, i.e. might very well be wrong.

    So, theoretically, textures CAN have any size.

  5. #5
    Senior Member OpenGL Pro
    Join Date
    Jun 2000
    Location
    Shreveport, LA, USA
    Posts
    1,502

    Re: I find the Secret of openGL Texture.Am i right?

    Better look again Bob , it is written in the spec. I just checked. It clearly states that each texture dimension will be of the form 2^n+2*b, where n is the extent of the source image in a given dimension, and b is the number of texture border pixels. As most people don't use texture borders, that leaves just the image requirement 2^n. This means a 2D texture will be 2^n X 2^m. However I also vaguely remember hearing about arbitrary texture sizes being supported by an extension.

    [This message has been edited by DFrey (edited 01-14-2001).]

  6. #6
    Senior Member OpenGL Pro
    Join Date
    Dec 2007
    Posts
    1,077

    Re: I find the Secret of openGL Texture.Am i right?

    >1024 won't necesserily end up in an error. The maximum texture size in either direction is driver dependent and you can get it with glGetInteger I think.

  7. #7
    Senior Member OpenGL Guru
    Join Date
    Feb 2000
    Location
    Sweden
    Posts
    2,978

    Re: I find the Secret of openGL Texture.Am i right?

    DFrey: Ok, whatever. As I said, a quick search. But I read the section about glTexImage2D, where I expected to find it, but couldn't see anything about it.

    By the way, in the MSVC6 documentation it says it has to be a power of two. But this documentation is not the very best you can find, and I don't completely trust it as a source of facts. The OpenGL-part that is. I was reading the official 1.2.1 documentation, the .PDF you can download from this site.

    And in case you are right (which I believe you are), arbitary texture size as an extension sounds reasonable.

  8. #8
    Senior Member OpenGL Pro
    Join Date
    Jun 2000
    Location
    Shreveport, LA, USA
    Posts
    1,502

    Re: I find the Secret of openGL Texture.Am i right?

    Yes, that's the very pdf file I was reading too. Page 118 (pg 130 of pdf file). I pretty much ignore the MSDN OpenGL documentation. It has caused me one too many headaches.

    [This message has been edited by DFrey (edited 01-15-2001).]

  9. #9
    Senior Member Regular Contributor
    Join Date
    Nov 2000
    Location
    Huntsville, AL. USA
    Posts
    302

    Re: I find the Secret of openGL Texture.Am i right?

    Code snip, might help ....

    /// Insure that texture can be accomodated by the
    // hardware accelerator
    GLsizei width = m_ImageData->width();
    GLsizei height = m_ImageData->height();

    glTexImage2D(
    GL_PROXY_TEXTURE_2D,
    0,
    m_ImageData->dataFormat(),
    width,
    height,
    0,
    m_ImageData->dataFormat(),
    m_ImageData->dataType(),
    NULL
    );

    glGetTexLevelParameteriv(
    GL_PROXY_TEXTURE_2D,
    0,
    GL_TEXTURE_WIDTH,
    &width
    );

    if (width==0)
    {
    MString msg(
    "Texture size is larger than that supported by ",
    "hardware accelerator or texture is sized improperly|"
    );
    msg << "Texture name was " << name();
    throw MOglException(msg,M_TRACEPOINT);
    }
    Obsessive - A word used by the lazy to describe the motivated.

  10. #10
    Senior Member OpenGL Guru
    Join Date
    Feb 2000
    Location
    Sweden
    Posts
    2,978

    Re: I find the Secret of openGL Texture.Am i right?

    DFrey: Ok, seen it too now

Page 1 of 4 1234 LastLast

Similar Threads

  1. OpenGl 1.2(Secret of the Solstice)
    By Chikiyo in forum OpenGL: User Software
    Replies: 5
    Last Post: 10-24-2010, 10:13 AM
  2. Secret of the Solstice opengl needed
    By DarkenRahl in forum OpenGL: User Software
    Replies: 9
    Last Post: 06-13-2009, 01:29 PM
  3. OpenGL 1.2 for Secret of the Solstice
    By Moradiae in forum OpenGL: User Software
    Replies: 12
    Last Post: 12-19-2008, 03:33 AM
  4. where to find texture formats supported by opengl ?
    By markisbcn in forum OpenGL: GLSL
    Replies: 1
    Last Post: 03-31-2006, 08:06 AM
  5. Secret Service 2 Security Breach - OpenGL problem
    By in forum OpenGL: User Software
    Replies: 0
    Last Post: 11-06-2003, 02:20 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