Commit 8398735f authored by lrz's avatar lrz

Changes to compile in IOS

parent c745120f
...@@ -69,6 +69,10 @@ GLuint CompileGLShader( const char *pchShaderName, const char *pchVertexShader, ...@@ -69,6 +69,10 @@ GLuint CompileGLShader( const char *pchShaderName, const char *pchVertexShader,
//tess //tess
if (pchTessEvalShader) { if (pchTessEvalShader) {
#if defined (__APPLE__) && !defined (GL_TESS_EVALUATION_SHADER)
eprintf ("Tess Eval Shaders unsupported on IOS");
return 0;
#else
GLuint nSceneTessShader = glCreateShader(GL_TESS_EVALUATION_SHADER); GLuint nSceneTessShader = glCreateShader(GL_TESS_EVALUATION_SHADER);
glShaderSource(nSceneTessShader, 1, &pchTessEvalShader, nullptr); glShaderSource(nSceneTessShader, 1, &pchTessEvalShader, nullptr);
glCompileShader(nSceneTessShader); glCompileShader(nSceneTessShader);
...@@ -88,6 +92,7 @@ GLuint CompileGLShader( const char *pchShaderName, const char *pchVertexShader, ...@@ -88,6 +92,7 @@ GLuint CompileGLShader( const char *pchShaderName, const char *pchVertexShader,
} }
glAttachShader(unProgramID, nSceneTessShader); glAttachShader(unProgramID, nSceneTessShader);
glDeleteShader(nSceneTessShader); // the program hangs onto this once it's attached glDeleteShader(nSceneTessShader); // the program hangs onto this once it's attached
#endif
} }
glLinkProgram( unProgramID ); glLinkProgram( unProgramID );
......
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
#include <algorithm> #include <algorithm>
#include <errno.h> #include <errno.h>
#include <string.h> #include <string.h>
#include <stdlib.h>
#include "ConfigFile.h" #include "ConfigFile.h"
#include "atoms.hpp" #include "atoms.hpp"
......
...@@ -305,8 +305,13 @@ bool SetupDepthPeeling(int renderWidth, int renderHeight, int zlayers, GLuint *t ...@@ -305,8 +305,13 @@ bool SetupDepthPeeling(int renderWidth, int renderHeight, int zlayers, GLuint *t
glTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT32, renderWidth, renderHeight, 0, glTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT32, renderWidth, renderHeight, 0,
GL_DEPTH_COMPONENT, GL_UNSIGNED_BYTE, 0); GL_DEPTH_COMPONENT, GL_UNSIGNED_BYTE, 0);
#else // 32 unsupported in GLES 3.0 #else // 32 unsupported in GLES 3.0
#ifdef __APPLE__
glTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT, renderWidth, renderHeight, 0,
GL_DEPTH_COMPONENT, GL_FLOAT, 0);
#else
glTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT32F, renderWidth, renderHeight, 0, glTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT32F, renderWidth, renderHeight, 0,
GL_DEPTH_COMPONENT, GL_FLOAT, 0); GL_DEPTH_COMPONENT, GL_FLOAT, 0);
#endif
#endif #endif
if ((e = glGetError()) != GL_NO_ERROR) if ((e = glGetError()) != GL_NO_ERROR)
......
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
#define __MYGL_H #define __MYGL_H
//FIXME, support more platforms in the future //FIXME, support more platforms in the future
#ifndef __APPLE__
#if defined(WIN32) || defined(CAVE) #if defined(WIN32) || defined(CAVE)
#include <GL/glew.h> #include <GL/glew.h>
#else // Samsung GearVR + Oculus Mobile #else // Samsung GearVR + Oculus Mobile
...@@ -36,5 +37,15 @@ ...@@ -36,5 +37,15 @@
#define GL_DEPTH_COMPONENT32 GL_DEPTH_COMPONENT32_OES #define GL_DEPTH_COMPONENT32 GL_DEPTH_COMPONENT32_OES
#endif #endif
#endif //WIN32 #endif //WIN32
#else //__APPLE__
//#include <OpenGLES/EAGL.h>
#include <OpenGLES/ES3/gl.h>
#include <OpenGLES/ES3/glext.h>
//#ifndef glGenVertexArrays
//#define glGenVertexArrays glGenVertexArraysOES
//#define glBindVertexArray glBindVertexArrayOES
//#define glDeleteVertexArrays glDeleteVertexArraysOES
//#endif
#endif //__APPLE__
#endif //__MYGL_H #endif //__MYGL_H
...@@ -60,7 +60,11 @@ GLenum atomTexture(GLuint t) ...@@ -60,7 +60,11 @@ GLenum atomTexture(GLuint t)
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA32F, finalatoms, 1, 0, GL_RGBA, GL_FLOAT, a); #ifdef __APPLE__
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, finalatoms, 1, 0, GL_RGBA, GL_FLOAT, a);
#else
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA32F, finalatoms, 1, 0, GL_RGBA, GL_FLOAT, a);
#endif
glBindTexture( GL_TEXTURE_2D, 0 ); glBindTexture( GL_TEXTURE_2D, 0 );
if ((e = glGetError()) != GL_NO_ERROR) { if ((e = glGetError()) != GL_NO_ERROR) {
......
...@@ -90,8 +90,8 @@ const int Tetrahedron::Faces[] = { ...@@ -90,8 +90,8 @@ const int Tetrahedron::Faces[] = {
const int Tetrahedron::nVerts = 4; const int Tetrahedron::nVerts = 4;
const float Tetrahedron::Verts[] = { const float Tetrahedron::Verts[] = {
sqrt(2.0f)/sqrt(3.0f)*1, 0, -1.0f/sqrt(3.0f), sqrtf(2.0f)/sqrtf(3.0f)*1.0f, 0.0f, -1.0f/sqrtf(3.0f),
-sqrt(2.0f) / sqrt(3.0f) * 1, 0, -1.0f / sqrt(3.0f), -sqrtf(2.0f) / sqrtf(3.0f) * 1.0f, 0.0f, -1.0f / sqrtf(3.0f),
0, sqrt(2.0f)/sqrt(3.0f), 1.0f / sqrt(3.0f), 0.0f, sqrtf(2.0f)/sqrtf(3.0f), 1.0f / sqrtf(3.0f),
0, -sqrt(2.0f) / sqrt(3.0f), 1.0f / sqrt(3.0f), 0.0f, -sqrtf(2.0f) / sqrtf(3.0f), 1.0f / sqrtf(3.0f),
}; };
\ No newline at end of file
...@@ -20,6 +20,8 @@ ...@@ -20,6 +20,8 @@
#ifndef __POLYHEDRON_H #ifndef __POLYHEDRON_H
#define __POLYHEDRON_H #define __POLYHEDRON_H
#include <math.h>
class Icosahedron { class Icosahedron {
public: public:
static const int nFaces; static const int nFaces;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment