Jump to content
Site Stability Read more... ×
  • Advertisement
Sign in to follow this  
gboxentertainment

OpenGL problem with Anttweakbar with multiple objects

This topic is 2122 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I've recently gotten Anttweakbar to work with my graphics engine.

I have done a quick test to be able to adjust the position of an object in space using the anttweakbar gui.

 

What I want to do now is to do this for multiple objects - so that I can change the active object and adjust the position of each different object individually.

 

Here's where I initialize the GUI:

bool init(void)
{
	TwInit(TW_OPENGL, NULL);
	myBar = TwNewBar("GiBOX");
	TwDefine(" GiBOX size='240 320' ");
	TwDefine(" GiBOX valueswidth=140 ");
    // - Directly redirect GLUT mouse button events to AntTweakBar
    glutMouseFunc((GLUTmousebuttonfun)TwEventMouseButtonGLUT);
    // - Directly redirect GLUT mouse motion events to AntTweakBar
    glutMotionFunc((GLUTmousemotionfun)TwEventMouseMotionGLUT);
    // - Directly redirect GLUT mouse "passive" motion events to AntTweakBar (same as MouseMotion)
    glutPassiveMotionFunc((GLUTmousemotionfun)TwEventMouseMotionGLUT);
    // - Directly redirect GLUT key events to AntTweakBar
    glutKeyboardFunc((GLUTkeyboardfun)TwEventKeyboardGLUT);
    // - Directly redirect GLUT special key events to AntTweakBar
    glutSpecialFunc((GLUTspecialfun)TwEventSpecialGLUT);
	TwAddVarRW(myBar, "Object Id", TW_TYPE_INT32, &objId, "");
	TwAddVarRW(myBar, "Object Position", TW_TYPE_DIR3F, &(models->objPos[objId]), "");

}

I use object id to specify which object would be active. So in the gui, I can change the object id.

The problem is even when I change the object id, it only adjusts the position of the first object (which is objId = 0).

 

It seems that when I set models->objPos[objId] it doesn't update the objId in this function.

Has anyone who's used Anttweakbar ever gotten it to work with multiple objects and can update their attributes individually?

Share this post


Link to post
Share on other sites
Advertisement
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!