C++ProgrammingTutorial

C++ Tutorial: Auto Registering Factory

Factories are an extremely useful design pattern in programming. If you do not know what the factory pattern is, it is simply a way for code to generate instances of objects by specifying a unique identifier. In this example, I have chosen to go with a text adventure visit to an eatery with the name of FoodFactory. The player can type in the name of an item they want to order, and the code will generate an instance of that object, call some class member functions, and destroy it. The player does not need to define what a taco is…
Derrick Canfield
March 5, 2019
Derydoca Game Engine

A Finely Tuned Engine

The Derydoca Engine has been in development now for a little over a year and it has come a long way from rendering it's first colorful triangle. It now can render complex scenes, load many file formats, supports GLSL shaders, and even some simple particle systems! This has been a side project of mine that I work on in my spare time. Considering all of that, it has moved at a quick pace. One thing that has taken a back seat in this process was code quality and organization. If you have been following my blog, you will know there…
Derrick Canfield
December 27, 2018
Derydoca Game Engine

GLSL Shader Cookbook Chapter 9 Review

The day has finally come. I have completed the final chapter in OpenGL 4.0 Shading Language Cookbook which explores mesh deformation and particle systems. It was definitely an interesting challenge and has given me the want to create a flexible particle system incorporating all of the things I have learned and more. As always, these examples were developed in my very own game engine (Derydoca Engine). If you want to follow along, the commit hash of the GitHub repository is 0ee6024b54cce60a7850b03f65b499833101200a. Vertex Displacement This exercise takes a mesh and distorts it in the Y direction to move the vertices in…
Derrick Canfield
July 18, 2018
Derydoca Game Engine

GLSL Shader Cookbook Chapter 8 Review

Procedural generation of content has become more and more commonplace in the game industry. You see it in triple-a titles, but it is most easily found in the indie game developer scene. Why is that? It's because you can leverage the strengths of a computer to generate content for you. This chapter of OpenGL 4.0 Shading Language Cookbook digs into some ways you can use procedural perlin noise generation for generating interesting shaders. This book decided to stay away from generating these noise textures in the shaders themselves in favor of generating them on the CPU at start-up time and…
Derrick Canfield
June 18, 2018
Derydoca Game Engine

GLSL Shader Cookbook Chapter 7 Review

Finally here we are at chapter seven! I have been looking forward to implementing shadows in the Derydoca Engine for quite some time, and this is exactly what chapter seven of OpenGL 4.0 Shanding Language Cookbook focuses on. The chapter begins by implementing shadow maps with no filtering. That leaves you with extremely aliased shadows that leave a lot to be desired. Luckily the book quickly remedies that with examples of different filtering techniques to achieve a shadow effect that is more pleasing to the eyes. One of the challenges I had when implementing these features is that the book…
Derrick Canfield
June 6, 2018
Derydoca Game Engine

GLSL Shader Cookbook Chapter 6 Review

I just finished going through all of the examples of chapter 6 of OpenGL 4.0 Shading Language Cookbook which introduces the geometry and tessellation shaders and some of the ways you can use it to your advantage. I have always been interested in geometry and tessellation shaders, so naturally I was excited I finally made it this far in the book. This chapter has given me plenty of ideas that I want to explore when I have some more time to play around with shaders. You may see some tutorials using some of these techniques in the near future. This…
Derrick Canfield
May 23, 2018
Derydoca Game EngineUncategorized

GLSL Shader Cookbook Chapter 5 Review

Chapter 5 in OpenGL 4.0 Shading Language Cookbook delves into the world of post-processing. For the uninitiated, post-processing in the game development world refers to processing that gets done to a frame after it has been fully rendered. Post processing enables you to add many impressive looking effects to a rendering engine in a relatively resource efficient way. I will say that I don't think any of my examples here are beautiful examples of what post-processing can do, but they definitely get the point across. Over the course of this chapter I had to implement a robust system to handle…
Derrick Canfield
May 1, 2018
Derydoca Game EngineUncategorized

GLSL Shader Cookbook Chapter 4 Review

If you haven't been following my last couple of blog posts, I have been chronicling my progression through GLSL 4.0 Shading Language Cookbook. I started with chapter two where the fundamentals of GLSL were laid down. Last week I posted about chapter three which built on those fundamentals where more time was spent on lighting. This chapter focused heavily on textures. All of this work is being done in my open-source game engine, the Derydoca Engine. The engine is available on GitHub so all of the source c++ and glsl code is available for you to explore and see how…
Derrick Canfield
March 20, 2018
Derydoca Game Engine

GLSL Shader Cookbook Chapter 3 Review

I have torn through another chapter of GLSL 4.0 Shading Language Cookbook and had a blast doing it. The third chapter guides you through creating six shaders building on other shader techniques introduced in the previous chapter. If you don't already own GLSL Shader Cookbook, I highly recommend it, but make sure to pick up the physical copy. I am using the Kindle version which creates a lot of issues with formatting of code that can drive a person mad. If you are already mad like me though, go ahead and pick up the digital copy so you can start…
Derrick Canfield
March 12, 2018
Derydoca Game Engine

GLSL Shader Cookbook Chapter 2 Review

I have been working through the book OpenGL 4.0 Shading Language Cookbook lately to implement all of the shaders and features into the Derydoca Engine. I recommend this book to anyone who is trying to get a handle on GLSL and how it works. I do have some gripes with the e-book version that I have through Kindle because the code is formatted horribly, but if you understand the basic syntax of GLSL you can work around those issues. If you are following along and want to see this in action, you will have to check out the branch 'features/shader-cookbook'…
Derrick Canfield
March 6, 2018