PDA

View Full Version : OpenGL 3.0 - question



Amikam
02-28-2009, 03:23 AM
Hi all,

I am not sure I understand the deprication mechanism (it is intersting me).
Suppose I have the following lines:

glEnableClientState(GL_VERTEX_ARRAY);
glEnableClientState(GL_COLOR_ARRAY);

glVertexPointer(3,GL_FLOAT,sizeof(Vertex),polygon) ;
glColorPointer(3,GL_FLOAT,sizeof(Vertex),&polygon[0].r);

glDrawArrays(GL_POLYGON,0,6);

glDisableClientState(GL_COLOR_ARRAY);
glDisableClientState(GL_VERTEX_ARRAY);

(I filled the polygon array before).
In OpenGL 3.0 and above we will have to fragment shader in stead of glColor ?

Thanks

Jan
02-28-2009, 03:38 AM
yes

martinsm
02-28-2009, 04:31 AM
Above code will not work in forward compatible context if your polygon array is in client memory (vertex array). You must use VBO to store vertex data.
Also functions glVertexPointer and glColorPointer is deprected - you can not use them. You must muse generic vertex attributes - glVertexAttribPointer function. Read here: http://www.opengl.org/discussion_boards/ubbthreads.php?ubb=showflat&Main=49081&Number=252276

Amikam
02-28-2009, 06:23 AM
Thanks