diff mbox

[Branch,~glmark2-dev/glmark2/trunk] Rev 38: Replace *ARB functions and constants with their OpenGL (ES) 2.0 equivalents.

Message ID 20110721123632.17019.65215.launchpad@loganberry.canonical.com
State Accepted
Headers show

Commit Message

Alexandros Frantzis July 21, 2011, 12:36 p.m. UTC
------------------------------------------------------------
revno: 38
committer: Alexandros Frantzis <alf82@freemail.gr>
timestamp: Mon 2010-07-12 11:05:45 +0300
message:
  Replace *ARB functions and constants with their OpenGL (ES) 2.0 equivalents.
modified:
  mesh.cpp
  shader.cpp


--
lp:glmark2
https://code.launchpad.net/~glmark2-dev/glmark2/trunk

You are subscribed to branch lp:glmark2.
To unsubscribe from this branch go to https://code.launchpad.net/~glmark2-dev/glmark2/trunk/+edit-subscription
diff mbox

Patch

=== modified file 'mesh.cpp'
--- mesh.cpp	2010-07-12 07:57:21 +0000
+++ mesh.cpp	2010-07-12 08:05:45 +0000
@@ -108,7 +108,7 @@ 
     glEnableVertexAttribArray(Shader::NormalAttribLocation);
     glEnableVertexAttribArray(Shader::TexCoordAttribLocation);
 
-    glBindBufferARB(GL_ARRAY_BUFFER_ARB, 0);
+    glBindBuffer(GL_ARRAY_BUFFER, 0);
     glVertexAttribPointer(Shader::VertexAttribLocation, 3, GL_FLOAT,
                           GL_FALSE, sizeof(Vertex), &mVertex[0].v.x);
     glVertexAttribPointer(Shader::NormalAttribLocation, 3, GL_FLOAT,
@@ -146,22 +146,22 @@ 
     }
 
     // Generate And Bind The Vertex Buffer
-    glGenBuffersARB(1, &mVBOVertices);                          // Get A Valid Name
-    glBindBufferARB(GL_ARRAY_BUFFER_ARB, mVBOVertices);         // Bind The Buffer
+    glGenBuffers(1, &mVBOVertices);
+    glBindBuffer(GL_ARRAY_BUFFER, mVBOVertices);
     // Load The Data
-    glBufferDataARB(GL_ARRAY_BUFFER_ARB, mVertexQty * sizeof(Vector3f), vertex, GL_STATIC_DRAW_ARB);
+    glBufferData(GL_ARRAY_BUFFER, mVertexQty * sizeof(Vector3f), vertex, GL_STATIC_DRAW);
 
     // Generate And Bind The normal Buffer
-    glGenBuffersARB(1, &mVBONormals);                          // Get A Valid Name
-    glBindBufferARB(GL_ARRAY_BUFFER_ARB, mVBONormals);         // Bind The Buffer
+    glGenBuffers(1, &mVBONormals);
+    glBindBuffer(GL_ARRAY_BUFFER, mVBONormals);
     // Load The Data
-    glBufferDataARB(GL_ARRAY_BUFFER_ARB, mVertexQty * sizeof(Vector3f), normal, GL_STATIC_DRAW_ARB);
+    glBufferData(GL_ARRAY_BUFFER, mVertexQty * sizeof(Vector3f), normal, GL_STATIC_DRAW);
 
     // Generate And Bind The Texture Coordinate Buffer
-    glGenBuffersARB(1, &mVBOTexCoords);                       // Get A Valid Name
-    glBindBufferARB(GL_ARRAY_BUFFER_ARB, mVBOTexCoords);      // Bind The Buffer
+    glGenBuffers(1, &mVBOTexCoords);
+    glBindBuffer(GL_ARRAY_BUFFER, mVBOTexCoords);
     // Load The Data
-    glBufferDataARB(GL_ARRAY_BUFFER_ARB, mVertexQty * sizeof(Texel), texel, GL_STATIC_DRAW_ARB);
+    glBufferData(GL_ARRAY_BUFFER, mVertexQty * sizeof(Texel), texel, GL_STATIC_DRAW);
 
     glBindBuffer(GL_ARRAY_BUFFER, 0);
 
@@ -179,11 +179,11 @@ 
     glEnableClientState(GL_NORMAL_ARRAY);
     glEnableClientState(GL_TEXTURE_COORD_ARRAY);
 
-    glBindBufferARB(GL_ARRAY_BUFFER_ARB, mVBOVertices);
+    glBindBuffer(GL_ARRAY_BUFFER, mVBOVertices);
     glVertexPointer(3, GL_FLOAT, 0, 0);
-    glBindBufferARB(GL_ARRAY_BUFFER_ARB, mVBONormals);
+    glBindBuffer(GL_ARRAY_BUFFER, mVBONormals);
     glNormalPointer(GL_FLOAT, 0, 0);
