#ifndef K3DSDK_GLUTILITY_PRIVATE_H
#define K3DSDK_GLUTILITY_PRIVATE_H

#include "iunknown.h"
#include <sdpgl/sdpgl.h>

namespace k3d
{

namespace implementation_private
{

template<int type_size>
inline void gl_load_name(const iunknown* Name)
{
	// If this assert fires, you need to provide a specialization of this
	// function for the size (in bytes) of a pointer on your platform
	BOOST_STATIC_ASSERT((0));
}

template<>
inline void gl_load_name<4>(const iunknown* Name)
{
	::glLoadName(reinterpret_cast<GLuint>(Name));
}

template<int type_size>
inline void gl_push_name(const iunknown* Name)
{
	// If this assert fires, you need to provide a specialization of this
	// function for the size (in bytes) of a pointer on your platform
	BOOST_STATIC_ASSERT((0));
}

template<>
inline void gl_push_name<4>(const iunknown* Name)
{
	::glPushName(reinterpret_cast<GLuint>(Name));
}

template<int type_size>
inline void gl_pop_name()
{
	// If this assert fires, you need to provide a specialization of this
	// function for the size (in bytes) of a pointer on your platform
	BOOST_STATIC_ASSERT((0));
}

template<>
inline void gl_pop_name<4>()
{
	::glPopName();
}

template<int type_size>
inline iunknown* gl_get_name(GLuint*& Names)
{
	// If this assert fires, you need to provide a specialization of this
	// function for the size (in bytes) of a pointer on your platform
	BOOST_STATIC_ASSERT((0));
	return 0;
}

template<>
inline iunknown* gl_get_name<4>(GLuint*& Names)
{
	iunknown* result = reinterpret_cast<iunknown*>(*Names);
	++Names;
	
	return result;
}
	
} // namespace implementation_private
	
} // namespace k3d

#endif // !K3DSDK_GLUTILITY_PRIVATE_H

