Register FAQ / Rules Forum Spy Search Today's Posts Mark Forums Read
Go Back   MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Reply
 
Thread Tools Search this Thread Display Modes
Old Jan 18, 2013, 04:42 AM   #1
LeanneAttard
macrumors newbie
 
Join Date: Aug 2010
CALayer approach in jre7

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
LeanneAttard is offline   0 Reply With Quote
Old May 28, 2013, 05:06 AM   #2
nonod
macrumors newbie
 
Join Date: May 2013
Hi,

Did you manage to get this working??
If so, could you please share some advices?!
Thanks!
nonod is offline   0 Reply With Quote

Reply
MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -5. The time now is 11:38 AM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Copyright 2002-2013, MacRumors.com, LLC