I started learning openGL and also started splitting my project in multiple source files for the first time too. As such I'm still a bit confused and sometimes I feel my variables are scattered around especially since openGL requires extensive use of global variables. At the moment I got about 15 files.
My major problem is that some variables are for example shared by some modules and some other variables are shared only by a few of those and some other modules. If I put all these variables in a common.h file will there be any problems (performance-wise) since not all variables will be used by all modules?
Using the above method I also have the problem that if I use types defined in other header files I have to include those too. I could also use '#if (defined' macros, but that doesn't seem the most appropriate method.
以上就是Shared Variables in different source files的详细内容，更多请关注web前端其它相关文章！