DNESS / cocos2d-iphone

Automatically exported from code.google.com/p/cocos2d-iphone
1 stars 0 forks source link

MacGLView conflicts with Image Kit #1207

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Create a Mac OS Project in XCode and set up a MacGLView
2. Add a View to the Window and set up a IKImageBrowserView
3. If the IK view is initiated before the MacGLView the Cocos2D is rendered 
with corrupt depth and showing ie. labels as white rectangles instead of the 
fonts
4. Additionally "Display FPS"=YES results in EXC_BAD_ACCESS in 
glWriteElements() function in CCTextureAtlas.m:
#if CC_TEXTURE_ATLAS_USE_TRIANGLE_STRIP
    glDrawElements(GL_TRIANGLE_STRIP, (GLsizei) n*6, GL_UNSIGNED_SHORT, (GLvoid*) (start*6*sizeof(indices_[0])) );
#else
    glDrawElements(GL_TRIANGLES, (GLsizei) n*6, GL_UNSIGNED_SHORT, (GLvoid*) (start*6*sizeof(indices_[0])) );
#endif // CC_TEXTURE_ATLAS_USE_TRIANGLE_STRIP

What is the expected output? What do you see instead?
- I expect to see the Cocos2D objects rendered as normal, but I see the objects 
rendered with corrupted graphics, like the depth is not more than 8 bit os 
similar!

What cocos2d version / SVN revision are you using ?
- 1.0.0 Final Release

What iPhoneSDK are you using ?
- i use the Mac OS version

Debug or Release ?
- Debug

Does this happens on device ? or on the simulator ? or on both ?
- Neither, on Mac OS

Please provide any additional information below.

Original issue reported on code.google.com by joh...@ungerchristensen.dk on 14 Jul 2011 at 10:12

GoogleCodeExporter commented 9 years ago
Could you attach a test case ? 
Thanks.

Original comment by ricardoq...@gmail.com on 14 Jul 2011 at 11:40

GoogleCodeExporter commented 9 years ago
Attached ImageKitTest project.
The reference to cocos2d folder, you should set up yourself. it points at a 
location on my HD that i did not zipped.
1. You can set the "setDisplayFPS" to YES in the AppController to see the 
"glDrawElements()" bug
2. you can change the Tab in the NIB file to show Tab 1 and see the corrupted 
graphics on the Label

Kindest Regards,
Johnny

Original comment by joh...@ungerchristensen.dk on 15 Jul 2011 at 6:56

Attachments:

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
thanks. I  could reproduce it. I guess ImageKit is also using a GL context, but 
I don't know why the cocos2d GL context is "broken"...

Original comment by ricardoq...@gmail.com on 16 Jul 2011 at 1:58

GoogleCodeExporter commented 9 years ago
I see this exact same behavior (corrupted textures and/or bad access crash), 
but I am not using Image Kit.  I don't think the problem is directly tied to IK.
These errors occur rather often (1 out of 10 runs), so I would think it should 
be easy for others to reproduce in Mac environments.  Is that not the case?

Original comment by glenn...@gmail.com on 28 Jul 2011 at 8:51

GoogleCodeExporter commented 9 years ago
@glenn: Could you attach an example that reproduces it ? Thanks.

Original comment by ricardoq...@gmail.com on 1 Aug 2011 at 5:57

GoogleCodeExporter commented 9 years ago
Unfortunately, my app is rather large, and proprietary code to my company, so I 
can't upload a working project.  And I don't have time at the moment to make a 
new demo project to test with.  However, I am for the most part using the 
standard cocos2d Mac template.  I have plenty of custom classes, but none that 
should affect the texture cache / memory.
The really odd thing is that the corrupted textures usually contain garbled 
portions of my Mac's screen.  For example, I might see a bit of menu bar or a 
piece of my desktop image.  This leads me to believe that it's a pretty 
low-level error that is occurring, possibly in the graphics card's texture 
memory (which, naturally, the Mac OS is sharing for it's own rendering)

Original comment by glenn...@gmail.com on 28 Aug 2011 at 5:30

GoogleCodeExporter commented 9 years ago
Here's an example of the problem I see.  You can see some bits of the Xcode 
status message in the corrupted textures.  http://tinypic.com/r/2co23if/7

Original comment by glenn...@gmail.com on 3 Sep 2011 at 5:11

GoogleCodeExporter commented 9 years ago
It seems I'm having the same issue. I'm using cocos2d to render a map editor 
that uses NSControls that updates the scene when they are changed. Sometimes it 
works correctly and sometimes it crashes in the same way at, raising a 
EXC_BAD_ACCESS at:

-(void) drawNumberOfQuads: (NSUInteger) n fromIndex: (NSUInteger) start
{
...
glDrawElements(GL_TRIANGLES, (GLsizei) n*6, GL_UNSIGNED_SHORT, (GLvoid*) 
(start*6*sizeof(indices_[0])) );
...
}

Original comment by pedro.is...@gmail.com on 14 Dec 2011 at 3:34