I, Kristoffer Jansen (Kriss120), will participate in the next Devember. My Devember will be dedicated to making a small game with opengl and c++. I promise I will program for my Devember for at least an hour, every day of the next December (Starting on the 3. due to not being able to code until then). I will also write a daily public devlog and will make the produced code publicly available on the internet.
Seeing as many of you were picking up the challenge I have gotten inspired myself
to restart an old project in the attempt to learn something new.
So here it is, this Devember I will be attempting to code every day for at least 1 hour to build a simple but usable render/game engine in OpenGL with a passable physics engine. I have set up the rendering part before, so this will be a refresh of that and the actual challenge will be to build a simple 3D game from it.
I will be a little delayed in starting since there are things preventing me from spending a long time coding both today and sunday, but I will attempt to update this post/thread with the progress I make going forward.
This will be my first openGL project running on linux so I am quite exited to get started, and hope that this will be a project I manage to complete unlike most of my other attempts at coding projects.
Libaries I will use:
more coming soon…
Language to be used:
Git Repo with my terrible, messy code.
Wish me luck, cause I have a feeling there is a 50/50 chance I will fail. xD
So, finally got started and, this being my first proper project working with linux,
I was caught off guard by all the stuff that I had to add manually compared to when working in Visual Studio on windows. Luckily linking is a lot more straight forward in code::blocks than it was in Visual Studio when I did a similar project with that. Spent about an hour digging for the names of whatever libraries that were causing problems for me before I could get started.
Good thing now is that my enviroment is finally up and running. And I have successfully created an OpenGL Context (e.g opened a window in X and set all the pixels within it to a specific color).
So far I have added GLFW and GLAD libraries to the project to simplify creation of GL Context and window creation, and successfully tested that they are working as intended.
I think I can finally get to work now that the frustrating bit is over with.
Time to make something usable from this!
Been coding away a bit today too, but progress has been slow.
Have to relearn a lot of stuff, I realy notice how long it has been since I did a proper coding project. It also does not help that Code::blocks froze on me and deleted a bunch of progress. But seems stable again now.
Looking forward to getting to the real meat of the project, the GL shit and trying to make a game from this.
The plan for it is to be a very simple 3D game, with physics of course. Maybe I’ll try to put some fun stuff in there if I get that far? Anyways, excited for tomorrow, got a lot of available time, so attempts at proper progress will be made.
Got something done today! Not a lot of code, but got a lot of the structure of the application set up.
Progress of note:
Implemented a prototype simple StateEngine so I can keep track of active the active application state and initialize different states. Also set up a prototype ApplicationState which will act as a template for more complex ones in the future. With the StateEngine and the ApplicationEngine I can no create different application states with completly different code, and keep track of them and execute the code through the StateEngine! Happy days!
Next up will be implementing the prototype for drawing 3D objects in the GLViewPort and starting work on texture and shader loading. Maybe some basic lighting methods?
Right now the application only does a couple of very basic things. Initializes the openGL enviroment, starts the StateEngine and initializes an initial ApplicationState, which sets a clearColor, clears the buffer and swaps it. It is also able to pass over to a second state which does the same with a slightly different color. (This is simply to test that my implementation worked).
I have also set up a git repo with the code which I will link here. Sorry for the current lack of comments and probably sloppy messy code. I am very rusty in c++ and I was never particularily good at coding this kind of program. Most of my coding experience is with MATLAB and scripts intended for calculating large data sets.
If you end up reading the source and notice me doing something bad or doing something simple in an overcomplicated way please point me in the right direction.
Not much today, wound up working on the management of application states.
StateEngine now handles the current state. StateGenerator (should have called it state manager now that I think about it) manages the states and creates, destroys, tracks and hands out states to the StateEngine on request.
I know I wrote this yesterday, but now I can actually start working on some actual OpenGL stuff. xD Just trying to be smart and not have to go back and change a lot of things in the future for how the application handles states when I no longer wanna keep certain application states in memory, while others will be usefull to have available at all times.
Won’t comit new code until the application does something new other than managing states.
Oh that's right I need to update this thing.
No I did not forget to code for at least an hour every day, I have spent multiple hours everyday, so much so that there were no hours left of the day to write the blog updates.
SO! Progress has been made! Grpahics have been produced. Over the past few days I have been refreshing my very limited knowledge with OpenGL with the help of the wonderfull turorials over at https://learnopengl.com/
And I have actually gotten some work done. Things that have been accomplished:
Shader class that compiles and stores shader programs for use when
rendering stuff. This is what will compile my shader programs when I start
working on lighting, materials and also light source objects.
As demonstrated in the video below the application now supports rendering
3D object, applying textures to them and also has a camera view port. The
Camera object is responsible for creating and storing the information and vec3
data used to create the viewport. It is also capable of handling key and mouse
input to move around the object.
I also did some small work on the application states and the state engine, but mostly minor stuff. I will be pushing the code to gitlab, but that will wait until tomorrow, I am lazy and it is time for bed (and I also wanna clean the code up and comment it properly before I commit it x]).
Also did a bunch of other stuff that was time consuming, but won’t be usefull until this becomes more than a render demo with an overcomplicated application state system.
PS. Spent literal hours trying to figure out why my textured cube wasn’t rendering when I added matrix transformations and transformations to the shaders. Turns out GLM changed slightly in the most recent version GLM 0.9.9 and no longer initializes matrices as the identity matrix, which I expected it to do. Now it creates the  matrix which is not very usefull when multiplying vectors and attempting transformations. Literal hours wasted because I didn’t realize this simple thing. sigh