This repository has been archived by the owner on Feb 18, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
AR_EAGLView.h
executable file
·102 lines (78 loc) · 2.75 KB
/
AR_EAGLView.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
/*==============================================================================
Copyright (c) 2010-2013 QUALCOMM Austria Research Center GmbH.
All Rights Reserved.
Qualcomm Confidential and Proprietary
==============================================================================*/
#import <UIKit/UIKit.h>
#import <OpenGLES/EAGL.h>
#import <OpenGLES/ES1/gl.h>
#import <OpenGLES/ES1/glext.h>
#import <OpenGLES/ES2/gl.h>
#import <OpenGLES/ES2/glext.h>
#import <QCAR/UIGLViewProtocol.h>
@class Texture;
// structure to point to an object to be drawn
@interface Object3D : NSObject {
unsigned int numVertices;
const float *vertices;
const float *normals;
const float *texCoords;
unsigned int numIndices;
const unsigned short *indices;
Texture *texture;
}
@property (nonatomic) unsigned int numVertices;
@property (nonatomic) const float *vertices;
@property (nonatomic) const float *normals;
@property (nonatomic) const float *texCoords;
@property (nonatomic) unsigned int numIndices;
@property (nonatomic) const unsigned short *indices;
@property (nonatomic, assign) Texture *texture;
@end
@class QCARutils;
// This class wraps the CAEAGLLayer from CoreAnimation into a convenient UIView
// subclass. The view content is basically an EAGL surface you render your
// OpenGL scene into. Note that setting the view non-opaque will only work if
// the EAGL surface has an alpha channel.
@interface AR_EAGLView : UIView <UIGLViewProtocol>
{
@public
NSMutableArray *textureList; // list of textures to load
@protected
QCARutils *qUtils; // QCAR utils class
EAGLContext *context;
// The pixel dimensions of the CAEAGLLayer.
GLint framebufferWidth;
GLint framebufferHeight;
// The OpenGL ES names for the framebuffer and renderbuffers used to render
// to this view.
GLuint defaultFramebuffer;
GLuint colorRenderbuffer;
GLuint depthRenderbuffer;
NSMutableArray* textures; // loaded textures
NSMutableArray *objects3D; // objects to draw
BOOL renderingInited;
#ifndef USE_OPENGL1
// *** Note, OpenGL ES 1.x is supported only in the ImageTargets sample ***
// OpenGL 2 data
GLuint shaderProgramID;
GLint vertexHandle;
GLint normalHandle;
GLint textureCoordHandle;
GLint mvpMatrixHandle;
GLint texSampler2DHandle;
#endif
}
@property (nonatomic, retain) NSMutableArray *textureList;
- (void) useTextures:(NSMutableArray *)theTextures;
// OpenGL ES clean up when going into the background
- (void)finishOpenGLESCommands;
- (void)freeOpenGLESResources;
// for overriding in the EAGLView subclass
- (void)setFramebuffer;
- (BOOL)presentFramebuffer;
- (void)createFramebuffer;
- (void)deleteFramebuffer;
- (void)initRendering;
- (void)initShaders;
@end