Posted by
Sven Gothel on
Oct 14, 2011; 3:58pm
URL: https://forum.jogamp.org/JOGL2-TextRenderer-throws-GLException-if-using-Pixel-Buffer-Objects-tp3421923p3422089.html
On Friday, October 14, 2011 04:49:57 PM Matteo Battaglio [via jogamp] wrote:
>
> Hi,
> I'm trying to use TextRenderer (from com.jogamp.opengl.util.awt) to draw a
> label on screen;
> My application makes use of PBOs to render a video stream on a texture.
> When I call textRenderer.beginRendering(width, height) it throws the
> following exception:
> "Exception in thread "AWT-EventQueue-0" javax.media.opengl.GLException:
> unpack pixel_buffer_object must be disabled to call this method."
>
> Is there a way to render the text even if using Pixel Buffer Objects?
since I am not so familiar w/ the ole text renderer, let me explain our buffer validation
code which throws the exception ..
1st the GL spec for the motivation - check for GL_PIXEL_UNPACK_BUFFER:
-
http://www.opengl.org/sdk/docs/man/xhtml/glBindBuffer.xml -
http://www.opengl.org/sdk/docs/man/xhtml/glBitmap.xmlie. in glBitmap, the buffer pointer semantics will change to a byte offset
of the mapped PBO.
This is what the spec calls a latched state, where one command
changed a state and impacts [many] other command[s semantic].
In JOGL we have 2 types of those methods (generated source code):
+++
public void glBitmap(int width, int height, float xorig, float yorig, float xmove, float ymove, ByteBuffer bitmap) {
checkUnpackPBODisabled(true);
..
+++
and
+++
public void glBitmap(int width, int height, float xorig, float yorig, float xmove, float ymove, long bitmap_buffer_offset) {
checkUnpackPBOEnabled(true);
+++
So you see, we have check proper usage of each function types which cannot be mixed
while a PBO is enabled.
I know, it kind of sucks that there is only one data channel in one GL context,
so you cannot lets say stream data here async .. and push bitmaps there.
However, this limitation is OpenGL related, not JOGLs fault.
There are a few solutions to this though:
- maybe it's possible to unbind your buffer ?
- maybe use a 2nd shared GL context ?
- maybe use direct_state_access
http://www.opengl.org/registry/specs/EXT/direct_state_access.txtThe last one, direct state access, works around this whole latched state
confinement, allowing you to name buffers directly.
For direct state access: check 'NamedBufferDataEXT(..)' which provide you
equal functionality ..
I have to admit, I haven't read the spec towards async data streaming (PBO)
maybe we continue looking for it in the direct state extension here
and create a unit test.
>
> Thanks in advance
Thank you for your question, which motivates me to go deeper into
the last named extension. We knew for years it's great. To bad
it's not in ES2 .. but I guess that will changes soon with the next ES release.
Hope the above pointers help a bit, let's discuss it here.
Cheers, Sven
>