glkit

OpenGL ES 2.0 Pinch and Zoom

梦想的初衷 提交于 2019-12-11 10:36:13
问题 In OpenGL ES 1.1 on iOS I used to implement pinch and zoom by setting the Field Of View using the following: // Handles Touches Events - (IBAction)handlePinchGesture:(UIGestureRecognizer *)sender { static float startFOV=0.0; CGFloat factor = [(UIPinchGestureRecognizer *)sender scale]; UIGestureRecognizerState state; state=sender.state; if(state==UIGestureRecognizerStateBegan) { startFOV=[self getFieldOfView]; } else if(state==UIGestureRecognizerStateChanged) { float minFOV=5.0; float maxFOV

OpenGL ES 2.0 draw Fullscreen Quad very slow

我的梦境 提交于 2019-12-11 09:25:39
问题 When I'm rendering my content onto a FBO with a texture bound to it and then render this bound texture to a fullscreen quad using a basic shader the performance drops ridiculously. For example: Render to screen directly (with basic shader): And when render to texture first, then render texture with fullscreen quad: (with same basic shader, would be something like blur or bloom normally): Anyone got an idea how to speed this up? Since the current performance is not usable. Also I'm using GLKit

iOS: GLKit matrix multiplication is broken as far as I can tell

[亡魂溺海] 提交于 2019-12-11 08:18:38
问题 Here's the source code. ANSWER is the correct answer, RESULT is the actual result. Am I blind, or is it calculating a -1 for entry 33 when it should be a 1 ? Here's the code: GLKMatrix4 a = GLKMatrix4Make(-1.000000, 0.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 0.000000, -1.000000, 0.000000, 0.000000, 0.000000, 0.000000, 1.000000); GLKMatrix4 b = GLKMatrix4Make(1.000000, 0.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, -1.000000, 0.000000, 0.000000

GLKBaseEffect prepareToDraw is Leaking

╄→гoц情女王★ 提交于 2019-12-11 03:43:38
问题 Seems that everyone agrees that this is broken and and you need to get rid of GLKBaseEffect to stop it leaking. But no one mentions what you'd replace it with. Can someone can point me in the right direction? Some sample code or a tutorial would be amazingly useful! I'm doing very basic stuff, just drawing 2D sprites. Works great apart from all the leaks :p I just need to know what prepareToDraw is doing and replace it with some code that works. All the tutorials I've found seem to focus on

sizeof() returns wrong size for struct which contains GLKVector3, GLKVector4 variable

不羁岁月 提交于 2019-12-11 00:48:52
问题 I don't understand it's behavior. I think it's wrong. Struct which contains GLKVectors causes the problem. Here's a simple codes. Do you think it's an appropriate result? // Test.h #import <GLKit/GLKit.h> typedef struct { GLKVector2 v1; float f1; } V2F1; typedef struct { GLKVector2 v1; GLKVector2 v2; } V2V2; typedef struct { GLKVector3 v1; GLfloat f1; } V3F1; typedef struct { GLKVector3 v1; GLKVector2 v2; } V3V2; typedef struct { GLKVector3 v1; GLKVector3 v2; } V3V3; typedef struct {

iOS: Questions about camera information within GLKMatrix4MakeLookAt result

牧云@^-^@ 提交于 2019-12-10 11:12:28
问题 The iOS 5 documentation reveals that GLKMatrix4MakeLookAt operates the same as gluLookAt . The definition is provided here: static __inline__ GLKMatrix4 GLKMatrix4MakeLookAt(float eyeX, float eyeY, float eyeZ, float centerX, float centerY, float centerZ, float upX, float upY, float upZ) { GLKVector3 ev = { eyeX, eyeY, eyeZ }; GLKVector3 cv = { centerX, centerY, centerZ }; GLKVector3 uv = { upX, upY, upZ }; GLKVector3 n = GLKVector3Normalize(GLKVector3Add(ev, GLKVector3Negate(cv))); GLKVector3

How to use GLKMathUnproject

℡╲_俬逩灬. 提交于 2019-12-10 09:53:49
问题 I've created a simple 3D world using GLKit. I'm trying to find a specific point in my 3D world based on a screen tap. It seems that I would want to use GLKMathUnproject. The signature of the method is: GLKVector3 GLKMathUnproject ( GLKVector3 window, GLKMatrix4 model, GLKMatrix4 projection, int *viewport, bool *success ); A few things confuse me about the params it requires. First shouldn't the window coordinates be GLKVector2? And most importantly wouldn't projecting a point on the screen

Nesting GLKView into UIViewController

我与影子孤独终老i 提交于 2019-12-09 06:01:08
问题 I'm trying to use GLKView in UIViewController, my code looks like this CustomViewController.h #import <UIKit/UIKit.h> #import <GLKit/GLKit.h> @interface CustomViewController : UIViewController { NSString * name; } @property NSString * name; CustomViewController.m #import "CustomViewController.h" @interface CustomViewController () @end @implementation CustomViewController @synthesize name; - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil { self = [super

OpenGL ES 2 without GLKit

寵の児 提交于 2019-12-08 07:35:53
问题 I want to make an app that uses OpenGL ES 2.0. Can I do this without using GLKit, since I want to deploy it to iOS 4.3? I can't find any reference on this. Is it even possible to use shaders etc without GLKit? Thanks 回答1: You can develop in OpenGL ES 2.0 with shader support without using GLKit. GLKit is only there to make simple tasks easier but you don't have to use it at all. For starters have a look at the guide provided by Apple that outlines different approaches: https://developer.apple

Difference between glkView:drawInRect: and glkViewControllerUpdate:? OpenGL ES 2 - iOS

≡放荡痞女 提交于 2019-12-07 07:51:27
问题 What should be the difference, purpose wise, between these two methods in my render loop? Apple has this to say.... About update() The view controller calls its delegate’s glkViewControllerUpdate: method. Your delegate should update frame data that does not involve rendering the results to the screen. About drawInRect: the GLKView object makes its OpenGL ES context the current context and binds its framebuffer as the target for OpenGL ES rendering commands. Your delegate method should then