glkit

Camera position in orthographic projection

旧街凉风 提交于 2020-12-31 13:59:46
问题 I'm trying to understand how to use camera with usesOrthographicProjection = true . I need to set it up so when we first see the scene, the object should be viewable in full. I used the Xcode's SceneKit template, adjust a little bit about the camera (all the code is in viewDidLoad ). Using default camera (perspective projection), it looks like this: cameraNode.position = SCNVector3(x: 0, y: 0, z: ship.boundingBox.max.z + 20) Next, I tried to set the orthographic projection, now it looks like

GLKTextureLoader fails when loading a certain texture the first time, but succeeds the second time

落花浮王杯 提交于 2020-02-01 01:35:13
问题 I'm making an iPhone application with OpenGL ES 2.0 using the GLKit. I'm using GLKTextureLoader to load textures synchronously. The problem is that for a certain texture, it fails to load it the first time. It gives this error: The operation couldn’t be completed. (GLKTextureLoaderErrorDomain error 8.) For this error code, the apple documentation says the following: GLKTextureLoaderErrorUncompressedTextureUpload An uncompressed texture could not be uploaded. Available in iOS 5.0 and later.

GLKViewControllerDelegate getting blocked

放肆的年华 提交于 2020-01-24 02:53:07
问题 I have a GLKViewController to handle some OpenGL drawing. I have the glkView:drawInRect and update method both implemented and have the preferredFramesPerSecond property set to 30 (the default). The problem is that the delegate methods stop firing when the user interacts with other part of the app. The two cases that I have seen this happen on is when the user scrolls a UITableView or interacts with a MKMapView. Is there a way to make sure these delegates always fire, regardless of what the

Using GLKView with a UIViewController

為{幸葍}努か 提交于 2020-01-13 05:53:32
问题 I wanted to use OpenGL to do some simple Image processing, so I started off with GLKView . Since I don't need to refresh the view every few seconds, I didn't use the GLKViewController and instead used a normal UIViewController subclass. My question is that do I simply make the viewController's view as a GLKView or do I add the GLKView as a subview of the view controller's view. Since I'm adding a UISlider to the view as well, I think the latter seems better, but I'm not sure. I also need to

Arcball Rotation with Quaternions (using iOS GLKit)

一笑奈何 提交于 2020-01-11 19:57:06
问题 I'm looking for a simple implementation for arcball rotation on 3D models with quaternions, specifically using GLKit on iOS . So far, I have examined the following sources: Arcball rotation with GLKit How to rotate a 3D object with touches using OpenGL I've also been trying to understand source code and maths from here and here. I can rotate my object but it keeps jumping around at certain angles, so I fear gimbal lock is at play. I'm using gesture recognizers to control the rotations (pan

GLKit & adding tints to textures

依然范特西╮ 提交于 2020-01-01 03:31:18
问题 I am having issue with tinting a PNG image with GLKit. I have a white PNG image that I load into the application and then use it to create a texture: UIImage *image = [ UIImage imageNamed:@"brushImage" ]; NSError *error = nil; texture_m = [[ GLKTextureLoader textureWithCGImage:image.CGImage options:nil error:&error] retain ]; if (error) { NSLog(@"Error loading texture from image: %@",error); } the texture is created with no errors. however when I want to render the texture with blend

Can I avoid using offsetof in the following?

夙愿已清 提交于 2019-12-25 10:02:53
问题 Following another question from me, here is a specific example where I want to avoid offsetof . For using with glVertexAttribPointer , I have to use offsetof for the last parameter. glVertexAttribPointer(GLKVertexAttribColor, 4, GL_FLOAT, GL_FALSE, sizeof(Vertex), (const GLvoid *) offsetof(Vertex, _color)); Vertex is a class. Is there a way I can avoid using this one? I tried with pointer to members, but no luck. Cannot compile in the following glVertexAttribPointer(GLKVertexAttribColor, 3,

OpenGL sending vertex pointers or generating buffers

ⅰ亾dé卋堺 提交于 2019-12-25 05:35:52
问题 I just started OpenGL for iPhone, using GLKit. My programming background is almost just java and objective c with little,little experiences with C, C++ over ten years ago. All what remained is a remote memory of how I struggled with pointers - and I think I failed. Now it seems as if it all comes back to me ... I went to some iterations of the great, great tutorial series of Ian Terrel, which really helped me (Thanks!!!). This question is about the following parts of the code (which is mostly

iphone development: is it possible to extend more than one viewControllers?

旧城冷巷雨未停 提交于 2019-12-24 14:09:13
问题 in my app I want to use googleAnalytics. To use it I have to extend GAITrackedViewController but the problem is I already extend GLKViewController because my view has an openGL application. So is it possible to extend the properties of both view controllers? 回答1: For a similar case, I've simply created a subclass of UIViewController (GLKViewController in your case). That subclass handles the tracking of the view. All "specific" ViewControllers extend that custom UIViewController, instead of

failed to bind EAGLDrawable in CADisplayLink render loop

纵然是瞬间 提交于 2019-12-24 02:22:20
问题 i use CADisplayLink render-loop callback to render a serial of image textures with openGLes. after CADisplayLink's first callback called, i just get these error output Failed to bind EAGLDrawable: <CAEAGLLayer: 0x946bb40> to GL_RENDERBUFFER 2 Failed to make complete framebuffer object 8cd6 i setup the renderBuffer&frameBuffer and call glFramebufferRenderbuffer in controller's viewDidLoad stage, the return of glCheckFramebufferStatus is fine in that stage. this is the code I'm using. /