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


Thank you for visiting the BlackBerry Support Community Forums.

BlackBerry will be closing the BlackBerry Support Community Forums Device Forums on April 1st (Developers, see below)

BlackBerry remains committed to providing excellent customer support to our customers. We are delighted to direct you to the CrackBerry Forums, a well-established and thorough support channel, for continued BlackBerry support. Please visit http://forums.crackberry.com or http://crackberry.com/ask. You can also continue to visit BlackBerry Support or the BlackBerry Knowledge Base for official support options available for your BlackBerry Smartphone.

"When we launched CrackBerry.com 10 years ago, we set out to make it a fun and useful destination where BlackBerry Smartphone owners could share their excitement and learn to unleash the full potential of their BlackBerry. A decade later, the CrackBerry community is as active and passionate as ever and I know our knowledgeable members and volunteers will be excited to welcome and assist more BlackBerry owners with their questions."

- Kevin Michaluk, Founder, CrackBerry.com

Developers, for more information about the BlackBerry Developer Community please review Join the Conversation on the BlackBerry Developer Community Forums found on Inside BlackBerry.


Reply
Highlighted
Developer
Posts: 26
Registered: ‎01-06-2013
My Device: Playbook developer
My Carrier: NA
Accepted Solution

C++ opengl es 2.0 eglGetDisplay fails

Hi,

  I'm porting a C++/OpenGl ES 2.0 game to the current Playbook API.  My problem is that inside of bbutil_init_egl, eglGetDisplay is returning EGL_NO_DISPLAY without setting any error:

 

int main(int argc, char *argv[]) {
    screen_context_t screen_cxt;

    //Initialize BPS library
    bps_set_verbosity(2);
    bps_initialize();

    screen_create_context(&screen_cxt, 0);
    if (EXIT_SUCCESS != bbutil_init_egl(screen_cxt, GL_ES_2, AUTO)) {
         fprintf(stderr, "bbutil_init_egl failed\n");

 

The log output is:

[BPS:INFO] BPS setting verbosity 2
[BPS:INFO] bps init
[BPS:INFO] BPS initialized successfully
[BPS:INFO] Initializing channels for thread
[BPS:INFO] channel_create(783852,1,0) called
[BPS:INFO] io_notifier_create(3526836,0)
eglGetDisplay: function succeeded
bbutil_init_egl failed

 

Any idea where to start debugging this?

 

I tried the same initialization code in a stripped down little C++ app and did NOT see the problem there.  So maybe it's something in my build settings or manifest or something?

 

Thanks

 

Developer
Posts: 6,473
Registered: ‎12-08-2010
My Device: PlayBook, Z10
My Carrier: none

Re: C++ opengl es 2.0 eglGetDisplay fails

I think, there's a fair bit more required before you can set up the EGL stuff. Have you read the docs on it, or looked at a sample?  The Momentics IDE can make an OpenGL template app for you with some code that sets that up, or you can read the gory details (recommended) under http://developer.blackberry.com/native/documentation/bb10/opengl_es_developer_guide.html   It's pretty thorough, as I recall.


Peter Hansen -- (BB10 and dev-related blog posts at http://peterhansen.ca.)
Author of White Noise and Battery Guru for BB10 and for PlayBook | Get more from your battery!
Developer
Posts: 26
Registered: ‎01-06-2013
My Device: Playbook developer
My Carrier: NA

Re: C++ opengl es 2.0 eglGetDisplay fails

Thanks for the reply.

Yes, I've looked over the docs and tried out the sample App - it works fine.

 

I guess my question is, for the bbutil.c code that comes with the OpenGL ES2 template App, under what conditions would eglGetDisplay return EGL_NO_DISPLAY?:

 

    egl_disp = eglGetDisplay(EGL_DEFAULT_DISPLAY);
    if (egl_disp == EGL_NO_DISPLAY) {
        bbutil_egl_perror("eglGetDisplay");
        bbutil_terminate();
        return EXIT_FAILURE;
    }

 

 

 

Developer
Posts: 26
Registered: ‎01-06-2013
My Device: Playbook developer
My Carrier: NA

Re: C++ opengl es 2.0 eglGetDisplay fails

Following up:  

I fixed this problem, it actually seemed to be related to some problem with static linking of my app.  I was compiling some support code as static libraries and then linking them to my final app.  When I removed the static linking and just compiled all that support code into the main project, this problem went away!  Really weird.