Skip to content

Instantly share code, notes, and snippets.

NSMutableDictionary *slice_textures = [NSMutableDictionary dictionaryWithCapacity:3];
size_t total_files = 100;
view.progressbar.progress = 0.;
float step = 1. / total_files;
EAGLContext *context = [[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES2];
if (context == nil) {
NSLog(@"Failed to create ES context");
}
dispatch_queue_t queue = dispatch_queue_create("org.denter.smile.loadpvr", DISPATCH_QUEUE_SERIAL);
__block NSMutableDictionary *slice_textures = [NSMutableDictionary dictionaryWithCapacity:3];
__block EAGLContext *context;
dispatch_queue_t queue = dispatch_queue_create("org.denter.smile.loadpvr", DISPATCH_QUEUE_SERIAL);
dispatch_async(queue, ^{
context = [[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES2];
[EAGLContext setCurrentContext:context];
for (... resource in resources) {
LoadResourceAndStoreHandleInDict(slice_textures);
Ld /Users/dennda/Library/Developer/Xcode/DerivedData/Smile-ctljjdgnzgigebcutxqrjlaxzfmp/Build/Products/Debug-iphoneos/smile.app/smile normal armv7
cd /Users/dennda/dev/msc/pocs/VolVis
setenv IPHONEOS_DEPLOYMENT_TARGET 5.0
setenv PATH "/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/clang -arch armv7 -isysroot /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.0.sdk -L/Users/dennda/Library/Developer/Xcode/DerivedData/Smile-ctljjdgnzgigebcutxqrjlaxzfmp/Build/Products/Debug-iphoneos -L/Users/dennda/dev/msc/pocs/VolVis -F/Users/dennda/Library/Developer/Xcode/DerivedData/Smile-ctljjdgnzgigebcutxqrjlaxzfmp/Build/Products/Debug-iphoneos -filelist /Users/dennda/Library/Developer/Xcode/DerivedData/Smile-ctljjdgnzgigebcutxqrjlaxzfmp/Build/Intermediates/Smile.build/Debug-iphoneos/Smile.build/Objects-normal/armv7/smile.LinkFileList -dead_strip -ObjC -fobjc-arc -miphoneos-version
#import <OpenGLES/ES2/gl.h>
#import "error.h"
#ifdef DEBUG
inline void oglActiveTexture (GLenum texture) {
GetError(); glActiveTexture(texture); }
inline void oglAttachShader (GLuint program, GLuint shader) {
GetError(); glAttachShader(program, shader); }
inline void oglBindAttribLocation (GLuint program, GLuint index, const GLchar* name) {
GetError(); glBindAttribLocation (program, index, name); }
@dennda
dennda / gist:1349151
Created November 8, 2011 20:45
OpenGL Debug Header File
#ifdef DEBUG
GL_API void GL_APIENTRY oglActiveTexture (GLenum texture) {
GetError(); glActiveTexture(texture); }
GL_API void GL_APIENTRY oglAttachShader (GLuint program, GLuint shader) {
GetError(); glAttachShader(program, shader); }
GL_API void GL_APIENTRY oglBindAttribLocation (GLuint program, GLuint index, const GLchar* name) {
GetError(); glBindAttribLocation (program, index, name); }
GL_API void GL_APIENTRY oglBindBuffer (GLenum target, GLuint buffer) {
GetError(); glBindBuffer (target, buffer); }
GL_API void GL_APIENTRY oglBindFramebuffer (GLenum target, GLuint framebuffer) {
UIBezierPath *path = [UIBezierPath bezierPath];
for (TFPointView *pv in subviews) {
if (pv == [subviews objectAtIndex:0])
[path moveToPoint:pv.center];
else
[path addLineToPoint:pv.center];
}
[path stroke];
- (BOOL)pointInside:(CGPoint)point withEvent:(UIEvent *)event {
// Extend our own touch hit zone by 22 pixels to the top. The implementation of this
// function relies on the fact that this view spreads out from 0 to win.width and
// from 0 to the bottom of the window.
CGFloat min_touchable2 = 44./2.;
if (point.y >= -min_touchable2)
return YES;
return NO;
}
...
[self.view.layer.presentationLayer addObserver:self
forKeyPath:@"frame"
options:NSKeyValueObservingOptionNew
context:NULL];
}
- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context {
NSLog(@"Keyvalue change with keypath: %@, object: %@", keyPath, object);
displayLink = [CADisplayLink displayLinkWithTarget:self
selector:@selector(updateAndDrawViews:)];
[displayLink addToRunLoop:[NSRunLoop currentRunLoop] forMode:NSDefaultRunLoopMode];
int tf_tex_unit = 1;
glActiveTexture(GL_TEXTURE0 + tf_tex_unit);
glBindTexture(GL_TEXTURE_2D, _tf_texname);
glUniform1i(_uniforms[TF_TEX], tf_tex_unit);