-
Notifications
You must be signed in to change notification settings - Fork 1
/
GLSplash.m
67 lines (47 loc) · 1.69 KB
/
GLSplash.m
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
#import "Constants.h"
#import "MC3DVector.h"
#import "Bezier.h"
#import "GLTexture.h"
#import "Projection.h"
#import "AnimatedFloat.h"
#import "AnimatedVec3.h"
#import "TextureController.h"
#import "GLSplash.h"
@implementation GLSplash
@synthesize renderer = _renderer;
@synthesize opacity = _opacity;
-(id)init
{
self = [super init];
if(self)
{
self.opacity = [AnimatedFloat floatWithValue:1];
}
return self;
}
-(void)draw
{
if(self.opacity.value < 1.0 / 256.0) { return; }
glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
glBindTexture(GL_TEXTURE_2D, [TextureController nameForKey:@"splash"]);
vec3 borderArrayVertex1[4];
GLushort borderArrayMesh1[6];
vec2 borderArrayTextures[4];
borderArrayVertex1[0] = vec3Make(-.8, -1.205, -2.99);
borderArrayVertex1[1] = vec3Make( .8, -1.205, -2.99);
borderArrayVertex1[2] = vec3Make(-.8, 1.205, -2.99);
borderArrayVertex1[3] = vec3Make( .8, 1.205, -2.99);
borderArrayTextures[0] = vec2Make(0, 1);
borderArrayTextures[1] = vec2Make(1, 1);
borderArrayTextures[2] = vec2Make(0, 0);
borderArrayTextures[3] = vec2Make(1, 0);
GenerateBezierMesh(borderArrayMesh1, 2, 2);
glDisableClientState(GL_NORMAL_ARRAY);
glNormal3f(0.0, 0.0, 1.0);
glColor4f(self.opacity.value, self.opacity.value, self.opacity.value, self.opacity.value);
glTexCoordPointer(2, GL_FLOAT, 0, borderArrayTextures);
glVertexPointer (3, GL_FLOAT, 0, borderArrayVertex1);
glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_SHORT, borderArrayMesh1);
glEnableClientState(GL_NORMAL_ARRAY);
}
@end