From 8923057d0ebd0f6cf2b8d6c5115a2288593bed67 Mon Sep 17 00:00:00 2001 From: Andrzej Kapolka Date: Fri, 3 May 2013 13:00:48 -0700 Subject: [PATCH 1/5] Compile fix, need to use integer GL uniform. --- interface/src/main.cpp | 4 ++-- pairing-server/src/main.cpp | 5 ++++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/interface/src/main.cpp b/interface/src/main.cpp index 7bf7a181ff..78cc08485b 100644 --- a/interface/src/main.cpp +++ b/interface/src/main.cpp @@ -847,13 +847,13 @@ void displayOculus(Camera& whichCamera) { glDisable(GL_BLEND); glEnable(GL_TEXTURE_2D); glUseProgramObjectARB(::oculusProgramID); - glUniform1fARB(textureLocation, 0); + glUniform1iARB(textureLocation, 0); glUniform2fARB(lensCenterLocation, 0.287994, 0.5); // see SDK docs, p. 29 glUniform2fARB(screenCenterLocation, 0.25, 0.5); glUniform2fARB(scaleLocation, 0.25 * scaleFactor, 0.5 * scaleFactor * aspectRatio); glUniform2fARB(scaleInLocation, 4, 2 / aspectRatio); glUniform4fARB(hmdWarpParamLocation, 1.0, 0.22, 0.24, 0); - + glColor3f(1, 0, 1); glBegin(GL_QUADS); glTexCoord2f(0, 0); diff --git a/pairing-server/src/main.cpp b/pairing-server/src/main.cpp index a17f425443..4273d561c6 100644 --- a/pairing-server/src/main.cpp +++ b/pairing-server/src/main.cpp @@ -9,6 +9,9 @@ #include #include +#include +#include + #include #include @@ -101,4 +104,4 @@ int main(int argc, const char* argv[]) { } } -} \ No newline at end of file +} From bc0c1cf5f92d488837ea6349ed9235046e448c37 Mon Sep 17 00:00:00 2001 From: Andrzej Kapolka Date: Fri, 3 May 2013 15:44:51 -0700 Subject: [PATCH 2/5] Fixed bug with rendering stars on OS X: was using some weird extension on Apple rather than standard VBOs. --- interface/src/starfield/renderer/Renderer.h | 32 ++++++--------------- 1 file changed, 9 insertions(+), 23 deletions(-) diff --git a/interface/src/starfield/renderer/Renderer.h b/interface/src/starfield/renderer/Renderer.h index 9d363a6262..8e9c45bc78 100644 --- a/interface/src/starfield/renderer/Renderer.h +++ b/interface/src/starfield/renderer/Renderer.h @@ -459,11 +459,6 @@ namespace starfield { private: // gl API handling -#ifdef __APPLE__ -# define glBindVertexArray glBindVertexArrayAPPLE -# define glGenVertexArrays glGenVertexArraysAPPLE -# define glDeleteVertexArrays glDeleteVertexArraysAPPLE -#endif void glAlloc() { GLchar const* const VERTEX_SHADER = @@ -487,26 +482,21 @@ namespace starfield { _objProgram.addShader(GL_FRAGMENT_SHADER, FRAGMENT_SHADER); _objProgram.link(); - glGenVertexArrays(1, & _hndVertexArray); + glGenBuffersARB(1, & _hndVertexArray); } void glFree() { - glDeleteVertexArrays(1, & _hndVertexArray); + glDeleteBuffersARB(1, & _hndVertexArray); } void glUpload(GLsizei n) { - - GLuint vbo; - glGenBuffers(1, & vbo); - - glBindVertexArray(_hndVertexArray); - glBindBuffer(GL_ARRAY_BUFFER, vbo); + glBindBufferARB(GL_ARRAY_BUFFER, _hndVertexArray); glBufferData(GL_ARRAY_BUFFER, n * sizeof(GpuVertex), _arrData, GL_STATIC_DRAW); - glInterleavedArrays(GL_C4UB_V3F, sizeof(GpuVertex), 0l); + //glInterleavedArrays(GL_C4UB_V3F, sizeof(GpuVertex), 0l); - glBindVertexArray(0); + glBindBufferARB(GL_ARRAY_BUFFER, 0); } void glBatch(GLfloat const* matrix, GLsizei n_ranges) { @@ -538,14 +528,15 @@ namespace starfield { // select shader and vertex array _objProgram.activate(); - glBindVertexArray(_hndVertexArray); - + glBindBufferARB(GL_ARRAY_BUFFER, _hndVertexArray); + glInterleavedArrays(GL_C4UB_V3F, sizeof(GpuVertex), 0l); + // render glMultiDrawArrays(GL_POINTS, _arrBatchOffs, _arrBatchCount, n_ranges); // restore state - glBindVertexArray(0); + glBindBufferARB(GL_ARRAY_BUFFER, 0); glUseProgram(0); glDisable(GL_VERTEX_PROGRAM_POINT_SIZE); glDisable(GL_POINT_SMOOTH); @@ -553,11 +544,6 @@ namespace starfield { glMatrixMode(GL_MODELVIEW); glPopMatrix(); } -#ifdef __APPLE__ -# undef glBindVertexArray -# undef glGenVertexArrays -# undef glDeleteVertexArrays -#endif }; } // anonymous namespace From 861e78f16187ca5055e5437ca26e92bd9d335c15 Mon Sep 17 00:00:00 2001 From: Andrzej Kapolka Date: Fri, 3 May 2013 15:47:03 -0700 Subject: [PATCH 3/5] Removed my temporary fix for pairing server bits. --- pairing-server/src/main.cpp | 3 --- 1 file changed, 3 deletions(-) diff --git a/pairing-server/src/main.cpp b/pairing-server/src/main.cpp index e2ab16b343..6729c88ea9 100644 --- a/pairing-server/src/main.cpp +++ b/pairing-server/src/main.cpp @@ -11,9 +11,6 @@ #include #include -#include -#include - #include #include From 34a5293b130435666bee359064984abaff1ac743 Mon Sep 17 00:00:00 2001 From: Andrzej Kapolka Date: Fri, 3 May 2013 15:48:34 -0700 Subject: [PATCH 4/5] Added newline at end of file; just trying to get this file out of the diff. --- pairing-server/src/main.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/pairing-server/src/main.cpp b/pairing-server/src/main.cpp index 6729c88ea9..3ce50f5706 100644 --- a/pairing-server/src/main.cpp +++ b/pairing-server/src/main.cpp @@ -104,3 +104,4 @@ int main(int argc, const char* argv[]) { } } + From 6389f0bc1349c37aa8309219cad7261d37ad5e21 Mon Sep 17 00:00:00 2001 From: Andrzej Kapolka Date: Fri, 3 May 2013 15:49:31 -0700 Subject: [PATCH 5/5] OK, I give up. --- pairing-server/src/main.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/pairing-server/src/main.cpp b/pairing-server/src/main.cpp index 3ce50f5706..6729c88ea9 100644 --- a/pairing-server/src/main.cpp +++ b/pairing-server/src/main.cpp @@ -104,4 +104,3 @@ int main(int argc, const char* argv[]) { } } -