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
Developer
cgrebeld
Posts: 26
Registered: ‎01-06-2013
My Device: Playbook developer
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

 

Please use plain text.
Developer
peter9477
Posts: 6,473
Registered: ‎12-08-2010
My Device: PlayBook, Z10

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!
Please use plain text.
Developer
cgrebeld
Posts: 26
Registered: ‎01-06-2013
My Device: Playbook developer

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;
    }

 

 

 

Please use plain text.
Developer
cgrebeld
Posts: 26
Registered: ‎01-06-2013
My Device: Playbook developer

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.

 

 

 

Please use plain text.