MacGLEssentials does not work with CAOpenGLLayer/Layer backing / Lion

Originator:ewmailing
Number:rdar://9948489 Date Originated:2011-08-12
Status:Open Resolved:
Product:Mac OS X Product Version:10.7
Classification:Serious Reproducible:Always
 
12-Aug-2011 07:11 PM Eric Wing:
Summary:
I am trying to get layer backing to work with OpenGL on Lion. I just filed 9948466 which is related.
As a work around, instead of layer backed views, I went to CAOpenGLLayer hoping it would work better. While this doesn't freeze my system, I only get garbage rendered in my views.


Steps to Reproduce:
Attached is my modified example. Build and run it and you will see garbage.

Expected Results:
Should look like the original example.

Actual Results:
Garbage


Notes:
It is possible I didn't port the example correctly. It is also quick and dirty. 
If the example is not ported correctly, I would appreciate any guidance on what's wrong.  A new developer example showing CAOpenGLLayer with the modern OpenGL engine would be nice.





12-Aug-2011 07:12 PM Eric Wing:
Forgot to mention, I'm seeing OpenGL errors when I switch to CALayers/layer backed, e.g.


2011-08-12 19:04:40.688 MacGLEssentials[1259:707] NVIDIA GeForce 320M OpenGL Engine 3.2 NVIDIA-7.2.9
[Switching to process 1259 thread 0x707]
2011-08-12 19:04:43.946 MacGLEssentials[1259:707] GLError GL_INVALID_FRAMEBUFFER_OPERATION set in File:/Users/ewing/Downloads/GLEssentials/Classes/OpenGLRenderer.m Line:1093

15-Aug-2011 01:01 PM Eric Wing:
I've been injecting more glGetError()'s into the code which has led me to start calling glCheckFramebufferStatus(). In several places, such as glClear() around line 260, and I'm getting GL_FRAMEBUFFER_UNDEFINED. My current speculation is the default FBO=0 is failing for CAOpenGLLayer.

According to the sample code:
	// Init our renderer.  Use 0 for the defaultFBO which is appropriate for MacOS (but not iOS)
	_renderer = [[OpenGLRenderer alloc] initWithDefaultFBO:0];


But maybe this is a bug with layer backed views and CAOpenGLLayer?

I would appreciate feedback if this seems right. Also, I would really like to know what the fix/workaround for this is. I really need to get CALayer's going because I need to superimpose other widgets on my OpenGL layer/view.

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!