OpenGL ES 2.0 rendering issue in Xcode - iphone

I'm fairly new to OpenGL ES 2.0 on the iPhone and am trying to make a simple animation of bumper cars in a ring. For some reason, I am currently unable to render anything on screen (only the glClear() set color shows up rather any 3D objects) and I think it has something to do with my base effect or possibly my binding/rendering. I'm currently unsure of what the issue is and have been stumped for quite some time now. Would anyone be able to take a look through my project and try to guide me? I just need a footing for the right direction in debugging this issue. Just click the attached link and go to File -> Download to get the entire project.
Edit: I did find an issue under SceneMesh.h where SceneMeshVertex had GLKVector2 texCoords0; declared as GLKVector3 texCoords0; which is wrong. So that has been corrected and updated.
Xcode Project

In SceneModel.m I made a goof. In
-(id)initWithName:(NSString *)modelName mesh:(SceneMesh *)meshReference numberOfVertices:(GLsizei)count; I accidentally reference numberOfVertices instead of count .... woops. That fixed that.

Related

Collada morph animation blend shape Maya

we created a simple animation in Maya using keyed blend shapes. Exported it as a .dae.
I've been trying and researching everywhere and it seems like SceneKit will not play this type of animation.
I can see my Morphers in Xcode as well as the animation key, but nothing ever happens when playing this animation.
I've seen a couple threads about that on Autodesk and here, and it looks like no one have solved this issue. So my question is the following: is there anyone out there that was able to play an animation from a .dae file using blend shapes?
Thank you
No, I don't believe this is possible. I went down this same path about a year ago. In the end I used one of my developer code-level tech support tickets AND filed a bug report. I got action on both fronts. Apple said that it SHOULD work. However, it successfully played any kind of transform animations (position, scale, rotation), but wouldn't play any keyed blend shape ones.
Then I had them look at my DAE file from Maya. They said that the exported file was not a valid Collada. They pointed me specifically to what was wrong with the way Maya exported it, and even told me what would need to be changed in order to make it work.
I went to the Collada DAE file format spec and confirmed the Apple engineer was correct about what was wrong with the exported file. I opened a case with AutoDesk. After a few initial questions, I never heard back.
Upon making the change Apple mentioned, it still wouldn't work. But get this -- after making their changes, the Preview app on the Mac would play the animation correctly! But never in Xcode.
Here is an Apple Dev Forum link to my posting there: https://forums.developer.apple.com/message/308819#308819
Here's the same project I was using: https://bitbucket.org/drewster77/scenekitimportedanimtest
If you get it working, please post the solution here!

Screen sizes in Xcode 7 the using SpriteKit

I am relatively new to sprite kit and have been attempting to create my first basic game. All physics and other basics seem ok, but for some reason whenever I build and run the screen dimensions are off (looks like default is 1024×768)?
Pretty sure I'm missing something fundamental here but it doesn't seem immediately obvious on how to adapt the screen to any size iPhone screen (this is my ultimate goal).
My question is whether this is actually just a setting issue or is it necessary to implement code?
Thanks in advance and have a great day!:)
To answer the first part, you can easily change the size of your scene.
If you take the default GameScene, click out of the scene and look at the Attributes Inspector. You will see the default size of 1024,768. Personally if landscape I tend to work with an iPhone 5 design resolution of 568,320.
Regarding multiple devices, SpriteKit works pretty well out the box. You should look at the documentation regarding scaleMode, take a look in the GameViewController.swift. .AspectFit worked really well, nearly pefect across all devices apart from a little letterboxing on iPad. However, for the amount of effort put in, more than good enough.
On a side note, I've found the following iPhone Resolution Guide resource useful in the past.

Unity 3D: Rear camera in device is behaving weird

Am working on taking snap from my device camera. The front camera is working good,but the rear camera is not upto the mark. It is showing upside down. I donno why it is behaving strange.
Can anyone help me out.
Cheers!!
It's difficult to come up with a simple answer for your problem, this depends on wether you run it on iOS and Android. In general you need to adjust ( rotate and flip ) the resulting image based on the mirror and rotate value in the WebCamTexture.
There is a toolkit available that help you with solving some of these issues that you can take a look at. It's called Camera Capture Kit and is available on the assetstore ( https://www.assetstore.unity3d.com/en/#!/content/56673 ) - since the source is included for both iOS and Android it might be a good foundation for helping you tweak and solve your issue in your game or maybe it will just be a plug'n'play solution for your needs. It might let you save literally weeks in the long run since there is a lot of tweaking to get camera capturing right in Unity. Furthermore there is a functionality available to enable and disable flash light which might come in handy as well.
There is also a demo app included which is quite similar to what you have already been doing on your screens.
Cheers!

