Introduction to OpenGL 3.2

I hope that someone could find this useful. The first (draft) version of the first (in a row) GL 3.2 tutorial can be found on these locations:

http://www.wikiscripts.net/#action=post&id=213 and

http://sites.google.com/site/opengltutorialsbyaks/introduction-to-opengl-3-2—tutorial-01

In fact this is just the preparation for the tutorials that will follow. If you have any suggestions or think that some of the tutorials (that follows) can also be posted on OpenGL/wiki, just say it. :slight_smile:

I have to excuse for the bad design of the pages, but everything will be fixed up soon (I hope).

Unfortunately, I have to announce that my next OpenGL 3.2 tutorial (Tutorial 02 - GLSL 1.5 and the Input Blocks) will have to wait the release of new drivers. Current NV 190.56 beta drivers do not support many of the OpenGL 3.2 built-in functionalities. It will be useless to expose only theory without chance to execute a peace of code.

Current GLSL implementation generates a compilation error if blocks are used. It claims that NV_gpu_shader5 extension should be enabled, but the current drivers do not support that extension.

Eagerly expect next release of NV drivers…

hehe, me too. So I still with 190.38.

This site won’t let you print (to printer/PDF/etc.). Does anybody’s flash let you print this?

http://sites.google.com/site/opengltutorialsbyaks/introduction-to-opengl-3-2—tutorial-01

Thanks for providing a backup site. Much more usable.

The PDF version of the tutorial is now available for downloading. It will be revised as the tutorial changes.

Thanks.

why you are not use gl_FragColor ?

and 2 shaders have #version 150 ??!!! :confused:


// minimal.frag
#version 150 core

in vec3 in_Position;
in vec3 in_Color;
out vec3 ex_Color;

void main(void)
{
      gl_Position = vec4(in_Position, 1.0);
      ex_Color = in_Color;
}


// minimal.frag
#version 150 core

// precision highp float;

in vec3 ex_Color;
out vec4 out_Color;

void main(void)
{
      out_Color = vec4(ex_Color,1.0);
}


gl_FragColor is deprecated built-in variable (since GLSL 1.3). As I have defined that I want only “core” functionality (#version 150 core), GLSL should generate an error if gl_FragColor is used. I know that NVidia’s drivers will accept mixing up of various versions of GLSL and currently ignore profile definition (although anything else than core and compatibility cannot be used as the profile), we should be prepare for the time when profile settings will be obeyed more strictly.

Yes, that means GLSL 1.5 is in use.

Thank you for the questions! They are very useful for updating the tutorial. Obviously I forgot to explicitly state some facts.

this means:

i must write two shaders for my application? ( a shader for GLSL 130+ and another for GLSL 110 and 120)

can i wrote a shader which have two part ( a part for GLSL 130+ and another for GLSL 130- ) for example

#ifdef VERSION_150
// GLSL 1.5
#elif define(ver…)
// GLSL …
.
.
.

change minimal.frag to minimal.vert in your toturial:


And the shaders are exactly the same as in previous tutorial.

// minimal.frag
#version 150 core

in vec3 in_Position;
in vec3 in_Color;
out vec3 ex_Color;

void main(void)
{
      gl_Position = vec4(in_Position, 1.0);
      ex_Color = in_Color;
}

Well, it could be the solution. But now you can use all versions in the same time (I can claim that only for NVidia’s drivers). The other way is to use compatibility profile. As its name implies this mode enables all deprecated functionality and is fully backward compatible. Of course, you cannot use new features that are not implemented in drivers. For example, you can not use input blocks in versions previous to GLSL 1.5. (In fact it cannot be use either in current implementation of GLSL 1.5 but that is another (painful) story.) :slight_smile:

Thank you for the correction! It was a copy/paste error. :frowning:
(It is already corrected on Google-sites. Currently, I cannot login on wikiscripts. But when the site start working it will be corrected too.)

190.57 supports OpenGL3.2 and GLSL1.50 well.

190.57 supports OpenGL3.2 and GLSL1.50 well.

I have already tried the new drivers. So far everything works perfectly! :slight_smile:
So, new tutorials will come soon. :wink:

Hey Aleksandar!

Been looking over your demos and have noticed something.

in the OGL 3.2 version tutorial you never bind a Vertex Array Object.

Now reading through this I find on page 397 it states:

Client vertex and index arrays - all vertex array attribute and element array
index pointers must refer to buffer objects. The default vertex array object
(the name zero) is also deprecated. Calling VertexAttribPointer when no
buffer object or no vertex array object is bound will generate an INVALID_-
OPERATION error, as will calling any array drawing command when no vertex
array object is bound.

I have tested this on my machine (ATI 5870) on a 4.0 context (With shaders disabled) and it works as expected, results are in screenshots, please explain if I am missing something!

Clarification: First screenshot is binding a VAO, second is without.

Cheers, Cryp7ik
(P.S Thanks for the tutes)