OpenGL-ES : Shaders and Programs

1. What are shader and program objects?

The shader object is an object that contains a single shader. The source code is given to the shader object and then the shader object is compiled into object form.

Then the shader object is attached to a program object.

2.Explain the Process.

1. glCreateShader(type) // Create a shader type: vertex or fragment

2. glShaderSource();//bind the shader code to the object

3. glCompileshader(); // compile the shaders

4. glCreateProgram(); // Create a program

5. glAttachShader(program, shader); // Attach shader to program

6. glLinkProgram(program); // handle the program object to link

7. glUseProgram(program); //Set the Active program

3.What do you have to remember when it comes to Uniforms?

Uniforms are variables(???) that store read-only constant values that are passed in by the application through OPenGL-ES API to the shader.

If a uniform is declared in both a vertex and fragment shader, it must have the same type and its value will be the same in both shaders. (Uniforms are shared across a program)

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s