Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add definitions for iOS / GLES2 extension functions and constants #2279

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions include/cinder/gl/platform.h
Original file line number Diff line number Diff line change
Expand Up @@ -232,3 +232,25 @@
#else
#define CINDER_GL_HAS_KHR_DEBUG
#endif

#if defined( CINDER_COCOA_TOUCH ) && defined( CINDER_GL_ES_2 )
#define GL_DEPTH_COMPONENT24 GL_DEPTH_COMPONENT24_OES
#define GL_DEPTH24_STENCIL8 GL_DEPTH24_STENCIL8_OES
#define GL_RGBA8 GL_RGBA8_OES
#define glRenderbufferStorageMultisample glRenderbufferStorageMultisampleAPPLE
#define GL_READ_FRAMEBUFFER GL_READ_FRAMEBUFFER_APPLE
#define GL_DRAW_FRAMEBUFFER GL_DRAW_FRAMEBUFFER_APPLE
#define GL_READ_FRAMEBUFFER_BINDING GL_READ_FRAMEBUFFER_BINDING_APPLE
#define GL_DRAW_FRAMEBUFFER_BINDING GL_DRAW_FRAMEBUFFER_BINDING_APPLE
#define GL_MAX_SAMPLES GL_MAX_SAMPLES_APPLE
#define glGenVertexArrays glGenVertexArraysOES
#define glDeleteVertexArrays glDeleteVertexArraysOES
#define glBindVertexArray glBindVertexArrayOES
#define glResolveMultisampleFramebuffer glResolveMultisampleFramebufferAPPLE
#define glVertexAttribDivisor glVertexAttribDivisorEXT
#define glMapBuffer glMapBufferOES
#define glUnmapBuffer glUnmapBufferOES
#define glMapBufferRange glMapBufferRangeEXT
#define GL_MAP_WRITE_BIT GL_MAP_WRITE_BIT_EXT
#define GL_MAP_INVALIDATE_BUFFER_BIT GL_MAP_INVALIDATE_BUFFER_BIT_EXT
#endif
10 changes: 0 additions & 10 deletions src/cinder/app/cocoa/RendererImplGlCocoaTouch.mm
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,6 @@
#include "cinder/gl/Environment.h"
#include "cinder/Log.h"

#if defined( CINDER_GL_ES_2 )
#define GL_DEPTH_COMPONENT24 GL_DEPTH_COMPONENT24_OES
#define GL_DEPTH24_STENCIL8 GL_DEPTH24_STENCIL8_OES
#define GL_RGBA8 GL_RGBA8_OES
#define glRenderbufferStorageMultisample glRenderbufferStorageMultisampleAPPLE
#define GL_READ_FRAMEBUFFER GL_READ_FRAMEBUFFER_APPLE
#define GL_DRAW_FRAMEBUFFER GL_DRAW_FRAMEBUFFER_APPLE
#define GL_MAX_SAMPLES GL_MAX_SAMPLES_APPLE
#endif

@implementation RendererImplGlCocoaTouch

- (id)initWithFrame:(CGRect)frame cinderView:(UIView *)cinderView renderer:(cinder::app::RendererGl *)renderer sharedRenderer:(cinder::app::RendererGlRef)sharedRenderer
Expand Down
8 changes: 6 additions & 2 deletions src/cinder/gl/ConstantConversions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,9 @@ std::string constantToString( GLenum constant )
sSymbols[GL_SAMPLER_2D] = "SAMPLER_2D";
sSymbols[GL_SAMPLER_CUBE] = "SAMPLER_CUBE";


#if ! defined( CINDER_GL_ES_2 )
sSymbols[GL_HALF_FLOAT] = "HALF_FLOAT";
#endif
#if ! defined( CINDER_GL_ES )
sSymbols[GL_SAMPLER_BUFFER] = "SAMPLER_BUFFER";
sSymbols[GL_UNSIGNED_INT_SAMPLER_BUFFER] = "UNSIGNED_INT_SAMPLER_BUFFER";
Expand Down Expand Up @@ -150,13 +151,17 @@ std::string constantToString( GLenum constant )
#endif

sSymbols[GL_RED] = "GL_RED";
#if ! defined( CINDER_GL_ES_2 )
sSymbols[GL_RG] = "GL_RG";
sSymbols[GL_R8] = "GL_R8";
sSymbols[GL_RG8] = "GL_RG8";
sSymbols[GL_RGB8] = "GL_RGB8";
#endif
sSymbols[GL_RGBA4] = "GL_RGBA4";
sSymbols[GL_RGB5_A1] = "GL_RGB5_A1";
sSymbols[GL_RGBA8] = "GL_RGBA8";

#if ! defined( CINDER_GL_ES_2 )
sSymbols[GL_R16F] = "GL_R16F";
sSymbols[GL_RG16F] = "GL_RG16F";
sSymbols[GL_RGB16F] = "GL_RGB16F";
Expand All @@ -169,7 +174,6 @@ std::string constantToString( GLenum constant )
sSymbols[GL_R11F_G11F_B10F] = "GL_R11F_G11F_B10F";
sSymbols[GL_RGB9_E5] = "GL_RGB9_E5";

#if ! defined( CINDER_GL_ES_2 )
sSymbols[GL_R8I] = "GL_R8I";
sSymbols[GL_R8UI] = "GL_R8UI";
sSymbols[GL_R16I] = "GL_R16I";
Expand Down