Hi Mike,

Attached is a cmake toolchain to build osg against GLES2. You need to
comment lines from 204 - 207 in the CMakeLists.txt:

  #the below is taken from ogre, it states the gcc stuff needs to happen
before PROJECT() is called. I've no clue if we even need it
        # Force gcc <= 4.2 on iPhone
        #include(CMakeForceCompiler)
        #CMAKE_FORCE_C_COMPILER(gcc-4.2 GNU)
        #CMAKE_FORCE_CXX_COMPILER(gcc-4.2 GNU)
        #SET(GCC_THUMB_SUPPORT NO)

And then simply do:
$cmake  -DCMAKE_TOOLCHAIN_FILE=iOS5_GLES2.cmake and make install
or if you prefer to compile in XCode:
 $cmake -GXCode  -DCMAKE_TOOLCHAIN_FILE=iOS5_GLES2.cmake


If it solves your problem please report here and I will try to submit this
with a simple GLES2 example.

Cheers.

2012/3/8 Mike Wozniewski <m...@mikewoz.com>

> Hi Tobias,
>
> Is there any chance you can post your cmake command that builds for OpenGL
> ES2? I tried yours (had to change the SDK to 5.0) but I get a ton of
> compile errors, starting with:
>
> 'glLoadMatrixf' was not declared in this scope
>
> Thanks,
> Mike
>
> ------------------
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=46116#46116
>
>
>
>
>
> _______________________________________________
> osg-users mailing list
> osg-users@lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>



-- 
Jordi Torres Fabra

gvSIG 3D blog
http://gvsig3d.blogspot.com
Instituto de Automática e Informática Industrial
http://www.ai2.upv.es
# force CMake to assume crosscompiling
set(CMAKE_CROSSCOMPILING 1)

# assume we are somewhat on a Darwin system
set(CMAKE_SYSTEM_NAME Darwin)
set(CMAKE_SYSTEM_PROCESSOR arm )

# set the platform flags manually
set(APPLE 1)
set(IOS 1)

# hard set values
set(IOS_SDK_VERSION "5.0")
set(IOS_TARGET "iPhoneOS")
set(IOS_ARCH "armv7")

# some internal values
set(IOS_DEVELOPER_ROOT "/Developer/Platforms/${IOS_TARGET}.platform/Developer")
set(IOS_SDK_ROOT "${IOS_DEVELOPER_ROOT}/SDKs/${IOS_TARGET}${IOS_SDK_VERSION}.sdk")

# for Xcode 4.x we need to set the sysroot to the internal string
if(XCODE)
set(CMAKE_OSX_SYSROOT "${IOS_SDK_ROOT}" CACHE STRING "SDK version" FORCE)
else()
set(CMAKE_OSX_SYSROOT "${IOS_SDK_ROOT}" CACHE STRING "SDK version" FORCE)
endif()

#
set(CMAKE_OSX_ARCHITECTURES "${IOS_ARCH}" CACHE STRING "SDK Architecture" FORCE)

# default to searching for frameworks first
set (CMAKE_FIND_FRAMEWORK FIRST)


# set up the default search directories for frameworks
set (CMAKE_SYSTEM_FRAMEWORK_PATH
${IOS_SDK_ROOT}/System/Library/Frameworks
${IOS_SDK_ROOT}/System/Library/PrivateFrameworks
${IOS_SDK_ROOT}/Developer/Library/Frameworks
)

# set appropriate flags
set(CMAKE_C_FLAGS "--sysroot=${IOS_SDK_ROOT} -miphoneos-version-min=${IOS_SDK_VERSION} -arch ${IOS_ARCH} -v" CACHE STRING "C flags" FORCE)
set(CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS}" CACHE STRING "C++ flags" FORCE)

# specify compiler
set(CMAKE_C_COMPILER "${IOS_DEVELOPER_ROOT}/usr/bin/clang" CACHE PATH "C compiler" FORCE)
set(CMAKE_CXX_COMPILER "${IOS_DEVELOPER_ROOT}/usr/bin/clang++" CACHE PATH "C++ compiler" FORCE)

# for Xcode we need to skip the compiler introspection
if(XCODE)
set(CMAKE_CXX_COMPILER_WORKS TRUE)
set(CMAKE_C_COMPILER_WORKS TRUE)
endif()
# root path settings
set(CMAKE_FIND_ROOT_PATH
${IOS_DEVELOPER_ROOT}
${IOS_SDK_ROOT}/usr
${IOS_SDK_ROOT}/System
)
FIND_LIBRARY(OPENGLES_LIBRARY OpenGLES)
# search paths (for makefiles the first one might be switched to "NEVER")
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)

SET(OSG_WINDOWING_SYSTEM "IOS" CACHE STRING "Forced IPhone windowing system on iOS"  FORCE)
SET(OSG_DEFAULT_IMAGE_PLUGIN_FOR_OSX "imageio" CACHE STRING "Forced imageio default image plugin for iOS" FORCE)

#set OpenGL_ES2 Flags
SET(OSG_BUILD_PLATFORM_IPHONE "ON" CACHE STRING  "Forced iOS Platform" FORCE)
SET(OSG_GL1_AVAILABLE "OFF" CACHE STRING  "Forced for GLES2 compilation" FORCE ) 
SET(OSG_GL2_AVAILABLE "OFF" CACHE STRING  "Forced for GLES2 compilation" FORCE) 
SET(OSG_GLES1_AVAILABLE "OFF" CACHE STRING  "Forced for GLES2 compilation" FORCE)
SET(OSG_GLES2_AVAILABLE "ON" CACHE STRING  "Forced for GLES2 compilation" FORCE)
SET(OSG_GL_DISPLAYLISTS_AVAILABLE "OFF" CACHE STRING  "Forced iOS Platform" FORCE)
SET(OSG_GL_LIBRARY_STATIC "OFF" CACHE STRING  "Forced iOS Platform" FORCE)
SET(OSG_GL_MATRICES_AVAILABLE "OFF" CACHE STRING  "Forced for GLES2 compilation" FORCE)
SET(OSG_GL_VERTEX_ARRAY_FUNCS_AVAILABLE "OFF" CACHE STRING  "Forced for GLES2 compilation" FORCE)
SET(OSG_GL_VERTEX_FUNCS_AVAILABLE "OFF" CACHE STRING  "Forced for GLES2 compilation" FORCE)
SET(DYNAMIC_OPENSCENEGRAPH "OFF" CACHE STRING  "Forced iOS Platform" FORCE)
SET(DYNAMIC_OPENTHREADS "OFF" CACHE STRING  "Forced iOS Platform" FORCE)
SET(_OPENTHREADS_ATOMIC_USE_GCC_BUILTINS_EXITCODE "0" CACHE STRING  "Forced iOS Platform" FORCE)
SET (BUILD_OSG_APPLICATIONS "OFF" CACHE STRING  "Forced iOS Platform" FORCE)
SET(_OPENTHREADS_ATOMIC_USE_BSD_ATOMIC_EXITCODE "0" CACHE STRING  "Forced IPhone Platform" FORCE)
SET (BUILD_OSG_EXAMPLES "ON" CACHE STRING  "Forced iOS Platform" FORCE)












_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to