eaglview

Screen-to-World coordinate conversion in OpenGLES an easy task?

大憨熊 提交于 2019-12-12 08:54:42
问题 The Screen-to-world problem on the iPhon e I have a 3D model (CUBE) rendered in an EAGLView and I want to be able to detect when I am touching the center of a given face (From any orientation angle) of the cube. Sounds pretty easy but it is not... The problem: How do I accurately relate screen-coordinates (touch point) to world-coordinates (a location in OpenGL 3D space)? Sure, converting a given point into a 'percentage' of the screen/world-axis might seem the logical fix, but problems would

Cocos2d effects slow down FPS drammatically and how to initialize EAGLView properly

三世轮回 提交于 2019-12-11 14:22:32
问题 EDIT2: In response to the answer below I did create a different GameScene for testing the framerate performance with 4 sprites animated by a CCShaky3D effect. The problem still persist as the fps is still around ~15fps. I paste the code at the end of this question to facilitate reading. My assumption is that is due to the fact that I am running more than one CCShaky3D at the same time. Is anyone able to run multiple CCShaky3D effects at the same time without frame rate drop? I introduced

Multiple EAGLViews but only one copy of each texture - how?

走远了吗. 提交于 2019-12-05 19:42:55
I have an app running on iPad which is using lots of textures, rendering into one EAGLView. Now I need a second EAGLView, sharing textures with the first. I can get both views rendering fine, in parallel, on screen, by fixing some design mistakes in Apple's code (e.g. the default ViewController needs some tweaks to support multiple child EAGLView objects). But I can't get the textures to be shared. I cannot duplicate the textures (that would double memory usage - and we're using most of the mem already). I can't find any documentation from Apple on how to share textures between multiple

EAGLView to UIImage color conversion issue

混江龙づ霸主 提交于 2019-12-04 17:25:54
问题 I have an EAGLView (taken from Apple's examples) which I can successfully convert to a UIImage using this code: - (UIImage *)glToUIImage:(CGSize)size { NSInteger backingWidth = size.width; NSInteger backingHeight = size.height; NSInteger myDataLength = backingWidth * backingHeight * 4; // allocate array and read pixels into it. GLuint *buffer = (GLuint *) malloc(myDataLength); glReadPixels(0, 0, backingWidth, backingHeight, GL_RGBA, GL_UNSIGNED_BYTE, buffer); // gl renders “upside down” so

Screen-to-World coordinate conversion in OpenGLES an easy task?

痴心易碎 提交于 2019-12-04 07:33:46
The Screen-to-world problem on the iPhon e I have a 3D model (CUBE) rendered in an EAGLView and I want to be able to detect when I am touching the center of a given face (From any orientation angle) of the cube. Sounds pretty easy but it is not... The problem: How do I accurately relate screen-coordinates (touch point) to world-coordinates (a location in OpenGL 3D space)? Sure, converting a given point into a 'percentage' of the screen/world-axis might seem the logical fix, but problems would arise when I need to zoom or rotate the 3D space. Note: rotating & zooming in and out of the 3D space

EAGLView to UIImage color conversion issue

扶醉桌前 提交于 2019-12-03 12:19:28
I have an EAGLView (taken from Apple's examples) which I can successfully convert to a UIImage using this code: - (UIImage *)glToUIImage:(CGSize)size { NSInteger backingWidth = size.width; NSInteger backingHeight = size.height; NSInteger myDataLength = backingWidth * backingHeight * 4; // allocate array and read pixels into it. GLuint *buffer = (GLuint *) malloc(myDataLength); glReadPixels(0, 0, backingWidth, backingHeight, GL_RGBA, GL_UNSIGNED_BYTE, buffer); // gl renders “upside down” so swap top to bottom into new array. for(int y = 0; y < backingHeight / 2; y++) { for(int x = 0; x <

How do I grab an image from my EAGLLayer ?

走远了吗. 提交于 2019-12-01 00:13:42
I'm looking for way to grab the content of my opengl (as UIImage) and then save it into a file. I'm now giving glReadPixels a try though I'm not sure I'm doing the right thing as of what kind of malloc I should be doing. I gather that on OSX it's GL_BGRA but on the iPhone that doesn't work... All OpenGL|ES complient GL-implementations have to support GL_RGBA as a parameter to glReadPixels. If your OpenGL|Es supports the GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES extension you can also query the native format. glReadPixels will understand this format as a parameter to glReadPixels and allows you

Why is my EAGLVIew not rendering anymore in iOS 4.2?

筅森魡賤 提交于 2019-11-29 08:12:22
Upgrading to the iOS SDK 4.2 I'm experiencing several misbehaviors in my application (another one is asked here ). The one I'm gonna ask your help for concerns an OpenGL view (an EAGLView subclass) that renders no more the 3d model I'm putting in. The view is allocated and it appears to recognize the gestures but its content is not visible (I've checked that it's about the view and not the misplacing of the model by coloring the background: it does not color it through glClearColor() ). When I double tap it it shall resize (it goes fullscreen, before this it is a little UIVIew) calling this

Capturing EAGLview content WITH alpha channel on iPhone

|▌冷眼眸甩不掉的悲伤 提交于 2019-11-29 08:02:57
have been struggling with this issue for quite some time now and couldn't find an answer so far. Basically, what I want to do, is capturing the content of my EAGLview and then use it to merge it with other images. Anyway, the mainproblem is, that everything transparent in my EAGLview renders opaque when saving it to the photoalbum or putting it into a UIImageView. Let me share some code with you, I found somewhere else: - (CGImageRef) glToUIImage { unsigned char buffer[320*480*4]; glReadPixels(0,0,320,480,GL_RGBA,GL_UNSIGNED_BYTE,&buffer); CGDataProviderRef ref = CGDataProviderCreateWithData

Why is my EAGLVIew not rendering anymore in iOS 4.2?

被刻印的时光 ゝ 提交于 2019-11-28 01:53:48
问题 Upgrading to the iOS SDK 4.2 I'm experiencing several misbehaviors in my application (another one is asked here). The one I'm gonna ask your help for concerns an OpenGL view (an EAGLView subclass) that renders no more the 3d model I'm putting in. The view is allocated and it appears to recognize the gestures but its content is not visible (I've checked that it's about the view and not the misplacing of the model by coloring the background: it does not color it through glClearColor() ). When I