Put your opengl painting code in a function, and call it from the button click events and the opengl paint event.
Here's some rough pseudo code:
int _x, _y, _z;
public int X
{
get { return _x; }
set { _x = value; UpdateConfiguration(); }
}
public int Y
{
get { return _y; }
set { _y = value; UpdateConfiguration(); }
}
public int Z
{
get { return _z; }
set { _z = value; UpdateConfiguration(); }
}
void UpdateConfiguration()
{
DrawConfiguration();
}
void DrawConfiguration()
{
}
void IncX_Click(...)
{
X += 1;
}
void DecX_Click(...)
{
X -= 1;
}
void IncY_Click(...)
{
Y += 1;
}
void DecY_Click(...)
{
Y -= 1;
}
void IncZ_Click(...)
{
Z += 1;
}
void DecZ_Click(...)
{
Z -= 1;
}
void OpenGL_PaintEvent(...)
{
DrawConfiguration();
}