Commit 4e500744 authored by Ilya Prokhorov's avatar Ilya Prokhorov

Android build fix

parent 6a91e5ca
......@@ -21,6 +21,11 @@
#include <GL/glew.h>
#elif CUBE_ART_PROJECT_ANDROID_NDK_BUILD == 1
#define GL_GLEXT_PROTOTYPES 1
#include <SDL_opengles2.h>
#else
#include <GL/glew.h>
......
......@@ -28,6 +28,11 @@
#include <GL/glew.h>
#elif CUBE_ART_PROJECT_ANDROID_NDK_BUILD == 1
#define GL_GLEXT_PROTOTYPES 1
#include <SDL_opengles2.h>
#else
#include <GL/glew.h>
......
......@@ -349,6 +349,7 @@ SDL_Window* OGLNewAgeRenderer::initializeWindow(shared_ptr<IOSystemParams> param
}
#if CUBE_ART_PROJECT_ANDROID_NDK_BUILD != 1
GLenum err = glewInit();
if (GLEW_OK != err)
......@@ -357,10 +358,13 @@ SDL_Window* OGLNewAgeRenderer::initializeWindow(shared_ptr<IOSystemParams> param
fprintf(stderr, "Error: %s\n", glewGetErrorString(err));
}
#endif
SDL_GL_MakeCurrent(window, context);
#if CUBE_ART_PROJECT_ANDROID_NDK_BUILD != 1
glEnable(GL_MULTISAMPLE);
#endif
glEnable(GL_CULL_FACE);
glEnable(GL_DEPTH_TEST);
......
......@@ -20,8 +20,17 @@
#include <FSGL/Data/Model/FSGLModel.h>
#if CUBE_ART_PROJECT_ANDROID_NDK_BUILD == 1
#define GL_GLEXT_PROTOTYPES 1
#include <SDL_opengles2.h>
#else
#include <GL/glew.h>
#endif
#include <glm/glm.hpp>
#include <glm/gtc/matrix_transform.hpp>
......
......@@ -11,7 +11,11 @@ OGLNewAgeRendererElements::OGLNewAgeRendererElements(shared_ptr<FSGLMesh> mesh)
this->mesh = mesh;
glGenBuffers(1, &vbo);
#if CUBE_ART_PROJECT_ANDROID_NDK_BUILD != 1
glGenVertexArrays(1, &vao);
#else
glGenVertexArraysOES(1, &vao);
#endif
glGenBuffers(1, &indexBuffer);
verticesBufferSize = mesh->glVerticesBufferSize;
......@@ -67,8 +71,11 @@ void OGLNewAgeRendererElements::fillTexture()
void OGLNewAgeRendererElements::bind()
{
#if CUBE_ART_PROJECT_ANDROID_NDK_BUILD != 1
glBindVertexArray(vao);
#else
glBindVertexArrayOES(vao);
#endif
glBindBuffer(GL_ARRAY_BUFFER, vbo);
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, indexBuffer);
glBindTexture(GL_TEXTURE_2D, textureBinding);
......@@ -77,8 +84,11 @@ void OGLNewAgeRendererElements::bind()
OGLNewAgeRendererElements::~OGLNewAgeRendererElements()
{
#if CUBE_ART_PROJECT_ANDROID_NDK_BUILD != 1
glDeleteVertexArrays(1, &vao);
#else
glDeleteVertexArraysOES(1, &vao);
#endif
glDeleteBuffers(1, &vbo);
glDeleteBuffers(1, &indexBuffer);
glDeleteTextures(1, &textureBinding);
......
#ifndef FSGLOGLNEWAGERENDERERELEMENTS_H_
#define FSGLOGLNEWAGERENDERERELEMENTS_H_
#if CUBE_ART_PROJECT_ANDROID_NDK_BUILD == 1
#define GL_GLEXT_PROTOTYPES 1
#include <SDL_opengles2.h>
#else
#include <GL/glew.h>
#endif
#include <memory>
using namespace std;
......@@ -34,4 +44,4 @@ private:
};
#endif
\ No newline at end of file
#endif
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