This commit is contained in:
bkaradzic 2013-07-12 22:27:46 -07:00
parent 85e4c37d80
commit f59ba947cb
6 changed files with 59 additions and 1 deletions

View File

@ -13,6 +13,7 @@ all:
premake4 --file=premake/premake4.lua --gcc=mingw gmake
premake4 --file=premake/premake4.lua --gcc=linux gmake
premake4 --file=premake/premake4.lua --gcc=osx gmake
premake4 --file=premake/premake4.lua --gcc=ios gmake
premake4 --file=premake/premake4.lua --gcc=qnx-arm gmake
premake4 --file=premake/premake4.lua xcode4
make -s --no-print-directory -C src

View File

@ -35,7 +35,7 @@ project "bgfx"
BGFX_DIR .. "src/**.mm",
}
configuration { "vs* or linux or mingw or osx" }
configuration { "vs* or linux or mingw or osx or ios" }
includedirs {
--nacl has GLES2 headers modified...
BGFX_DIR .. "3rdparty/glext",

View File

@ -102,6 +102,13 @@ function exampleProject(_name, _uuid)
"OpenGL.framework",
}
configuration { "ios" }
linkoptions {
"-framework CoreFoundation",
"-framework Foundation",
"-framework OpenGLES",
}
configuration { "qnx*" }
targetextension ""
links {

38
src/glcontext_ios.h Executable file
View File

@ -0,0 +1,38 @@
/*
* Copyright 2011-2013 Branimir Karadzic. All rights reserved.
* License: http://www.opensource.org/licenses/BSD-2-Clause
*/
#ifndef __GLCONTEXT_NSGL_H__
#define __GLCONTEXT_NSGL_H__
#if BX_PLATFORM_IOS
namespace bgfx
{
struct GlContext
{
GlContext()
: m_context(0)
{
}
void create(uint32_t _width, uint32_t _height);
void destroy();
void resize(uint32_t _width, uint32_t _height, bool _vsync);
void swap();
void import();
bool isValid() const
{
return 0 != m_context;
}
void* m_view;
void* m_context;
};
} // namespace bgfx
#endif // BX_PLATFORM_IOS
#endif // __GLCONTEXT_NSGL_H__

View File

@ -159,6 +159,16 @@ namespace bgfx
}
#endif // BGFX_CONFIG_DEBUG_GREMEDY
#if BX_PLATFORM_IOS
PFNGLBINDVERTEXARRAYOESPROC glBindVertexArrayOES = NULL;
PFNGLDELETEVERTEXARRAYSOESPROC glDeleteVertexArraysOES = NULL;
PFNGLGENVERTEXARRAYSOESPROC glGenVertexArraysOES = NULL;
PFNGLPROGRAMBINARYOESPROC glProgramBinaryOES = NULL;
PFNGLGETPROGRAMBINARYOESPROC glGetProgramBinaryOES = NULL;
PFLGLDRAWARRAYSINSTANCEDANGLEPROC glDrawArraysInstanced = NULL;
PFLGLDRAWELEMENTSINSTANCEDANGLEPROC glDrawElementsInstanced = NULL;
#endif // BX_PLATFORM_IOS
typedef void (*PostSwapBuffersFn)(uint32_t _width, uint32_t _height);
static void rgbaToBgra(uint8_t* _data, uint32_t _width, uint32_t _height)

View File

@ -211,6 +211,8 @@ typedef void (*PFNGLGETTRANSLATEDSHADERSOURCEANGLEPROC)(GLuint shader, GLsizei b
# include "glcontext_glx.h"
#elif BX_PLATFORM_OSX
# include "glcontext_nsgl.h"
#elif BX_PLATFORM_IOS
# include "glcontext_ios.h"
#endif // BX_PLATFORM_
#if BGFX_CONFIG_DEBUG_GREMEDY && (BX_PLATFORM_WINDOWS || BX_PLATFORM_LINUX)