OpenGL Base Code (Just enough to set you up)
What you need to get started with OpenGL This tutorial is a little digression from the OpenGL fundamentals. This tutorial needs to be here because I want to explain what my OpenGL base code is turning into. As it's not contained within a single header and a single cpp files anymore, an explanation is required of how files are linked together. Moreover, you need to know how to add additional modules of code to the current code structure if you decide to append something to the base code by yourself. So, here is how files are linked together in the fallout openGL base code:
; The main include file "glbase.h": glbase.h---+- <windows.h> +- <gl/gl.h> +- <gl/glu.h> +- "defined.h" +- "log.h" +- "winmain.h" +- "model.h" +- "system.h" +- "glmain.h" +- "dierr.h" +- "directinput.h" ;Each of the following *.cpp files #includes "glbase.h": dierr.cpp : DirectInput error codes directinput.cpp : DirectInput implementation glmain.cpp : the "main()" function log.cpp : system log model.cpp : [*.m] format model definition system.cpp : 'system' stuff; SysShutdown, SysSetDisplayMode... winmain.cpp : WinMain(); and initialization
Whenever you want to add your own module of code, for example a 3D math library, given that your math library is contained within math3d.h and math3d.cpp files, you would go to "glbase.h" and append the line #include "math3d.h" (indicated in red below) at the end of the already included files list:
// glbase.h #include <windows.h> // Windows crap... #include <gl/gl.h> // openGL headers #include <gl/glu.h> #include "defined.h" // main defined types #include "log.h" // system log #include "winmain.h" // WinMain(), InitOpenGL() #include "model.h" // model file (filename.m) definition #include "system.h" // SysShutdown(), Sys... #include "glmain.h" // RenderFrame() #include "dierr.h" // DirectInput error codes #include "directinput.h" // DirectInput implementation #include "math3d.h" // your 3D math library
If the content on this website somehow helped you to learn something new, please let others know about it by sharing it on your website or on your Facebook page with your friends. In addition you can help by making a donation or bookmarking this site.