-    glBindBufferARB(GL_ARRAY_BUFFER_ARB, mVBOTexCoords);
+    glBindBuffer(GL_ARRAY_BUFFER, mVBOTexCoords);
     glTexCoordPointer(2, GL_FLOAT, 0, 0);
 
     glDrawArrays(GL_TRIANGLES, 0, mVertexQty);
@@ -202,11 +202,11 @@ 
     glEnableVertexAttribArray(Shader::NormalAttribLocation);
     glEnableVertexAttribArray(Shader::TexCoordAttribLocation);
 
-    glBindBufferARB(GL_ARRAY_BUFFER_ARB, mVBOVertices);
+    glBindBuffer(GL_ARRAY_BUFFER, mVBOVertices);
     glVertexAttribPointer(Shader::VertexAttribLocation, 3, GL_FLOAT, GL_FALSE, 0, 0);
-    glBindBufferARB(GL_ARRAY_BUFFER_ARB, mVBONormals);
+    glBindBuffer(GL_ARRAY_BUFFER, mVBONormals);
     glVertexAttribPointer(Shader::NormalAttribLocation, 3, GL_FLOAT, GL_FALSE, 0, 0);
-    glBindBufferARB(GL_ARRAY_BUFFER_ARB, mVBOTexCoords);
+    glBindBuffer(GL_ARRAY_BUFFER, mVBOTexCoords);
     glVertexAttribPointer(Shader::TexCoordAttribLocation, 2, GL_FLOAT, GL_FALSE, 0, 0);
 
     glDrawArrays(GL_TRIANGLES, 0, mVertexQty);

=== modified file 'shader.cpp'
--- shader.cpp	2010-07-09 13:34:12 +0000
+++ shader.cpp	2010-07-12 08:05:45 +0000
@@ -35,8 +35,8 @@ 
     char *vertex_shader_source, *fragment_shader_source;
     char msg[512];
 
-    mVertexShader = glCreateShaderObjectARB(GL_VERTEX_SHADER);
-    mFragmentShader = glCreateShaderObjectARB(GL_FRAGMENT_SHADER);
+    mVertexShader = glCreateShader(GL_VERTEX_SHADER);
+    mFragmentShader = glCreateShader(GL_FRAGMENT_SHADER);
 
     vertex_shader_source = readShaderFile(pVertexShaderFileName);
 
@@ -45,25 +45,25 @@ 
     const char *vs = vertex_shader_source;
     const char *fs = fragment_shader_source;
 
-    glShaderSourceARB(mVertexShader, 1, &vs, NULL);
-    glShaderSourceARB(mFragmentShader, 1, &fs, NULL);
+    glShaderSource(mVertexShader, 1, &vs, NULL);
+    glShaderSource(mFragmentShader, 1, &fs, NULL);
 
     free(vertex_shader_source);
     free(fragment_shader_source);
 
-    glCompileShaderARB(mVertexShader);
+    glCompileShader(mVertexShader);
     glGetShaderInfoLog(mVertexShader, sizeof msg, NULL, msg);
     if (strlen(msg) > 0)
         printf("%s: %s", pVertexShaderFileName, msg);
 
-    glCompileShaderARB(mFragmentShader);
+    glCompileShader(mFragmentShader);
     glGetShaderInfoLog(mFragmentShader, sizeof msg, NULL, msg);
     if (strlen(msg) > 0)
         printf("%s: %s\n", pFragmentShaderFileName, msg);
 
-    mShaderProgram = glCreateProgramObjectARB();
-    glAttachObjectARB(mShaderProgram, mFragmentShader);
-    glAttachObjectARB(mShaderProgram, mVertexShader);
+    mShaderProgram = glCreateProgram();
+    glAttachShader(mShaderProgram, mFragmentShader);
+    glAttachShader(mShaderProgram, mVertexShader);
     glBindAttribLocation(mShaderProgram, VertexAttribLocation, "position");
     glBindAttribLocation(mShaderProgram, NormalAttribLocation, "normal");
     glBindAttribLocation(mShaderProgram, TexCoordAttribLocation, "texcoord");
@@ -121,22 +121,22 @@ 
 
 void Shader::use()
 {
-    glUseProgramObjectARB(mShaderProgram);
+    glUseProgram(mShaderProgram);
 }
 
 void Shader::remove()
 {
-    glUseProgramObjectARB(0);
+    glUseProgram(0);
 }
 
 void Shader::unload()
 {
-    glDetachObjectARB(mShaderProgram, mVertexShader);
-    glDetachObjectARB(mShaderProgram, mFragmentShader);
+    glDetachShader(mShaderProgram, mVertexShader);
+    glDetachShader(mShaderProgram, mFragmentShader);
     
-    glDeleteObjectARB(mVertexShader);
-    glDeleteObjectARB(mFragmentShader);
-    glDeleteObjectARB(mShaderProgram);
+    glDeleteShader(mVertexShader);
+    glDeleteShader(mFragmentShader);
+    glDeleteShader(mShaderProgram);
 
     mVertexShader = 0;
     mFragmentShader = 0;