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 3 of 3

Thread: when to use #extension in GLSL?

  1. #1
    Intern Newbie
    Join Date
    Jul 2006
    Posts
    33

    when to use #extension in GLSL?

    In my fragment program, how do I know whether I need to explicitly enable some extension using #extension? I presume it depends on what OpenGL core version the graphics card driver implements. So the NPOT textures extension, which became part of 2.0 core, should probably be explicitly enabled on a machine with older driver (let's assume that I couldn't update the driver). Could someone confirm my speculations?

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

    Re: when to use #extension in GLSL?

    Bad example. Shaders don't know about texture sizes. They just work with samplers and texture coodinates. If that is slow or fast depends on the HW capability. If the extension or OpenGL 2.0 is not exported you will get an OpenGL error as soon as you download a NPOT image.

    What you need to do in the shader source for example is to enable ARB_draw_buffers when using gl_FragData[], etc.
    The compiler should tell you what's required when you use non-core functionality.
    Similarly for the #version tag.

  3. #3
    Advanced Member Frequent Contributor
    Join Date
    May 2005
    Location
    Prague, Czech Republic
    Posts
    924

    Re: when to use #extension in GLSL?

    Originally posted by dobradusa:
    In my fragment program, how do I know whether I need to explicitly enable some extension using #extension?
    You need to enable extensions that are not part of the core of the language version (not OGL version) you are targeting with the #version directive.

Posting Permissions

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