In my project, certain data is stored in floating point datatypes (C's native float, double). Before sending the data in a VBO to OpenGL I have to convert this data to GLfloat with some pretty silly code.
float data[DATA_SIZE]; GLfloat *new_data; new_data = malloc(sizeof(data)); for (i = 0; i < DATA_SIZE; i++) new_data[i] = (GLfloat) data[i]; upload_to_gpu(new_data); free(new_data);
Of course, since I know
float is equal to
GLfloat on my platform, I can just ignore this but then my code won't be properly platform-independent. I could also store the data in my program in OpenGL native datatypes but this is unacceptable as I don't want to fixate my code only on OpenGL (DirectX or a software renderer are possibilities I don't want to exclude).
How can I solve this? Is the conversion step unavoidable? Or am I obligated to store my geometry in GLfloat's?