NDK 2.0 + Playbook: is it OK to combine naitve display use and OpenGL one?

I'll try to explain what I mean.

Suppose I want to generate the text in my application using HelloWorldDisplay example bbutil_render_text() and at the same time I want to be able to view images directly in the sidebar of the window, like:

_uint8 *ScreenData;
screen_buffer_t screen_buf;
screen_get_window_property_pv(screen_win, SCREEN_PROPERTY_RENDER_BUFFERS, (void **)&screen_buf);
screen_get_buffer_property_pv(screen_buf, SCREEN_PROPERTY_POINTER, (void **)&ScreenData);
memcpy(ScreenData, CurrImg);

CurrImg has bitmap of the loaded image.

So I need to initialize the stuff first:

screen_create_context(&screen_ctx, SCREEN_APPLICATION_CONTEXT);
screen_create_window(&screen_win, screen_ctx);
// plus some other init steps

And at the same time, I see in bbutil_init_egl:

int
bbutil_init_egl(screen_context_t ctx) {
...
rc = screen_create_window(&screen_win, screen_ctx);

Thus it also creates a window (screen_win is declared static, bbutil.c), that is, I have two windows. The Question I'm trying to ask here is how they overlap? Somehow, it works but I have weird "side effects" on the image, I guess I did something wrong.

It is all covered in the documentation library screen.

looking for a SCREEN_PROPERTY_ZORDER led me to this code example that uses multiple windows:

https://developer.BlackBerry.com/native/reference/com.QNX.doc.screen.lib_ref/topic/cscreen_sample.ht...

See you soon,.

Sean

Tags: BlackBerry Developers

Similar Questions

  • PlayBook ndk - camera_take_photo his return with error 17 - file exists

    Fellow developer,

    I use C++ NDK for blackberry playbook (tests with the playbook material) and a problem came in my way. I can take pictures with the camera_take_photo function. I'm trying to capture faster so I'm setting wait to false. In this case camera_take_photo will not block running my application.

    The problem is that if the last call to image_callback of camera_take_photofunction is not yet complete and that I call camera_take_photo once again I'll error as a result. Error code is: 17 who is not related to camera_error_t. I had checked in errno.h and is:

    My question is that this kind of file? I know camera_take_photo is not save any file (only when I implement registration photo).

    Error 17 in errno.h:

    #define EEXIST          17  /* File exists  */
    

    My implementation:

    void CameraModule::takePhoto() {  camera_error_t result1 = camera_take_photo(this->m_CameraHandle, NULL, NULL, NULL, CameraModule::photoImageCallback, NULL, false);}
    
    void CameraModule::photoImageCallback(camera_handle_t cameraHandle1, camera_buffer_t * cameraBuffer1, void * params) {  // JPeG is ready and I can save it  // But this is an empty function for testing  sleep (3000); // do nothing for 3 seconds}
    

    Call us at:

    // Test 1:takePhoto(); // OK
    takePhoto(); // Error 17 from camera_take_photo, but I'm not writing any file
    // Test 2:
    takePhoto(); // OK
    sleep(5000); // Wait some seconds
    takePhoto(); // OK
    

    Flowchart to represent the error:

    Reference to the use of camera_take_photo :

    camera_error_t
    camera_take_photo(camera_handle_t handle,
                      void (*shutter_callback)(camera_handle_t, void*),
                      void (*raw_callback)(camera_handle_t, camera_buffer_t*,
                                           void*),
                      void (*postview_callback)(camera_handle_t,
                                                camera_buffer_t*, void*),
                      void (*image_callback)(camera_handle_t, camera_buffer_t*,
                                             void*),
                      void *arg,
                      bool wait);
    

    Your help is appreciated in advance.

    Thank you.

    The solution, I would say something like the following... excuse the pseudocode.

    void* burst_thread() {
        while(!stop_bursting) {
            camera_take_photo(....., still_callback, ..., true);
        }
        stop_saving = true;
        pthread_cond_signal(&queueCond);  // wake queue thread so it can exit
    }
    
    void still_callback(...) {
        to_save = new(...);
        memcpy(to_save, buffer, size);
        pthread_mutex_lock(&queueMutex);
        add_to_save_queue(to_save);
        pthread_cond_signal(&queueCond);   // wake queue thread
        pthread_mutex_unlock(&queueMutex);
    }
    
    void* save_thread(...) {    pthread_mutex_lock(&queueMutex);
        while(!stop_saving) {        if (queue_is_empty()) {
                pthread_wait(&queueCond, &queueMutex);        }
            if (!queue_is_empty()) {
                x = dequeue_buffer();
                pthread_mutex_unlock(&queueMutex);  // unlock while busy
                save_buffer(x);            delete x;            pthread_mutex_lock(&queueMutex);        }
        }    pthread_mutex_unlock(&queueMutex);    // cleanup queue    while(!queue_is_empty()) {        clean up dangling buffers?  or save them to disk. whatever.  just make sure not to leak memory.     }
    }
    
    void start_bursting() {
        stop_bursting = stop_saving = false;
        pthread_create(save_thread);
        pthread_create(burst_thread);
    }
    
    void stop_bursting() {
        stop_bursting = true;
        pthread_join(burst_thread_tid);
        pthread_join(save_thread_tid);
    }
    

    There is a little extra synchronization required in the processing thread: see if (is_queue_empty()).  This is because the thread passes time saving files and cannot be blocked on condvar cheque when the signals of the other thread.  If (check is_queue_empty()) is here to detect these missed signals.

    When someone hits the "start by holding button images", you start the shooting wire and thread photo-economie.  When a user releases the button, or click on a stop button, you report the nets to stop and wait for them to end.

    Note that the termination of the thread of savings made by shooting wire.  This allows to avoid prematurely stop the saving thread when the callback is always enqueueing a buffer.

    See you soon,.

    Sean

  • Spinner control in app Playbook does not?

    Everyone was able to implement successfully tneil spinner control in the playbook? I use the latest source and compile from github (http://supportforums.blackberry.com/t5/BlackBerry-WebWorks/API-Candidate-Spinner-Control/td-p/634388... but it seems to fail at the next line of the code...)

    // Open the spin dialog
        blackberry.ui.Spinner.open(options, function (selectedIndex) {
                alert(selectedIndex); }
            );
    

    .. which leads me to believe he is not taken in charge. Any help is appreciated.

    Thank you!

    Hi drjg22,

    Impossible to use any custom JavaScript extension written in Java (for example my spinner control) on the PlayBook because the PlayBook doesn't currently have a Java virtual machine and the underlying infrastructure is different.

    In my opinion, the blackberry.ui.dialog.customAsk () function provides a bit of a similar interface, but I do not think that this gives the appearance of the carousel.

    Just notice that in the next SDK drop this function will be renamed customAskAsync() to make sure that we don't have any clashes with the Smartphone API.  Thought I'd give you a heads up

  • PlayBook OS and rim: transitionEffect?

    The config.xml file rim: transitionEffect is supported for PlayBook or not?  I can't operate as documented I tried fadeIn fadeOut and slideOver. There is no effect at all.

    This old post says that it is not supported for PlayBook. However it is still the last documentation and there is no notes indicating that it applies to the phone OS only.  I am aware of jQuery Mobile transitions and it's not the way I want to go down.

    This is the way that transition screens are designed.  Their goal is to appear while loading remote content for someone to show a "loading" progress

    Most of these features has been implemented due to the slower load time of pages on BB5 so that the user is not looking at a blank screen as remote content is loading.

    On the PlayBook, you can get the desired effect using tools such as jQuery mobile or Sencha touch.

  • Best practices for designing a view in PlayBook

    Hello world

    I'm new to BlackBerry PlayBook development and I would like to know how to make a user interface appropriate for playbook, what would be the best practice to do and it will be helpful to me if someone can post sample code here

    Thanks in advance

    A few tips:

    * Views extend Sprite

    * Views should be resizable, IE have a setSize() method

    * views should 'PIN' children at some edges of the screen, from when they are resized it runs correctly.

    * a parent class must listen to the scene for Event.RESIZE and call of resizing on the view.

    * Use the component of QNX, set if possible

    * Implement native controls, like sliding down to the options

  • No button back for Playbook and Z10

    My request of WebWorks HTML5 for Playbook and Z10 occasionally open external web pages and at least in the Playbook there no back button during the display of the external web pages. How can I add a "back" button? I spent a few hours looking for solutions, without success. I looked at bbUI.js, but it seems not able to add a "back button" while looking at an external pages - unless I'm mistaken.

    Any suggestions?

    Bb10, your solution is childBrowser: https://github.com/blackberry/BB10-WebWorks-Samples/tree/master/childBrowser

  • Background tasks repeated on the PlayBook?

    Hello!

    I need to know if there is a way to implement a background task repeating for the PlayBook within a WebWorks app? I've used the search function, but it seemed that this is not possible, but I can't believe that.

    Is there a chance to make any kind of workaround or mix things (maybe have a code in the application, as well as native code webworks or something else)? If Yes, could you do a picture what needs to be done to get the background tasks repeated work?

    Thanks in advance.

    See you soon,.

    Sven

    Hi Sven,

    I think we've covered this broad already via Twitter, but I wanted to answer for others here in the forums.

    Currently the Tablet OS does not support background tasks.  Features of the application can run only during the execution of the application itself.

    To achieve something as a data synchronization, I would recommend this doing in the background while the application is open and during its lifecycle from start-up. This can be accomplished by using async XmlHttpRequest and perhaps even the Web workers?

    See you soon,.

    Adam

  • PlayBook not Java?

    I understand that correctly? The PlayBook will not java as a development language use?

    You're not understanding it correctly.

    PlayBook will support several development options, which one will be based on Java.

  • Can I have separate keys of singing for BlackBerry PlayBook?

    Hi all

    I have Blackberry signature keys, but in an article that I heard that it is separate keys required for the Blackberry Playbook of signature development applications is it true?

    If not can I use same signature keys for this tablet also?

    in fact, I have a Playbook with me, that's why I ask you and I want to convert my Blackberry Playbook app android app please check below link for FYI.

    https://bdsc.webapps.BlackBerry.com/Android/BPAA/user-identification

    Kiran.

    --------------------------------------------------------------------------------------------------------------------------------------------------------------------------

    I give glory for each answer

    HI Kiran_b,

    you are right that the application device playbook and BlackBerry have different signing keys.
    You cannot use blackberry sign button for Playbook.
    In fact in the blackberry device you must sign the playbook and .cod files you must sign the .bar file.

    --------------------------------------------------------------------
    Please mark as resolved messages if you found a solution.
    Feel free to press the Bravo thank the user who has helped you.

  • HTML buttons not senstive to the touch in Playbook

    Hello

    I have a Playbook WebWorks app with style with CSS buttons using images. I have a problem with the key sensitveness with these buttons. Navigation does not always work when a button is tapped.  Everyone around here with similar problems? Please let me know. Also I would like to know if there is a solution to this.

    Thanks in advance

    Praveen

    Finally found a solution for the issue.

    Its better to use ontouchstart oronmousedown instead ofonclickto the button action.

  • Advertising service for PlayBook is authorized Adsense?

    Because the BB Adveristing service is not activated yet for the BB PlayBook, I wondered if we were allowed to use Google Adsense to monize for now? I think that ive seen it somewhere in an app before... or maybe if RIM is not answer I will take it as "we will turn our backs on this" * wink wink nudge nudge * a bit much?

    You can use any ad network in your application that you like. For more information, please visit the site.

    See you soon,.

    Dustin

  • hasDataCoverage fails for Playbook WebWorks

    Hello

    'HasDataCoverage' should work for Blackberry Playbook Simulator (beta 2)?

    I'm using the SDK WebWorks... and get the error message: "you are not in the coverage, try adding cities later.

    Do I have to activate something else, or if this feature is not enabled on the playbook Simulator.

    Thanx, H.

    PS: Do not know if there is somewhere else to post Playbook & Webworks related research - there is no Tablet OS section for webdev, only for AdobeAir

    hasDataConnection returns true if there is at least one network interface active on the PB. It works fine on a real device. For some reason, the Simulator always returns false. It might be because of the VMware virtual network bridge.

  • Why my application is not available for download through App World on the Playbook?

    Hello

    I wonder if anyone can help me how I can get my app - "Downtown Livermore' (http://appworld.blackberry.com/webstore/content/reviews/43728?lang=en) available for download on App world on the Playbook. It is available on Blackberry phones, but not on the playbook. I can't find an option to make

    available on the Playbook. Where can I configure that? I need to create a presentation of the new?

    When you create the new version, you must download the Playbook (.bar) bundle and to specify that this bundle will support the Tablet (as a platform). I believe you can download simultaneously bundle for smartphones and bundle for Playbook, however you can not change the existing version and add beams. So I would say to create a new version and download the two beams.

    Another option would be to create a new application called 'Your-app-name for Playbook', some developers prefer to do.

  • 1.0.1 new SDK. How do you uninstall PlayBook applications with this one?

    Looks like the option to uninstall went running on the menu "device".

    What are the options to uninstall the Simulator or the PlayBook device?

    You can click the icon and hold it pressed until she shivers. then click on the trash can. If you are finished, click the icon of verification for the topleft

  • PlayBook SDK 1.0.1 - Question

    Hello!

    So with the new SDK 1.0.1 for the BlackBerry PlayBook, there the new APIs that developers can use? Is there a list or something that shows me what API have been added (if any) in this version?

    Thank you!

    Release notes: are here

Maybe you are looking for