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

Thread: glGetActiveUniformARB and sampler2DRect (nvidia)

  1. #1

    glGetActiveUniformARB and sampler2DRect (nvidia)

    glGetActiveUniformARB returns incorrect type for sampler2DRect uniforms - instead of SAMPLER_2D_RECT_ARB I get GL_TEXTURE_RECTANGLE_ARB.

    nvidia, driver version: 67.02

    here is test program to demonstrate this:
    Code :
    #include <iostream>
    #include <GL/glut.h>
    #include <GL/glext.h>
     
    PFNGLCREATEPROGRAMOBJECTARBPROC glCreateProgramObjectARB = 0;
    PFNGLCREATESHADEROBJECTARBPROC glCreateShaderObjectARB = 0;
    PFNGLSHADERSOURCEARBPROC glShaderSourceARB = 0;
    PFNGLCOMPILESHADERARBPROC glCompileShaderARB = 0;
    PFNGLGETACTIVEATTRIBARBPROC glGetActiveUniformARB = 0;
    PFNGLATTACHOBJECTARBPROC glAttachObjectARB = 0;
    PFNGLDELETEOBJECTARBPROC glDeleteObjectARB = 0;
    PFNGLLINKPROGRAMARBPROC glLinkProgramARB = 0;
     
    const GLcharARB * shaderSrc =
    "uniform sampler2DRect tex;\n"
    "void main()\n"
    "{\n"
    "	gl_FragColor = texture2DRect( tex, gl_TexCoord[0].xy );\n"
    "}\n";
     
    int main( int argc, char * argv[] )
    {
    	glutInit( &amp;argc, argv );
    	glutInitDisplayMode( GLUT_DOUBLE | GLUT_DEPTH | GLUT_RGB );
    	glutCreateWindow( "test" );
     
    	glCreateProgramObjectARB = (PFNGLCREATEPROGRAMOBJECTARBPROC)wglGetProcAddress( "glCreateProgramObjectARB" );
    	glCreateShaderObjectARB = (PFNGLCREATESHADEROBJECTARBPROC)wglGetProcAddress( "glCreateShaderObjectARB" );
    	glShaderSourceARB = (PFNGLSHADERSOURCEARBPROC)wglGetProcAddress( "glShaderSourceARB" );
    	glCompileShaderARB = (PFNGLCOMPILESHADERARBPROC)wglGetProcAddress( "glCompileShaderARB" );
    	glAttachObjectARB = (PFNGLATTACHOBJECTARBPROC)wglGetProcAddress( "glAttachObjectARB" );
    	glDeleteObjectARB = (PFNGLDELETEOBJECTARBPROC)wglGetProcAddress( "glDeleteObjectARB" );
    	glLinkProgramARB = (PFNGLLINKPROGRAMARBPROC)wglGetProcAddress( "glLinkProgramARB" );
    	glGetActiveUniformARB = (PFNGLGETACTIVEATTRIBARBPROC)wglGetProcAddress( "glGetActiveUniformARB" );
     
    	GLhandleARB po = glCreateProgramObjectARB();
    	GLhandleARB so = glCreateShaderObjectARB( GL_FRAGMENT_SHADER_ARB );
    	glShaderSourceARB( so, 1, &amp;shaderSrc, 0 );
    	glCompileShaderARB( so );
    	glAttachObjectARB( po, so );
    	glDeleteObjectARB( so );
    	glLinkProgramARB( po );
     
    	GLsizei length;
    	GLint size;
    	GLenum type;
    	GLcharARB name[256];
    	glGetActiveUniformARB( po, 0, sizeof(name), &amp;length, &amp;size, &amp;type, name );
     
    	if( type == GL_TEXTURE_RECTANGLE_ARB )
    		std::cout << "type == GL_TEXTURE_RECTANGLE_ARB\n";
     
    	return 0;
    }

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

    Re: glGetActiveUniformARB and sampler2DRect (nvidia)

    You're funny. Returning GL_SAMPLER_2D_RECT_ARB isn't possible because it doesn't exist, yet, because sampler2DRect is reserved for future use.
    Returning GL_TEXTURE_RECTANGLE seems just a placeholder until GLSL specs rectangle textures.

  3. #3

    Re: glGetActiveUniformARB and sampler2DRect (nvidia)

    Originally posted by Relic:
    Returning GL_SAMPLER_2D_RECT_ARB isn't possible because it doesn't exist.
    GL_SAMPLER_2D_RECT_ARB exists, from ARB_shader_objects spec (http://oss.sgi.com/projects/ogl-samp...er_objects.txt):
    Returned by the <type> parameter of GetActiveUniformARB:
    ...
    SAMPLER_2D_RECT_ARB 0x8B63
    ...

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

    Re: glGetActiveUniformARB and sampler2DRect (nvidia)

    Hehe, thanks, that teaches me to not only look into the GL 2.0 spec.

  5. #5
    Advanced Member Frequent Contributor
    Join Date
    Jan 2001
    Location
    NVIDIA, Austin, TX
    Posts
    555

    Re: glGetActiveUniformARB and sampler2DRect (nvidia)

    A fix for this will be available in a future NVIDIA driver update.

Posting Permissions

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