View Full Version : _tnl_draw_prims: Assertion `ctx->NewState == 0x0'

02-05-2011, 01:58 PM
Hi All

I'm trying to debug some code in GNU Octave where some OpenGL based plotting code causes a crash. I have been able to determine that the crash happens in a call to 'glRasterPos3d'. Running things in 'gdb' gives me the following info:

fo#�X: tnl/t_draw.c:406: _tnl_draw_prims: Assertion `ctx->NewState == 0x0' failed.

Program received signal SIGABRT, Aborted.
0xb7fe1424 in __kernel_vsyscall ()
(gdb) bt
#0 0xb7fe1424 in __kernel_vsyscall ()
#1 0xb5102941 in raise (sig=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:64
#2 0xb5105e42 in abort () at abort.c:92
#3 0xb50fb8e8 in __assert_fail (assertion=0xb1d342f4 "ctx->NewState == 0x0", file=0xb1d342e7 "tnl/t_draw.c", line=406, function=0xb1d3438c "_tnl_draw_prims") at assert.c:81
#4 0xb1bfd216 in ?? () from /usr/lib/dri/i965_dri.so
#5 0xb1b04148 in ?? () from /usr/lib/dri/i965_dri.so
#6 0xb1bf51f4 in ?? () from /usr/lib/dri/i965_dri.so
#7 0xb1bf0e17 in ?? () from /usr/lib/dri/i965_dri.so
#8 0xb1bf29f0 in ?? () from /usr/lib/dri/i965_dri.so
#9 0xb1baa0c1 in ?? () from /usr/lib/dri/i965_dri.so
#10 0xb757f8fc in glps_renderer::render_text (this=0xbfffb4a8, txt=..., x=0, y=1.0278551532033426, z=0, ha=1, va=2, rotation=0) at gl2ps-renderer.cc:144

Being a complete newbie in OpenGL I don't really know how to debug this. Does anybody have any thoughts?


02-05-2011, 05:18 PM
Check that you already have a GL context initilized, before any other gl command.

Otherwise, it looks like you should file a bug to Mesa3D...

02-06-2011, 10:37 AM
Thanks for the quick reply :-)

Admitting ignorance here, but how do I check that my context is initialised? I tried Google'ing this, but completely failed :-( In general, how do I find such information?


02-06-2011, 11:13 AM
How do you create your opengl context ? Once it is done, it is initialized.

02-06-2011, 11:26 AM
The thing is I'm trying to debug a rather large code base (GNU Octave) that I don't know perfectly well. The code uses FLTK for windowing. I take your answer to mean that there is no function for determining if the current context exists. Is that correct? It would be excellent for me if I could simply add

std::cerr << is_gl_context_initialized () << std::endl;

to the code as it would allow me to easily determine if I should file a bug at Mesa3D or if I need to step through the code to determine why no context exists in the case that causes the crash. The thing is, I don't know OpenGL well enough to determine if such a function exists or not.