The Khronos Group - a non-profit industry consortium to develop, publish and promote open standard, royalty-free media authoring and acceleration standards for desktop and handheld devices, combined with conformance qualification programs for platform and device interoperability.

If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

Re: OpenGL + OpenVG

A context, by it's very nature, is either Open VG, Open GL ES [or most recently Open GL], but not a combination of them.
A context is, if you will pardon OOP lingo, an instance of a single rendering API.

That said, it's perfectly valid to create multiple contexts - one for each API you wish to render with, and simply use eglMakeCurrent() to switch between them (re-using the same drawing surface). This will get you the effect you seem to be looking for.

The only public implementation I am aware of that implements both OpenVG and OpenGL ES is hybrid's old Rasteroid implementation (if you fail to find that [the hybrid.fi has been down for a long time now], see if the Mesa implementation supports both at the same time - don't know if it does).

Re: OpenGL + OpenVG

If you have EGL and want to render to a VG texture - sure.
Use eglCreatePbufferFromClientBuffer() to create your surface.
If intending to draw to a GL texture, you could try eglBindTexImage() and see if it works [I have not used it]
Word of warning: these functions are often not implemented in many EGL implementations.

If they are not implemented, try looking for one OpenVG/OpenGL ES extensions that do something similar. I could have sworn I've seen something on the topic while browsing the extension registry.

If all else fails, you're stuck with vgReadPixels() from a regular pbuffer [but you'll have to suffer performance penalty of reading and writing textures from main memory to GPU memory of course].

Re: OpenGL + OpenVG

Thanks jpilon, I went over the documentation on those extensions, and they seem like they're just what I was looking for. Unfortunately, I'm pretty sure our device doesn't have support for these extensions. Do you think there exist ways to convert the OpenVG context/surface into a Texture2D using just standard EGL methods?

At this time I'd also like to discuss another possibility: overlaying the OpenVG & OpenGL surfaces onto the same display. Here's the pseudo-code:

Would this work to render OpenVG & OpenGL onto the same display? The only red-flag I see here is if swapbuffer actually replaces the entire display with the surface. If that's the case, we'd probably only see the OpenGL content... which is not the desired result.

Re: OpenGL + OpenVG

If all you care about is compositing the image like that, and not storing it in a texture, then the normal way to do that is:
- create only one surface
- use it for both ovg and ogl rendering
- use vgFinish() instead of eglSwapBuffers when you finish the ovg rendering
- makecurrent the ogl context with the same surface (you may need to makecurrent() with NULL parameters first, depending on implementation)
- use the eglSwapBuffers() after finishing the ogl rendering.