bzr branch
/browse/iphone/common
| Line | Revision | Contents |
| 1 | 12 | // |
| 2 | // GLESView.h |
|
| 3 | // MarineCompass |
|
| 4 | // |
|
| 5 | // Created by döme on 03.08.2009. |
|
| 6 | // |
|
| 7 | ||
| 8 | 54 | /* |
| 9 | * Copyright (c) 2009 Doemoetoer Gulyas. |
|
| 10 | * All rights reserved. |
|
| 11 | * |
|
| 12 | * Redistribution and use in source and binary forms, with or without |
|
| 13 | * modification, are permitted provided that the following conditions |
|
| 14 | * are met: |
|
| 15 | * 1. Redistributions of source code must retain the above copyright |
|
| 16 | * notice, this list of conditions and the following disclaimer. |
|
| 17 | * 2. Redistributions in binary form must reproduce the above copyright |
|
| 18 | * notice, this list of conditions and the following disclaimer in the |
|
| 19 | * documentation and/or other materials provided with the distribution. |
|
| 20 | * 3. The name of the author may not be used to endorse or promote products |
|
| 21 | * derived from this software without specific prior written permission. |
|
| 22 | * |
|
| 23 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
|
| 24 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
|
| 25 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
|
| 26 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
|
| 27 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
|
| 28 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
|
| 29 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
|
| 30 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
|
| 31 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
|
| 32 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
|
| 33 | */ |
|
| 34 | ||
| 35 | ||
| 36 | 12 | #import <UIKit/UIKit.h> |
| 37 | #import <OpenGLES/EAGL.h> |
|
| 38 | #import <OpenGLES/ES2/gl.h> |
|
| 39 | #import <OpenGLES/ES2/glext.h> |
|
| 40 | 94 | #import <QuartzCore/QuartzCore.h> |
| 41 | 12 | |
| 42 | #define USE_DEPTH_BUFFER 1 |
|
| 43 | ||
| 44 | 81 | void* loadGrayscaleImageAtPath(NSString* path, int* wp, int* hp); |
| 45 | ||
| 46 | 12 | @interface GLESView : UIView |
| 47 | { |
|
| 48 | 70 | float osVersion; |
| 49 | 12 | |
| 50 | GLint backingWidth; |
|
| 51 | GLint backingHeight; |
|
| 52 | |
|
| 53 | EAGLContext *context; |
|
| 54 | |
|
| 55 | /* OpenGL names for the renderbuffer and framebuffers used to render to this view */ |
|
| 56 | GLuint viewRenderbuffer, viewFramebuffer; |
|
| 57 | |
|
| 58 | /* OpenGL name for the depth buffer that is attached to viewFramebuffer, if it exists (0 if it does not exist) */ |
|
| 59 | GLuint depthRenderbuffer; |
|
| 60 | 70 | |
| 61 | CADisplayLink* displayLink; |
|
| 62 | 71 | NSThread* displayThread; |
| 63 | 73 | BOOL displayThreadShouldRun; |
| 64 | 71 | BOOL recreateFramebuffer; |
| 65 | 12 | |
| 66 | } |
|
| 67 | ||
| 68 | - (void) setupGraphicsForApi: (EAGLRenderingAPI) glApi; |
|
| 69 | 13 | |
| 70 | 80 | - (void) textureFromCgImage: (CGImageRef) img nonUniformScale: (BOOL) nonUniformScale texName: (GLuint*) texname width: (size_t) width height: (size_t) height repeat: (BOOL) doRepeat mipmap: (BOOL) doMipmap filter: (BOOL) doFilter; |
| 71 | 81 | - (void) textureFromGrayscaleData: (void*) data texName: (GLuint*) texname width: (size_t) width height: (size_t) height repeat: (BOOL) doRepeat mipmap: (BOOL) doMipmap filter: (BOOL) doFilter; |
| 72 | 23 | - (void) loadTextureFromBitmapNamed: (NSString*) name texName: (GLuint*) texname repeat: (BOOL) doRepeat mipmap: (BOOL) doMipmap filter: (BOOL) doFilter; |
| 73 | 81 | - (void) loadGrayscaleTextureFromBitmapAtPath: (NSString*) path texName: (GLuint*) texname repeat: (BOOL) doRepeat mipmap: (BOOL) doMipmap filter: (BOOL) doFilter; |
| 74 | 23 | - (void) loadTextureFromPDFNamed: (NSString*) name texName: (GLuint*) texname width: (size_t) width height: (size_t) height repeat: (BOOL) doRepeat mipmap: (BOOL) doMipmap filter: (BOOL) doFilter; |
| 75 | 80 | - (void) loadTextureFromPvrAtPath: (NSString*) path texName: (GLuint*) texname; |
| 76 | 17 | - (void) lineGradientTexture: (GLuint*) texname red: (float) r green: (float) g blue: (float) b; |
| 77 | 29 | - (void) doubleGradientTexture: (GLuint*) texname red: (float) r green: (float) g blue: (float) b; |
| 78 | 12 | |
| 79 | ||
| 80 | 88 | - (void)animationCallback: (double) time; |
| 81 | 71 | - (void)startAnimation: (BOOL) threaded; |
| 82 | 12 | - (void)stopAnimation; |
| 83 | ||
| 84 | - (void) setupViewDrawing; |
|
| 85 | - (void) finishViewDrawing; |
|
| 86 | 88 | - (void) drawView: (double) time; |
| 87 | 12 | |
| 88 | @property NSTimeInterval animationInterval; |
|
| 89 | ||
| 90 | @end |
Loggerhead 1.17 is a web-based interface for Bazaar branches