Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 9 of 9

Thread: OpenGL 3.0 Texture Problems.

  1. #1
    Junior Member Regular Contributor LangFox's Avatar
    Join Date
    Oct 2001
    Location
    Shen Zhen, Guangdong, China
    Posts
    102

    OpenGL 3.0 Texture Problems.

    Hey guys,

    I tried OpenGL 3.0 today. It's OK to create a forward-compatible 3.0 context. But problems occurred in some cases(ALL these never happen with OpenGL 2.1):

    1, When texture format is GL_BGRA.

    Code :
    GLuint unTextureID = 0;
    glGenTextures(1, &unTextureID);
    glBindTexture(GL_TEXTURE_2D, unTextureID);
    glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, 512, 512, 0, GL_BGRA, GL_UNSIGNED_BYTE, NULL);

    GLExpert reports:

    OGLE: Category: 0x00000001, MessageID: 0x00800001
    A provided enum value is not accepted by this operation: OGL Error Code = 0x00000500 (GL_INVALID_ENUM)
    2, When I set a sampler value.

    Code :
    int n_txDiffuse = glGetUniformLocation(hProgram, "g_txDiffuse");
    glUniform1i(n_txDiffuse, 0);

    GLExpert reports:

    OGLE: Category: 0x00000001, MessageID: 0x00800003
    The current operation is illegal in the current state: OGL Error Code = 0x00000502 (GL_INVALID_OPERATION)
    So, any suggestion?
    Best Regards,
    LangFox


    http://hi.baidu.com/lang_fox

  2. #2
    Senior Member OpenGL Pro Ilian Dinev's Avatar
    Join Date
    Jan 2008
    Location
    Watford, UK
    Posts
    1,290

    Re: OpenGL 3.0 Texture Problems.

    I don't have a problem creating BGRA textures the exact same way in GL3.0 forward-compatible. GF8600 latest drivers.

  3. #3
    Junior Member Regular Contributor LangFox's Avatar
    Join Date
    Oct 2001
    Location
    Shen Zhen, Guangdong, China
    Posts
    102

    Re: OpenGL 3.0 Texture Problems.

    I'm using "182.46_geforce_winvista_32bit_english_beta" with GF8800GTS...strange~
    Best Regards,
    LangFox


    http://hi.baidu.com/lang_fox

  4. #4
    Senior Member OpenGL Pro Ilian Dinev's Avatar
    Join Date
    Jan 2008
    Location
    Watford, UK
    Posts
    1,290

    Re: OpenGL 3.0 Texture Problems.

    Oh, my bad, I don't use the newest drivers. My GL_VERSION returns "3.0 NVIDIA 181.22". XP sp2.

  5. #5
    Junior Member Regular Contributor LangFox's Avatar
    Join Date
    Oct 2001
    Location
    Shen Zhen, Guangdong, China
    Posts
    102

    Re: OpenGL 3.0 Texture Problems.

    More problem with NVIDIAGPUVista(182_47) on 8800GTS:

    After I create a 3.1 context, the GLSL version reported is still 1.30.

    OpenGL Vendor : NVIDIA Corporation
    OpenGL Renderer : GeForce 8800 GTS 512/PCI/SSE2
    OpenGL Version : 3.1 NVIDIA 182.47
    OpenGL Shader Version : 1.30 NVIDIA via Cg compiler
    Best Regards,
    LangFox


    http://hi.baidu.com/lang_fox

  6. #6
    Junior Member Regular Contributor LangFox's Avatar
    Join Date
    Oct 2001
    Location
    Shen Zhen, Guangdong, China
    Posts
    102

    Re: OpenGL 3.0 Texture Problems.

    Occasionally, I find the texture problem was caused by the attribList setting:

    If I don't set "WGL_CONTEXT_FLAGS_ARB, WGL_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB", everything is ok, no GLError will be reported.

    Code :
        int attribList[] =
        {
            WGL_CONTEXT_MAJOR_VERSION_ARB, 3,
            WGL_CONTEXT_MINOR_VERSION_ARB, 1,
            0, 0,//WGL_CONTEXT_FLAGS_ARB, WGL_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB,
            0, 0
        };
    Best Regards,
    LangFox


    http://hi.baidu.com/lang_fox

  7. #7
    Member Regular Contributor Jackis's Avatar
    Join Date
    Sep 2005
    Location
    Saint-Petersburg, Russia
    Posts
    275

    Re: OpenGL 3.0 Texture Problems.

    So it's something to deal with deprecated features. May be, some of formats are deprecated, I can't say more precise, sorry, cause I didn't look deeply in new specification.

  8. #8
    Junior Member Newbie
    Join Date
    Aug 2008
    Location
    Canada
    Posts
    26

    Re: OpenGL 3.0 Texture Problems.

    I get the same error. Maybe try using GL_RGBA

    glPixelStorei(GL_UNPACK_LSB_FIRST, GL_TRUE);

    This is on page 103 of the new 3.1 spec. It was referred by the format parameter description of glTexImage2D

    edit: I didn't really test this yet, try it out.

  9. #9
    Junior Member Newbie
    Join Date
    Aug 2008
    Location
    Canada
    Posts
    26

    Re: OpenGL 3.0 Texture Problems.

    It seems that GL_BGRA will not work with glTexImage, but will with glTexSubImage.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •