Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

LeanneAttard

macrumors newbie
Original poster
Aug 30, 2010
3
0
Hi all,

I have a java application which opens upa window calls functions in a native library to draw using OpenGL.
I have done this by getting the NSView of the window using:

JAWT_MacOSXDrawingSurfaceInfo* ads_macsfinfo = (JAWT_MacOSXDrawingSurfaceInfo*)ads_sfinfo->platformInfo;
//gets the object responsible for drawing associated with the view obtained from the Java AWT surface
parent_view = (ads_macsfinfo->cocoaViewRef);

Then a customized NSview is added as subview to this view using:
[parent_view addSubview: customview]
Drawing is done offscreen in an FBO and then drawing is displayed by copying the texture to onscreen in drawrect. (drawrect being forced using setNeedsDisplay]
This all was functioning perfectly until JRE 7, the NSView approach is no longer possible and instead the CALayer must be used.

I am thus trying to create the same customised NSView as before (now withouthout having parent view and window) and setting this as layer backed using:
[customview setWantsLayer:YES]
The layer which has now been added to the nsview (view.layer), is then set as the layer property of JAWT_SurfaceLayers using

id<JAWT_SurfaceLayers> surfaceLayers = (id <JAWT_SurfaceLayers>)macosx_dsi->platformInfo;
if(surfaceLayers.layer == NULL) {
surfaceLayers.layer = viewlayer;
}

However the function drawrect is only called once eventhough I am calling [customview setNeedsDisplay:YES]
as well as no events are being received on the nsview.

Is this the proper way of setting the connection between the layer and view?

Thanks for any help
 

nonod

macrumors newbie
May 28, 2013
1
0
Hi,

Did you manage to get this working??
If so, could you please share some advices?!
Thanks!
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.