2

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?

Tomaka17
  • 4,832
  • 5
  • 29
  • 38

1 Answers1

0

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.

Community
  • 1
  • 1
Tchami
  • 4,647
  • 1
  • 32
  • 45
  • 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 Sep 09 '10 at 14:13
  • Take a look at http://nehe.gamedev.net/data/lessons/lesson.asp?lesson=47. Also this post http://www.opengl.org/discussion_boards/ubbthreads.php?ubb=showflat&Number=267914 on the OpenGL forums. – Tchami Sep 09 '10 at 14:56
  • Thanks, the second link is exactly what I was looking for – Tomaka17 Sep 10 '10 at 06:05