tags:

views:

38

answers:

1
+2  Q: 

Cg and OpenGL 3

Hi,

I'm currently learning the differences between OpenGL 2 and 3, and I noticed that many functions like glVertex, glVertexPointer, glColor, glColorPointer, etc. have disappeared.

I'm used to using Cg to handle shaders. For example I'd write this simple vertex shader:

void main(in inPos : POSITION, out outPos : POSITION) {
    outPos = inPos;
}

And then I'd use either glVertex or glVertexPointer to set the values of inPos.

But since these functions are no longer available in OpenGL 3, how are you supposed to do the bindings?

A: 

First I'll recommend you to take a look at the answer to this question: What's so different about OpenGL 3.x?

Secondly, Norbert Nopper has lots of examples on using OpenGL 3 and GLSL here

Finally here's a simple GLSL example which shows you how to bind both a vertex and a fragment shader program.

Tchami
But what if I want to use Cg syntax? :-/ (not because I prefer it, but because it's almost the same syntax as HLSL)
Tomaka17
Tchami
Thanks, the second link is exactly what I was looking for
Tomaka17