PDA

View Full Version : eglBindApi scope.



Nils Pipenbrinck
10-04-2006, 07:20 AM
Just a minor question:

I assume that eglBindApi sets the API for the current context, is that right? So a eglBindApi before a valid eglMakeCurrent will always return an error.

I'm a bit worried because the only source that calls eglBindApi is from the OpenVG reference code, and it calls eglBindApi right after eglInitialize (which does not make much sense unless the current API is per thread, not per context).

Could someone please shed some light on this?

Thanks,
Nils

Nils Pipenbrinck
10-04-2006, 07:26 AM
btw - I just read this powerpoint from the 2006 siggraph and they call eglBindApi right after eglInitialize as well.


Siggraph talk (http://www.khronos.org/developers/library/siggraph2006/Khronos_Tech_Talks/HUONE_-_OpenVG_How_to_Program_advanced_2D_vector_graphics .ppt)

Does this make sense?

oddhack
10-04-2006, 01:31 PM
Just a minor question:

I assume that eglBindApi sets the API for the current context, is that right? So a eglBindApi before a valid eglMakeCurrent will always return an error.

eglBindAPI just sets some global state, the "current rendering API". It has nothing to do with the current context(s), and you can call it at any time. The current rendering API is used by other calls that need to know which client API is being operated on. This is admittedly, ugly. EGL was originally specified with only one client API in mind, and supporting more than one required either a new set of calls with an additional parameter, or a global value like this. As the spec says:



Applications using multiple client APIs are responsible for ensuring the current rendering API is correct before calling the functions eglCreateContext, eglGetCurrentContext, eglGetCurrentDisplay, eglGetCurrentSurface, eglMakeCurrent (when its ctx parameter is EGL_NO_CONTEXT), eglWaitClient, or eglWaitNative.

binoymvdas
01-11-2010, 10:04 PM
I think its very old thread....but anyone can suggest me the right way to do a switch between OPENVG and OPENGLES rendering using the same EGL surface, that will be helpful for my prgrm...
i tried to do like this
1 Create EGL surface
2 Create OpenVG context
3 Create OpenGL ES context
4 Make OpenVG context current
5 Render OpenVG drawings
6 call VGFinish
7 Make OpenGL ES context current to the same surface
8 Render OpenGL ES drawings
9 Call EGLSwapBuffer
but it doesn't give any result and application crashes....can any one suggest the right method...? thanks n advance....

binoymvdas
01-11-2010, 10:06 PM
DO I need to add a EGLBindApi function before rendering....? if yes where is the right place to add it.....

jpilon
01-12-2010, 05:32 PM
Before creating an EGL context is probably a good spot.