OpenGL ES sprites no longer render after updating to iOS 7.1

I am using a simple 2D sprite class based on this tutorial to render PNG bitmaps to the screen:
http://www.raywenderlich.com/9743/how-to-create-a-simple-2d-iphone-game-with-opengl-es-2-0-and-glkit-part-1
Everything worked fine on both my iPhone 4S running iOS 6.1 and my iPhone 5S running iOS 7. Since I updated to iOS 7.1, and on my MacBook Air updated to Mavericks and XCode 5.1, sprites no longer appear on the screen (I just get an empty white screen, which is the color I cleared the background to). When I build the app using XCode 5.1 and run on my iPhone 4S again, it still works.
Does anyone know what could be causing this? Has anyone run into this issue? I am having trouble getting to the source of the problem due to my lack of understanding of OpenGL ES among other things. :) My sprite class is exactly the same as the one in the tutorial.
Let me know if more details/code snippets are required.
I'm not even going to look at the sample code since it doesn't sound like it's the same as your current code. (You said 'based on'.) But I'll tell you how to find your problem.
First, clear to something other than white (like red) as a test.
If the screen turns red you at least know that your view and context and open gl in general is working. That knocks out a lot of possible culprits.
Second.. use the debug tools and chances are it will take you right to your problem. You have to run on a tethered device though and not the sim. Run your app...
Click on FPS in the debug navigator. Then click analyze and be patient. It will take a one frame snapshot of whats happening in open gl. It has to do a bunch of stuff to make that happen and it takes about 30 seconds. But then you'll have an interactive thing that shows you the frame and will let you step through processes and see what code is making that happen, and the frame as it draws each element. It's super cool actually. And probably it will show you an error message (in red).
My guess is that it's no longer loading your sprite images. Something probably changed between 6 and 7 or the versions of Xcode or of OSX. In that case the screen is blank because they're not loaded and therefore not being drawn.
EDIT:
I think the analysis will help find your problem. But to offer more possibilities, in my experience when nothing is drawing it's often one of these things:
An overall OpenGL issue - set your clear color to red or blue to test.
Shader didn't compile - always output shader compile errors so you know.
Bad Shader math or logic - use gl_FragColor = vec4(0.0,0.0,1.0,1.0) or some contrasting color to test. Can you see your structures?
Program isn't getting an attribute. Did you remember glEnableVertexAttribArray
Program isn't getting a uniform. Use the Analyze feature above to check the uniform values to make sure they made it to the shader.
(i'll add more if I think of them)
When stuff does

OpenGL ES - Where is EAGLView.h? xcode 4

Hello I'm very new to OpenGlES and i have started to try to learn it with online tutorials... but in each tutorial they ask me to create a OpenGL ES Xcode project, and then edit EAGLView.h. But I can't find it. Is it just me or has Xcode 4 changed its location etc. Also, when I run the application it gives me two cubes... 1 red and 1 blue... spinning around. In some tutorials, there is simply a multicoloured box, not in 3 dimensions. Is it possible to go back to that?
Thanks
The sample application has changed significantly since the tutorials you are reading was written.
EAGLView, in its many incarnations, provided a UIView subclass that connected OpenGL to UIKit. As of iOS 5 there's no need for a custom class because of the introduction of GLKit. The modern OpenGL sample simply uses a GLKView, which is a built-in UIView subclass connecting OpenGL to UIKit.
What the sample actually shows has also changed to highlight the vector manipulation parts of GLKit that provide everything GL ES 1.1 supplied but which was cut from ES 2.0, and more.
If you want to work up from a tutorial, you're probably going to have to find a newer one. Searching for GLKit tutorials directly is probably the best idea — this one (amongst many others) looked like it covers mostly the modern stuff, for the sake of saying something rather than nothing.
Instead of EAGLView.h and m, they have moved all of the code into files named viewController.h and m.
If you have truly generated an "OpenGL Game" project as they are calling it in the newer versions of XCode!
In terms of the OpenGL code implemented to show the red and blue boxes etc... They have changed there sample code, you can from the m file put whatever you want there!!!
You can download sample code from here and work from that:
http://developer.apple.com/library/ios/#samplecode/GLES2Sample/Introduction/Intro.html