params::InterfaceGl crash

I am trying to create a params window.
I have check the param basic sample that comes with cinder and it does not crash.

This line in my app crashes.
m_Params = ci::params::InterfaceGl::create(“App parameters”, ci::app::toPixels(ci::ivec2(200, 300)));

This is the relevant output in the console.
ERROR(AntTweakBar) >> Cannot load OpenGL library dynamically

And this is the line that fails.
int CTwGraphOpenGLCore::Init()
{
if( LoadOpenGLCore()==0 )
{
g_TwMgr->SetLastError(g_ErrCantLoadOGL);
return 0;
}

Its strange this would work in the sample but not in my app. Both using the same version of cinderlib

And are you able to draw anything using OpenGL in your app? Because it looks like the OpenGL library hasn’t been loaded at all. Perhaps you forgot to add the OpenGL32.lib?

Hi Paul,
Thanks for the reply.

I am able to use ci::gl::draw to draw. I use it for textures, solid circles, rects and geometry shapes from geom namespace.

I did a search for opengl32.lib on my system. Its in a few locations like this C:\Program Files (x86)\Windows Kits\10\Lib\different versions and also C:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\Lib

If you can draw using OpenGL, then you have properly linked to the library. Which, by the way, can be checked in the project properties:

The reason your params don’t work must be something else instead. Are you trying to create it in a constructor or a prepareSettings() method (see “App-related changes”)? The OpenGL system has not been initialized yet in that case. Try creating the params in the setup() method.

Another reason why it may not work is if you’re using more than one window. Each window has its own OpenGL context (Cinder takes care of creating it for you) that is shared with the main window, but you’ll have to specify the correct window to use when you create the params. See also here and here.

-Paul

Ah, ok.

I was creating the params within a thread using the multi-threading example for loading images with a context and Sync / clientWaitSync.

I have moved the params code to the main thread now and it is working fine.

Thanks for the help! Appreciated.

1 Like