Jeff
Jeff

Reputation: 883

Why don't OpenGL functions use templates?

For exampe, if I wanted to clear the color buffer, I would have to call:

glClearBufferfv(GL_COLOR, 0, color); //color is a float array of 4 numbers

But OpenGL also offers

glClearBufferiv(); //expects an int array
glClearBufferuiv(); //expects an unsigned int array

So why doesn't OpenGL use templates? Like so:

glClearBuffer<float>(...)

Upvotes: 1

Views: 195

Answers (1)

Sam Estep
Sam Estep

Reputation: 13324

Because OpenGL is actually a C library, not C++. The reason you can use it in C++ is because one of the main design considerations in C++ is that it be able to use C code, but that comes with the inevitable circumstance that C APIs you use won't have nice C++ interfaces.

Upvotes: 7

Related Questions