here is the basic header file basicgl.hpp #include <windows.h> #include <GL/gl.h> #include <GL/glu.h> #include <GL/glut.h> #include <boost/function.hpp> #include <boost/static_assert.hpp> #include <boost/type_traits.hpp> #include <boost/cast.hpp> template <class T> boost::function<void*(const T&, const T&)> getVerxFunc2() { BOOST_STATIC_ASSERT(boost::is_integral<T>::value || boost::is_floating_point<T>::value); return (boost::is_floating_point<T>::value) ? &glVertex2d : &glVertex2i; } template <class T> boost::function<void*(const T&, const T&, const T&)> getVerxFunc3() { BOOST_STATIC_ASSERT(boost::is_integral<T>::value || boost::is_floating_point<T>::value); return (boost::is_integral<T>::value) ? &glVertex3i : &glVertex3d; } template <class T> void drawDot(const T& x, const T& y) { boost::function<void(const T&, const T&)> myFunc(getVerxFunc2<T>()); glBegin(GL_POINTS); myFunc(x, y); glEnd(); glFlush(); } template <class T> void drawDot(const T& x, const T& y, const T& z) { boost::function<void(const T&, const T&, const T&)> myFunc(getVerxFunc3<T>()); glBegin(GL_POINTS); myFunc(x, y, z); glEnd(); glFlush(); } template <class T> void drawLine(const T& x1, const T& y1, const T& x2, const T& y2) { boost::function<void(const T&, const T&)> myFunc(getVerxFunc2<T>()); glBegin(GL_LINE); myFunc(x1, y1); myFunc(x2, y2); glEnd(); glFlush(); } template <class T> void drawLine(const T& x1, const T& y1, const T& x2, const T& y2, const T& z1, const T& z2) { boost::function<void(const T&, const T&, const T&)> myFunc(getVerxFunc3<T>()); glBegin(GL_LINE); myFunc(x1, y1, z1); myFunc(x2, y2, z2); glEnd(); glFlush(); } drawLine(4.1, 5.2, 3.9, 4.2); When i compile i get the following errors. 16 D:\Data\cs classes\cs450\c++\BasicGL.hpp conditional expression between distinct pointer types `void (*)(GLdouble, GLdouble)' and `void (*)(GLint, GLint)' lacks a cast 46 D:\Data\cs classes\cs450\c++\BasicGL.hpp instantiated from `void drawLine(const T&, const T&, const T&, const T&) [with T = GLdouble]' 16 D:\Data\cs classes\cs450\c++\BasicGL.hpp invalid conversion from `void (*)(GLdouble, GLdouble)' to `void*' 16 D:\Data\cs classes\cs450\c++\BasicGL.hpp invalid conversion from `void (*)(GLint, GLint)' to `void*' 85 D:\Data\Devcpp\include\boost_1_33_1\boost\function\function_template.hpp ISO C++ forbids casting between pointer-to-function and pointer-to-object Is there a nice work around this? Thanks.