Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Native Development

Reply
Highlighted
New Contributor
Posts: 3
Registered: ‎11-21-2011
My Device: PlayBook
My Carrier: none
Accepted Solution

OpenGL rendering from ANE. Possible?

Hi,

I'm developing an UI application with Flex and need to display 3d graphics in some cases.

As I understand, this requires to make a native extension. I followed the steps of tutorial (http://supportforums.blackberry.com/t5/Tablet-OS-SDK-for-Adobe-AIR/Creating-Air-Native-Extensions-fo...) and sample code works just fine. However as soon as I try to add a OpenGL method call to the native library, it can be built, but example stops working with "The extension context does not have a method with the name ..." error for all native methods. What am I doing wrong?

 

Thanks!

Retired
Posts: 1,561
Registered: ‎04-12-2010
My Device: BlackBerry Z10
My Carrier: Bell

Re: OpenGL rendering from ANE. Possible?

[ Edited ]

Hi Michael,

 

Are you able to share a small sample project that produces this issue? My understanding is that an ANE should be able to run essentially all native code; therefore if you are seeing issue with specific APIs breaking all native methods, there may be some import or linking issue at hand.

 

EDIT: Also, you mention that the build is successful, but do there happen to be any additional warnings generated when you build the project referencing OpenGL?

 

Erik Oros

BlackBerry Development Advisor


Erik Oros | @WaterlooErik | eoros@blackberry.com | Developer Issue Tracker

If a reply has answered your question, please click Accept as Solution to help other visitors in the future.
New Contributor
Posts: 3
Registered: ‎11-21-2011
My Device: PlayBook
My Carrier: none

Re: OpenGL rendering from ANE. Possible?

Hi Erik,

I have checked it again, and found that as soon as I add bps_initialize(); line to the sayHello method of sample ANE application, library stops loading...

Here is the code:

FREObject sayHello(FREContext ctx, void* functionData, uint32_t argc,
        FREObject argv[]) {
    static screen_context_t screen_cxt;
    //Create a screen context
    screen_create_context(&screen_cxt, 0);


    screen_window_t screen_win;
    screen_create_window(&screen_win, screen_cxt);

    //Initialize BPS library
    bps_initialize();

......

 

There are no errors or warnings while building it.

However I have found the following message in the air-log:

err: extension: failed to load /accounts/1000/appdata/gltest.debug.testDev_ltest_debugfe5849c_/app/air/META-INF/AIR/extensions/com.bbtest.GLNative/META-INF/ANE/QNX-ARM/libgltest-arm.so: Unresolved symbols    (tid:1)

 

libgltest-arm.so - my native library. After removing bps_initialize(); line from native code, sample starts to work ok and log become empty.

 

Regards,

Michael

BlackBerry Development Advisor
Posts: 417
Registered: ‎10-27-2010
My Device: PlayBook

Re: OpenGL rendering from ANE. Possible?

You cannot use bps when you doing ANE. For two reasons

a) first of all it is shared library and ANE won't allow you to specify more than one library, so you have to link statically at best (for 1.0)

b) bps assumes you are the main process and will attempt to connect to navigator to get life-cycle events but air did it already, so I don't know what would happened in this case.

New Contributor
Posts: 3
Registered: ‎11-21-2011
My Device: PlayBook
My Carrier: none

Re: OpenGL rendering from ANE. Possible?

Hi Elena,

Thanks for the clarification! I will try to avoid using bps...

BTW, What do you think, in theory, is it possible to render OpenGL objects from ANE calls? Or I should abandon this idea and completely switch to the native?

 

Regards,

Michael

BlackBerry Development Advisor
Posts: 417
Registered: ‎10-27-2010
My Device: PlayBook

Re: OpenGL rendering from ANE. Possible?

It is possible. One of the reasons you may want this to use custom graphic canvas like for 3d game, but if you need  menus or buttons on top you can use air. You need to pass your window group to your native app, make a transparent window in air and play with z-order of windows to achive desired effect

Developer
Posts: 6,541
Registered: ‎10-27-2010
My Device: HTC One, PlayBook, LE Z10, DE Q10
My Carrier: Verizon

Re: OpenGL rendering from ANE. Possible?

Eleana: Correct me if I am wrong, but this is basically how the web stage works.