Created
March 31, 2014 07:14
-
-
Save chinmaygarde/9886933 to your computer and use it in GitHub Desktop.
EFImage
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-(void) sandbox { | |
EFDisplay *display = [EFDisplay defaultDisplay]; | |
const EGLint attributes[] = { | |
EGL_SURFACE_TYPE, EGL_PBUFFER_BIT, | |
EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT, | |
EGL_NONE, /* termination sentinel */ | |
}; | |
EFSurfaceConfig *config = [display configurationsForAttributes:attributes].firstObject; | |
EFContext *context = [[EFContext alloc] initWithAPI:EFContextClientAPI2 display:display config:config]; | |
context.surface = [[[EFPBufferSurface alloc] initWithDisplay:display config:config] autorelease]; | |
BOOL success = [context makeCurrent]; | |
GLuint texture; | |
glActiveTexture(GL_TEXTURE0); | |
glGenTextures(1, &texture); | |
glBindTexture(GL_TEXTURE_2D, texture); | |
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); | |
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); | |
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); | |
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); | |
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 200, 200, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL); | |
image = [[EFImage alloc] initWithDisplay:display context:context texture:texture]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment