Skip to content

Commit c058a19

Browse files
Guillaume SabranGuillaume Sabran
Guillaume Sabran
authored and
Guillaume Sabran
committed
clean up
1 parent 9da1d80 commit c058a19

File tree

5 files changed

+2
-36
lines changed

5 files changed

+2
-36
lines changed

Diff for: HelloOpenGL_Swift.xcodeproj/project.pbxproj

-4
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
21D0C3DD1B8CDEA300E51C72 /* CC3Kazmath.c in Sources */ = {isa = PBXBuildFile; fileRef = 21D0C3D51B8CDEA300E51C72 /* CC3Kazmath.c */; };
2222
21D0C3DE1B8CDEA300E51C72 /* CC3Math.m in Sources */ = {isa = PBXBuildFile; fileRef = 21D0C3D91B8CDEA300E51C72 /* CC3Math.m */; };
2323
21D0C3E01B8CDEC700E51C72 /* OpenGLView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 21D0C3DF1B8CDEC700E51C72 /* OpenGLView.swift */; };
24-
6FB8CAF71D2EEBA3005B634B /* mountain.jpg in Resources */ = {isa = PBXBuildFile; fileRef = 6FB8CAF61D2EEBA3005B634B /* mountain.jpg */; };
2524
6FB8CAFA1D2F0FFD005B634B /* item_powerup_fish.png in Resources */ = {isa = PBXBuildFile; fileRef = 6FB8CAF81D2F0FFD005B634B /* item_powerup_fish.png */; };
2625
6FB8CAFB1D2F0FFD005B634B /* tile_floor.png in Resources */ = {isa = PBXBuildFile; fileRef = 6FB8CAF91D2F0FFD005B634B /* tile_floor.png */; };
2726
/* End PBXBuildFile section */
@@ -71,7 +70,6 @@
7170
21D0C3D91B8CDEA300E51C72 /* CC3Math.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CC3Math.m; sourceTree = "<group>"; };
7271
21D0C3DA1B8CDEA300E51C72 /* ccTypes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ccTypes.h; sourceTree = "<group>"; };
7372
21D0C3DF1B8CDEC700E51C72 /* OpenGLView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = OpenGLView.swift; sourceTree = "<group>"; };
74-
6FB8CAF61D2EEBA3005B634B /* mountain.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = mountain.jpg; sourceTree = "<group>"; };
7573
6FB8CAF81D2F0FFD005B634B /* item_powerup_fish.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = item_powerup_fish.png; sourceTree = "<group>"; };
7674
6FB8CAF91D2F0FFD005B634B /* tile_floor.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = tile_floor.png; sourceTree = "<group>"; };
7775
/* End PBXFileReference section */
@@ -130,7 +128,6 @@
130128
21D0C3DF1B8CDEC700E51C72 /* OpenGLView.swift */,
131129
21D0C3A01B8CDE4000E51C72 /* Main.storyboard */,
132130
21D0C3A31B8CDE4000E51C72 /* Assets.xcassets */,
133-
6FB8CAF61D2EEBA3005B634B /* mountain.jpg */,
134131
6FB8CAF81D2F0FFD005B634B /* item_powerup_fish.png */,
135132
6FB8CAF91D2F0FFD005B634B /* tile_floor.png */,
136133
21D0C3A51B8CDE4000E51C72 /* LaunchScreen.storyboard */,
@@ -295,7 +292,6 @@
295292
6FB8CAFA1D2F0FFD005B634B /* item_powerup_fish.png in Resources */,
296293
21D0C3A71B8CDE4000E51C72 /* LaunchScreen.storyboard in Resources */,
297294
21D0C3CE1B8CDE9100E51C72 /* SimpleVertex.glsl in Resources */,
298-
6FB8CAF71D2EEBA3005B634B /* mountain.jpg in Resources */,
299295
21D0C3A41B8CDE4000E51C72 /* Assets.xcassets in Resources */,
300296
21D0C3A21B8CDE4000E51C72 /* Main.storyboard in Resources */,
301297
21D0C3CF1B8CDE9100E51C72 /* SimpleFragment.glsl in Resources */,

Diff for: HelloOpenGL_Swift/OpenGLView.swift

+2-31
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,7 @@ class OpenGLView: UIView {
303303
glUniform1i(GLint(_textureUniform), 0);
304304

305305

306-
let vertexBufferOffset = UnsafeMutablePointer<Void>(bitPattern: 0)
306+
let vertexBufferOffset = UnsafePointer<Void>(bitPattern: 0)
307307
glDrawElements(GLenum(GL_TRIANGLES), GLsizei((_indices.count * sizeof(GLubyte))/sizeof(GLubyte)),
308308
GLenum(GL_UNSIGNED_BYTE), vertexBufferOffset)
309309

@@ -325,6 +325,7 @@ class OpenGLView: UIView {
325325

326326

327327
_context!.presentRenderbuffer(Int(GL_RENDERBUFFER))
328+
328329
return 0
329330
}
330331

@@ -400,36 +401,6 @@ class OpenGLView: UIView {
400401

401402
}
402403

403-
// func getTextureFromImageWithName(fileName: String) -> GLuint {
404-
//
405-
// let spriteImage: CGImage? = UIImage(named: fileName)!.cgImage
406-
//
407-
// if (spriteImage == nil) {
408-
// print("Failed to load image!")
409-
// exit(1)
410-
// }
411-
//
412-
// let width: Int = spriteImage!.width
413-
// let height: Int = spriteImage!.height
414-
// let spriteData = UnsafeMutablePointer<GLubyte>(calloc(Int(UInt(CGFloat(width) * CGFloat(height) * 4)), sizeof(GLubyte)))
415-
//
416-
// let bitmapInfo = CGBitmapInfo(rawValue: CGImageAlphaInfo.premultipliedLast.rawValue)
417-
// let spriteContext: CGContext = CGContext(data: spriteData, width: width, height: height, bitsPerComponent: 8, bytesPerRow: width*4, space: spriteImage!.colorSpace!, bitmapInfo: bitmapInfo.rawValue)!
418-
//
419-
// spriteContext.draw(in: CGRect(x: 0, y: 0, width: CGFloat(width) , height: CGFloat(height)), image: spriteImage!)
420-
//// CGContextRelease(spriteContext)
421-
//
422-
// var texName: GLuint = GLuint()
423-
// glGenTextures(1, &texName)
424-
// glBindTexture(GLenum(GL_TEXTURE_2D), texName)
425-
//
426-
// glTexParameteri(GLenum(GL_TEXTURE_2D), GLenum(GL_TEXTURE_MIN_FILTER), GL_NEAREST)
427-
// glTexImage2D(GLenum(GL_TEXTURE_2D), 0, GL_RGBA, GLsizei(width), GLsizei(height), 0, GLenum(GL_RGBA), UInt32(GL_UNSIGNED_BYTE), spriteData)
428-
//
429-
// free(spriteData)
430-
// return texName
431-
// }
432-
433404
func setupRenderBuffer() -> Int {
434405
glGenRenderbuffers(1, &_colorRenderBuffer)
435406
glBindRenderbuffer(GLenum(GL_RENDERBUFFER), _colorRenderBuffer)

Diff for: HelloOpenGL_Swift/SimpleFragment.glsl

-1
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,4 @@ varying lowp vec4 DestinationColor;
44

55
void main(void) {
66
gl_FragColor = DestinationColor * texture2D(Texture, TexCoordOut);
7-
// gl_FragColor = vec4(DestinationColor.x * TexCoordOut.x, DestinationColor.y * TexCoordOut.y, DestinationColor.z, DestinationColor.w);
87
}

Diff for: HelloOpenGL_Swift/mountain.jpg

-982 KB
Binary file not shown.

0 commit comments

Comments
 (0)