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
Contributor
Posts: 10
Registered: ‎10-27-2011
My Device: BlackBerry Classic
My Carrier: None
Accepted Solution

Graphics Stack and Screen Windows

Hey

 

Could someone explain the 'window' concept and how that interacts with the graphics stack a bit more to me?

 

I have a game, and my main window has been initialized with OpenGL. Now, I want to play a video, and I was hoping that using the 'mmrenderer' in combination with the 'window' system that I could simply create a child window, have it join the main group, make it visible, and attach the mmreneder to that. Early experiments with this have lead me to believe I am doing it wrong. I will often hit an error when I try to call eglSwapBuffers on the parent window.

 

So how do the windows interact with each other, in particular the child parent relationship. For instance, can a child window have a different format then the parent (SCREEN_FORMAT_RGBA8888 for video vs SCREEN_FORMAT_RGBX8888 for OpenGL). Is it even possible to use the mmreneder to play video over top of an opengl based window or am I completly wrong?

 

I experimented a little further, created a parent window, then created a child window that I initialized with EGL, but that lead to its own issues, such as:

screen_create_window_buffers: Not supported

 

If I cannot overlay a child window with video, is it possible to create to SCREEN_APPLICATION_WINDOWS, one for OpenGL and one for mmrenderer, and then swap the two windows when I wish to play video. I am also under the impression that can only be one SCREEN_APPLICATION_WINDOW per process.

 

Hoping to get a bit more detail on how the windows all work together. 

 

Contributor
Posts: 10
Registered: ‎10-27-2011
My Device: BlackBerry Classic
My Carrier: None

Re: Graphics Stack and Screen Windows

Perhaps slightly answering my own question, I solved most of my issues by moving when I join a group to the very end which somewhat makes sense. Joining a group sort of commits the window up to a point I guess in which I can no longer create buffers. Can someone confirm if thats true, I still do not have video, but I am not crashing either Smiley Happy. SO I am hoping I am on the right track.
Contributor
Posts: 11
Registered: ‎10-29-2011
My Device: PlayBook
My Carrier: None

Re: Graphics Stack and Screen Windows

Hi,

 

Reading your post, it looks like we have exactly the same problem. I experimented various methods, and the best I can have is a black screen on top of my OpenGL layer, with the movies's audio track playing. I also receive the events. But the video is desperately not visible Smiley Sad

Contributor
Posts: 10
Registered: ‎10-27-2011
My Device: BlackBerry Classic
My Carrier: None

Re: Graphics Stack and Screen Windows

Hey,

 

Your doing better then I. How did you end up getting black on the screen?

 

I essentially do the following:

a) Create window type Application

b) Create window 'group'

c) Set my format to 'SCREEN_FORMAT_RGBX8888' Create my buffers, and setup the window with EGL 

This gives me an application window with OpenGL enabled

 

I then:

a) Create a window type child

b) Set transparency to be SOURCE_OVER

c) Set insivible

d) Set format/usage to SCREEN_FORMAT_RGBA8888/SCREEN_USAGE_NATIVE

e) Create a buffer as in the 'video' example

f) Post the screen

g) Set a window ID (which will be used with mmrenderer, though I am not certain if SET_PROPERTY_ID_STRING is the same as winid that mmrenderer uses yet).

h) Join the group

i) Mark the zorder as 1 and make it visible

 

I expect to see at least black, but I can still only see my OpenGL window. I do not crash however Smiley Happy

 

How do you guys get the black screen? You seem to be slightly further along then I.

Contributor
Posts: 11
Registered: ‎10-29-2011
My Device: PlayBook
My Carrier: None

Re: Graphics Stack and Screen Windows

The difference is that I'm using SCREEN_FORMAT_RGBX8888 for the movie surface format. Indeed using SCREEN_FORMAT_RGBA8888 I also see my OpenGL window Smiley Happy

 

I also don't use the SOURCE_OVER thing.

 

Concerning the "g" point, I also had the same doubts... but I made like you.

Contributor
Posts: 10
Registered: ‎10-27-2011
My Device: BlackBerry Classic
My Carrier: None

Re: Graphics Stack and Screen Windows

Hey, not sure if the RGBX8888 vs RGBA8888 is correct either. I noted that when I set video player application I wrote to use RGBX8888 instead of RGBA8888 it did not play. Perhaps there is an additional setting that needs to be given to the mmrenderer to run with this differing colour space.
Contributor
Posts: 11
Registered: ‎10-29-2011
My Device: PlayBook
My Carrier: None

Re: Graphics Stack and Screen Windows

Oh ok, interesting...

Contributor
Posts: 10
Registered: ‎10-27-2011
My Device: BlackBerry Classic
My Carrier: None

Re: Graphics Stack and Screen Windows

Hey

For those reading this or stuck, I got some answers from RIM on this. Couple of points:
a) The window architecture is a fixed three layer architecture.
e.g. an application window -> child window -> embedded window
b) When you attach the mmrenderer it creates its own child window in the application window. So you do not need t a child window to render into, nor in the video example, does the video render to the application window, it renders to a child window in the application window.
c) To get the child window the video renders into listen for the screen event 'SCREEN_EVENT_CREATE'. At which point you can then tweak the window if you like.

So my understanding, and someone can correct me if I am wrong, is that you should not put video into a child window, nor should you put child windows into child windows.

For the color format use RGBA.
Contributor
Posts: 11
Registered: ‎10-29-2011
My Device: PlayBook
My Carrier: None

Re: Graphics Stack and Screen Windows

Hi,

 

Sorry I also had an anwser from RIM engineers (great support BTW), and all is working correctly. I planned to make a post on the forum as you did, but did not found the time yesterday. Thanks to you for having done it Smiley Wink

 

Concerning the RGBA format, I discovered a possible alpha blending GL bug in the drivers when using this format. But using RGBX also works for me, and no GL bug. For info I reported the problem to TI yesterday, but in the meantime suggest to use RGBX.

Contributor
Posts: 10
Registered: ‎10-27-2011
My Device: BlackBerry Classic
My Carrier: None

Re: Graphics Stack and Screen Windows

Cool thanks, I will give that a shot, out of curiosity, have you been able to resize the video window yet?if so how? I have tried, but it never seems to take effect using things like 'SCREEN_PROPERTY_POSITION' and 'SCREEN_PROPERTY_SIZE'.