Examples

Here are some simple program examples with commented sources that show how to use the AntTweakBar library.
Commented sources of the examples below can be found in the examples directory of the AntTweakBar library. Executables (compiled examples) can be found in the examples/bin directory.

→ Notes for Unix:
Make sure that you get the latest driver for your graphics card. Depending on your distribution, you may need to recompile the library and the examples. To do so, run make in the src directory and in the examples directory. To compile all the examples, GLFW, GLUT and SDL development libraries must have been previously installed on your computer.


TwSimpleGLFW

A simple example using AntTweakBar with OpenGL and GLFW windowing system.

Source file

examples/TwSimpleGLFW.c

Screenshot

Compilation

Windows

A Visual Studio project TwSimpleGLFW.vcproj is provided.

Unix

Use the Makefile (type make in the examples directory) or the following command

gcc -O3 -Wall -I${ANT_TWEAK_BAR_SDK}/include -I/usr/local/include -I/usr/X11R6/include -I/usr/include TwSimpleGLFW.c -L${ANT_TWEAK_BAR_SDK}/lib -L/usr/X11R6/lib -lglfw -lAntTweakBar -lGL -lGLU -lX11 -lXext -lXxf86vm -lpthread -lm -o TwSimpleGLFW

where ${ANT_TWEAK_BAR_SDK} is your AntTweakBar directory path.

GLFW must have been previously installed on your computer.

Execution

Windows

AntTweakBar.dll must have be copied to the same directory as the executable.

Unix

libAntTweakBar.so must have been copied to your shared libraries directory (usually /usr/lib/), or its path must have been added to the environment variable LD_LIBRARY_PATH. Then run ./TwSimpleGLFW .


TwSimpleGLUT

A simple example using AntTweakBar with OpenGL and GLUT .

Source file

examples/TwSimpleGLUT.c

Screenshot

Compilation

Windows

A Visual Studio project TwSimpleGLUT.vcproj is provided. GLUT must have been previously installed on your computer, and the VC project modified to use your GLUT directory.

Unix

Use the Makefile (type make in the examples directory) or the following command

gcc -O3 -Wall -I${ANT_TWEAK_BAR_SDK}/include -I/usr/local/include -I/usr/X11R6/include -I/usr/include TwSimpleGLUT.c -L${ANT_TWEAK_BAR_SDK}/lib -L/usr/X11R6/lib -lglut -lAntTweakBar -lGL -lGLU -lX11 -lXext -lXmu -lXxf86vm -lm -o TwSimpleGLUT

where ${ANT_TWEAK_BAR_SDK} is your AntTweakBar directory path. GLUT must have been previously installed on your computer.

Execution

Windows

AntTweakBar.dll must have be copied to the same directory as the executable.

Unix

libAntTweakBar.so must have been copied to your shared libraries directory (usually /usr/lib/), or its path must have been added to the environment variable LD_LIBRARY_PATH. Then run ./TwSimpleGLUT .


TwSimpleSDL

A simple example using AntTweakBar with OpenGL and SDL .

Source file

examples/TwSimpleSDL.c

Screenshot

Compilation

Windows

A Visual Studio project TwSimpleSDL.vcproj is provided. SDL development library must have been previously installed on your computer, and the VC project modified to use your SDL directory.

Unix

Use the Makefile (type make in the examples directory) or the following command

gcc -O3 -Wall -I${ANT_TWEAK_BAR_SDK}/include -I/usr/local/include -I/usr/X11R6/include -I/usr/include TwSimpleSDL.c -L${ANT_TWEAK_BAR_SDK}/lib -L/usr/X11R6/lib -lSDL -lAntTweakBar -lGL -lGLU -lX11 -lXext -lXxf86vm -lpthread -lm -o TwSimpleSDL

where ${ANT_TWEAK_BAR_SDK} is your AntTweakBar directory path.

SDL development library must have been previously installed on your computer.

Execution

Windows

AntTweakBar.dll must have be copied to the same directory as the executable.

Unix

libAntTweakBar.so must have been copied to your shared libraries directory (usually /usr/lib/), or its path must have been added to the environment variable LD_LIBRARY_PATH. Then run ./TwSimpleSDL .


TwSimpleDX9

A simple example using AntTweakBar with DirectX9 .

Source file

examples/TwSimpleDX9.cpp

Screenshot

Compilation

Windows

A Visual Studio project TwSimpleDX9.vcproj is provided. DirectX SDK must have been previously installed on your computer.

Execution

Windows

AntTweakBar.dll must have be copied to the same directory as the executable.


TwSimpleDX10

A simple example using AntTweakBar with DirectX10. It requires Windows Vista to run since DirectX10 is available only on that platform.

Source file

examples/TwSimpleDX10.cpp

Screenshot

Compilation

Windows

A Visual Studio project TwSimpleDX10.vcproj is provided. DirectX SDK must have been previously installed on your computer.

Execution

Windows Vista

AntTweakBar.dll must have be copied to the same directory as the executable.


TwAdvanced1

An example showing many features of AntTweakBar (including definition of custom structure type and variable accessed via callbacks). It also uses OpenGL and GLFW but could be easily adapted to other frameworks.

Source file

examples/TwAdvanced1.cpp

Screenshot

Compilation

Windows

A Visual Studio project TwAdvanced1.vcproj is provided.

Unix

Use the Makefile (type make in the examples directory) or the following command

gcc -O3 -Wall -I${ANT_TWEAK_BAR_SDK}/include -I/usr/local/include -I/usr/X11R6/include -I/usr/include TwAdvanced1.cpp -L${ANT_TWEAK_BAR_SDK}/lib -L/usr/X11R6/lib -lglfw -lAntTweakBar -lGL -lGLU -lX11 -lXext -lXxf86vm -lpthread -lm -o TwAdvanced1

where ${ANT_TWEAK_BAR_SDK} is your AntTweakBar directory path.

GLFW must have been previously installed on your computer.

Execution

Windows

AntTweakBar.dll must have be copied to the same directory as the executable.

Unix

libAntTweakBar.so must have been copied to your shared libraries directory (usually /usr/lib/), or its path must have been added to the environment variable LD_LIBRARY_PATH. Then run ./TwAdvanced1 .


TwString

This example illustrates the different ways to handle String variables. It also uses OpenGL and GLFW but could be easily adapted to other frameworks.

Source file

examples/TwString.cpp

Screenshot

Compilation

Windows

A Visual Studio project TwString.vcproj is provided.

Unix

Use the Makefile (type make in the examples directory) or the following command

gcc -O3 -Wall -I${ANT_TWEAK_BAR_SDK}/include -I/usr/local/include -I/usr/X11R6/include -I/usr/include TwString.cpp -L${ANT_TWEAK_BAR_SDK}/lib -L/usr/X11R6/lib -lglfw -lAntTweakBar -lGL -lGLU -lX11 -lXext -lXxf86vm -lpthread -lm -o TwString

where ${ANT_TWEAK_BAR_SDK} is your AntTweakBar directory path.

GLFW must have been previously installed on your computer.

Execution

Windows

AntTweakBar.dll must have be copied to the same directory as the executable.

Unix

libAntTweakBar.so must have been copied to your shared libraries directory (usually /usr/lib/), or its path must have been added to the environment variable LD_LIBRARY_PATH. Then run ./TwString .


Back to the main page


Log in to edit this page