aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/library_gl.js18
-rw-r--r--tests/cubegeom.c5
2 files changed, 21 insertions, 2 deletions
diff --git a/src/library_gl.js b/src/library_gl.js
index 936eaf52..8cebfc89 100644
--- a/src/library_gl.js
+++ b/src/library_gl.js
@@ -1471,6 +1471,20 @@ var LibraryGL = {
assert(id == 0);
},
+ glGetPointerv: function(name, p) {
+ var attribute;
+ switch(name) {
+ case 0x808E: // GL_VERTEX_ARRAY_POINTER
+ attribute = GLImmediate.clientAttributes[GLImmediate.VERTEX]; break;
+ case 0x8090: // GL_COLOR_ARRAY_POINTER
+ attribute = GLImmediate.clientAttributes[GLImmediate.COLOR]; break;
+ case 0x8092: // GL_TEXTURE_COORD_ARRAY_POINTER
+ attribute = GLImmediate.clientAttributes[GLImmediate.TEXTURE0]; break;
+ default: throw 'TODO: glGetPointerv for ' + name;
+ }
+ {{{ makeSetValue('p', '0', 'attribute ? attribute.pointer : 0', 'i32') }}};
+ },
+
// GL Immediate mode
$GLImmediate__postset: 'GL.immediate.setupFuncs(); Browser.moduleContextCreatedCallbacks.push(function() { GL.immediate.init() });',
@@ -2688,7 +2702,7 @@ var LibraryGL = {
glVertexAttribPointer__sig: 'viiiiii',
glCheckFramebufferStatus__sig: 'ii',
glRenderbufferStorage__sig: 'viiii',
-
+
// Open GLES1.1 compatibility
glGenFramebuffersOES : 'glGenFramebuffers',
glGenRenderbuffersOES : 'glGenRenderbuffers',
@@ -2700,7 +2714,7 @@ var LibraryGL = {
glCheckFramebufferStatusOES : 'glCheckFramebufferStatus',
glDeleteFramebuffersOES : 'glDeleteFramebuffers',
glDeleteRenderbuffersOES : 'glDeleteRenderbuffers'
-
+
};
// Simple pass-through functions. Starred ones have return values. [X] ones have X in the C name but not in the JS name
diff --git a/tests/cubegeom.c b/tests/cubegeom.c
index c137ad80..1e5de47c 100644
--- a/tests/cubegeom.c
+++ b/tests/cubegeom.c
@@ -207,6 +207,11 @@ int main(int argc, char *argv[])
glNormalPointer(GL_BYTE, 32, (void*)12);
glColorPointer(4, GL_UNSIGNED_BYTE, 32, (void*)28);
+ int temp; // test glGetPointerv
+ glGetPointerv(GL_VERTEX_ARRAY_POINTER, &temp); assert(temp == 0);
+ glGetPointerv(GL_COLOR_ARRAY_POINTER, &temp); assert(temp == 28);
+ glGetPointerv(GL_TEXTURE_COORD_ARRAY_POINTER, &temp); assert(temp == 16);
+
glBindTexture(GL_TEXTURE_2D, texture); // diffuse?
glActiveTexture(GL_TEXTURE0);
glActiveTexture(GL_TEXTURE1);