Results 1 to 8 of 8

Thread: OpenGL GLSL glGetProgramiv returns invalid value in Catalyst 10.3

  1. #1
    Join Date
    Apr 2010
    Posts
    72

    OpenGL GLSL glGetProgramiv returns invalid value in Catalyst 10.3

    For a 3D engine that I developed I wish to implement the shader, what I have now done, but when I want to test the program, it can not be bound. I am using the Catalyst 10.3 and the glGetProgramiv is returning invalid value into that. Can anyone know what can be the issue.?? Please help me as soon as possible.!! Also please tell me more about the implementation of GLSL shaders.!!

  2. #2
    Join Date
    Mar 2008
    Posts
    433

    Re: OpenGL GLSL glGetProgramiv returns invalid value in Catalyst 10.3

    I am providing some rough code for your 3D engine, but I am sure that it will definitely help you :
    main.cpp
    Code:
    srl:: Shader1 FS (GL_FRAGMENT_SHADER_ARB);
     srl:: Shader1 VS (GL_VERTEX_SHADER_ARB);
     if (! FS. SourceAndCompile ("Data / ShaderTerrain.fs")) printf ("Unable <Error> compile the fragment shader1 \ n"); / / These are not errors and consequent, are compiled shader
     if (! VS. SourceAndCompile ("Data / ShaderTerrain.vs")) printf ("Unable <Error> compile the vertex shader1 \ n"); 
    
     srl:: Program Prg (& VS & FS);
     if (! Prg. IsLinked ()) printf
    Program.cpp
    Code:
    Program:: Program (LLP:: Shader1 * sh1, LLP:: Shader1 * sh2) (
         id = glCreateProgramObject ();
         if (sh1! = 0) glAttachObject (id, sh1 -> id);
         if (sh2! = 0) glAttachObject (id, sh2 -> id);
         if (sh1! sh2 = 0 & &! = 0) (
             glLinkProgram (id);
             IsLinked ();
         )
     )
     bool Program:: IsLinked () (
         Glint success;
         glGetProgramiv (id, GL_LINK_STATUS, & success);
         Linked = (success == GL_TRUE)? True: false;
         Linked return;
     )
     std:: string Program:: Log () (
         Glint logsize;
         glGetProgramiv (id, GL_INFO_LOG_LENGTH, & logsize);
         char * log = NULL;
         log = (char *) malloc (logsize + 1);
         glGetProgramInfoLog (id, logsize, & logsize, log);
         return log;
     )

  3. #3
    Join Date
    Feb 2008
    Posts
    121

    Re: OpenGL GLSL glGetProgramiv returns invalid value in Catalyst 10.3

    I think that the coding provided by the 'Samra', should work. I have not checked it practically but looking at the code I think that it is perfect. It is important to distinguish two different types of shaders, filling each well-defined functions and no identical :
    • vertex shaders : Shader are involved in processing each vertex. In the vertex shader you can change the calculation of the various attributes of your summits
    • pixel shaders : also called fragment shaders, they can handle the rendering of each pixel that is displayed on the screen. They offer great flexibility in the field of 3D rendering.

  4. #4
    Join Date
    Feb 2008
    Posts
    129

    Re: OpenGL GLSL glGetProgramiv returns invalid value in Catalyst 10.3

    As long as you know to think logically, programming a shader should not cause you any problem. That has really not rocket science, and if you master time is a little programming a procedural language like C, you'll find that it resembles the GLSL. Indeed, the GLSL is a language closely resembling the C language. However, it is imperative to distinguish between two important things :
    • programming of a GLSL shader;
    • its use within an OpenGL application.

  5. #5
    Join Date
    Feb 2008
    Posts
    180

    Re: OpenGL GLSL glGetProgramiv returns invalid value in Catalyst 10.3

    The two important things mentioned by the tomstonsils, are totally different, it's essential to make the distinction between them. We share a shader programming itself, that is to say the coding of the function it will perform, the graphic effect it will produce, on the other hand the definition of its use, when and how to use it in our application. We can compare this with the use of textures, we have a hand in creating the texture, the creation of the image using a 2D drawing software, and other loading and use of this texture in our program. The idea is the same for the shaders, we will first set a shader, we will place its code in a file, then we will schedule our OpenGL application and will charge it via the source code for our shader to use at our convenience in our program.

  6. #6
    Join Date
    Jan 2009
    Posts
    150

    Re: OpenGL GLSL glGetProgramiv returns invalid value in Catalyst 10.3

    0 is a valid lease, since its the first and only uniform in your fragment program. If you get -1, Then You Know Something Is Wrong. As far as I can see, the code looks correct. However, one thing I found out GLSL shader When doing debugging code and if a Variable Is That Is Not Used in the shader to the output derived Somehow either 'ITS optimized out by the compiler. For example, Even if you sample from texture and you do not use the return value to Produce the output of the fragment program either 'Will return -1 glGetUniform calling for the sampler location. What Does gl_FragDepth = float; do? I'm Assuming you left something out Since You can not assign a type have a value.

  7. #7
    Join Date
    Jan 2008
    Posts
    3,755

    Re: OpenGL GLSL glGetProgramiv returns invalid value in Catalyst 10.3

    In your main function, in the while loop when you use your shader you declare the following code :
    Code:
     glUseProgram (program);
         glActiveTexture (GL_TEXTURE1);
         glBindTexture (textureParameters. texTarget, texture);
         glUniform1i (texLoc, 1);
         glBindTexture (textureParameters. texTarget, 0);
    In fact the made to:
    glBindTexture (textureParameters.texTarget, texture);
    then
    glBindTexture (textureParameters.texTarget, 0)

  8. #8
    Join Date
    May 2008
    Posts
    4,831

    Re: OpenGL GLSL glGetProgramiv returns invalid value in Catalyst 10.3

    OK, i try different way to transfer Other data. I transfer succeeds to float like this :
    Code:
    uniform float alpha;
     void main (void)
     (
    	
    	 gl_FragColor gl_Color = / / is that simple	
    	 gl_FragDepth = alpha;
     )
    with this part of code Before rendering :
    Code:
     glUseProgram (program);
     glUniform1f (glGetUniformLocation (program, "Alpha"), 0666);

Similar Threads

  1. Catalyst Overdrive tabs not working after installing Catalyst 10.6
    By Lakshmidhar in forum Monitor & Video Cards
    Replies: 4
    Last Post: 19-06-2010, 02:47 PM
  2. GLSL shaders issues in Catalyst 10.3 and Stream 2.01
    By Mulan in forum Monitor & Video Cards
    Replies: 7
    Last Post: 06-06-2010, 05:17 AM
  3. Replies: 6
    Last Post: 02-06-2010, 11:03 PM
  4. Ati Catalyst OpenGL 4.0
    By ANSEL in forum Monitor & Video Cards
    Replies: 4
    Last Post: 31-05-2010, 05:36 PM
  5. Catalyst Software 7.8 CRT invalid display type
    By RAIDEN in forum Operating Systems
    Replies: 3
    Last Post: 16-04-2009, 07:45 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,714,308,016.60679 seconds with 17 queries