Do I have to use the OpenGL data types (GLint, CLchar, …) for a cross platform game?

前端 未结 2 381
悲&欢浪女
悲&欢浪女 2020-12-14 16:06

I have a short question. Why does OpenGL come with its own datatypes for standard types like int, unsigned int, char, and so on? And do I have to use them instead of the bui

2条回答
  •  借酒劲吻你
    2020-12-14 16:51

    I'm not an expert of OpenGL, but usually frameworks/platforms such as OpenGL, Qt, etc. define their own datatypes so that the meaning and the capacity of the underlying datatype remains the same across different OSes. Usually this behavior is obtained using C/C++ preprocessor macros, but for what concerns GLuint, it seems to be just a typedef in gl.h:

    typedef unsigned int GLuint;
    

    So the answer is yes. You should use the framework's datatypes to ensure a good portability of your code within that framework across OSes.

提交回复
热议问题