src/video/uikit/SDL_uikitopenglview.h
author Sam Lantinga <slouken@libsdl.org>
Sun, 02 Feb 2014 00:53:27 -0800
changeset 8149 681eb46b8ac4
parent 7423 dfe7ad02f008
child 8891 7b6472f1b7ba
permissions -rw-r--r--
Fixed bug 2374 - Update copyright for 2014...

Is it that time already??
slouken@2765
     1
/*
slouken@5535
     2
  Simple DirectMedia Layer
slouken@8149
     3
  Copyright (C) 1997-2014 Sam Lantinga <slouken@libsdl.org>
slouken@2765
     4
slouken@5535
     5
  This software is provided 'as-is', without any express or implied
slouken@5535
     6
  warranty.  In no event will the authors be held liable for any damages
slouken@5535
     7
  arising from the use of this software.
slouken@2765
     8
slouken@5535
     9
  Permission is granted to anyone to use this software for any purpose,
slouken@5535
    10
  including commercial applications, and to alter it and redistribute it
slouken@5535
    11
  freely, subject to the following restrictions:
slouken@2765
    12
slouken@5535
    13
  1. The origin of this software must not be misrepresented; you must not
slouken@5535
    14
     claim that you wrote the original software. If you use this software
slouken@5535
    15
     in a product, an acknowledgment in the product documentation would be
slouken@5535
    16
     appreciated but is not required.
slouken@5535
    17
  2. Altered source versions must be plainly marked as such, and must not be
slouken@5535
    18
     misrepresented as being the original software.
slouken@5535
    19
  3. This notice may not be removed or altered from any source distribution.
slouken@2765
    20
*/
slouken@2765
    21
slouken@2765
    22
#import <UIKit/UIKit.h>
slouken@2765
    23
#import <OpenGLES/EAGL.h>
slouken@2765
    24
#import <OpenGLES/ES1/gl.h>
slouken@2765
    25
#import <OpenGLES/ES1/glext.h>
slouken@2765
    26
#import "SDL_uikitview.h"
slouken@2765
    27
/*
slouken@5209
    28
    This class wraps the CAEAGLLayer from CoreAnimation into a convenient UIView subclass.
slouken@5209
    29
    The view content is basically an EAGL surface you render your OpenGL scene into.
slouken@5209
    30
    Note that setting the view non-opaque will only work if the EAGL surface has an alpha channel.
slouken@2765
    31
 */
slouken@2765
    32
@interface SDL_uikitopenglview : SDL_uikitview {
kees@6001
    33
slouken@2765
    34
@private
slouken@5209
    35
    /* The pixel dimensions of the backbuffer */
slouken@5209
    36
    GLint backingWidth;
slouken@5209
    37
    GLint backingHeight;
kees@6001
    38
slouken@5209
    39
    EAGLContext *context;
kees@6001
    40
slouken@5209
    41
    /* OpenGL names for the renderbuffer and framebuffers used to render to this view */
slouken@5209
    42
    GLuint viewRenderbuffer, viewFramebuffer;
kees@6001
    43
slouken@5209
    44
    /* OpenGL name for the depth buffer that is attached to viewFramebuffer, if it exists (0 if it does not exist) */
slouken@5209
    45
    GLuint depthRenderbuffer;
icculus@5527
    46
icculus@5527
    47
    /* format of depthRenderbuffer */
icculus@5527
    48
    GLenum depthBufferFormat;
slouken@6342
    49
slouken@6342
    50
    id displayLink;
slouken@6342
    51
    int animationInterval;
slouken@6342
    52
    void (*animationCallback)(void*);
slouken@6342
    53
    void *animationCallbackParam;
slouken@2765
    54
}
slouken@2765
    55
slouken@2765
    56
@property (nonatomic, retain, readonly) EAGLContext *context;
slouken@2765
    57
slouken@2765
    58
- (void)swapBuffers;
slouken@2765
    59
- (void)setCurrentContext;
slouken@2765
    60
slouken@2765
    61
- (id)initWithFrame:(CGRect)frame
tim@6267
    62
    scale:(CGFloat)scale
kees@6003
    63
    retainBacking:(BOOL)retained
kees@6003
    64
    rBits:(int)rBits
kees@6003
    65
    gBits:(int)gBits
kees@6003
    66
    bBits:(int)bBits
kees@6003
    67
    aBits:(int)aBits
kees@6003
    68
    depthBits:(int)depthBits
icculus@6021
    69
    stencilBits:(int)stencilBits
icculus@7423
    70
    majorVersion:(int)majorVersion
icculus@7423
    71
    shareGroup:(EAGLSharegroup*)shareGroup;
slouken@2765
    72
icculus@5527
    73
- (void)updateFrame;
icculus@5527
    74
slouken@6342
    75
- (void)setAnimationCallback:(int)interval
slouken@6342
    76
    callback:(void (*)(void*))callback
slouken@6342
    77
    callbackParam:(void*)callbackParam;
slouken@6342
    78
slouken@6342
    79
- (void)startAnimation;
slouken@6342
    80
- (void)stopAnimation;
slouken@6342
    81
slouken@6342
    82
- (void)doLoop:(id)sender;
slouken@6342
    83
slouken@2765
    84
@end
slouken@5133
    85
slouken@5133
    86
/* vi: set ts=4 sw=4 expandtab: */