How to take screenshots in opengl

So here’s some quick code to save a screenshot of your OpenGL game in a TGA file. bool save_screenshot(string filename, int w, int h) { //This prevents the images getting padded // when the width multiplied by 3 is not a multiple of 4 glPixelStorei(GL_PACK_ALIGNMENT, 1); int nSize = w*h*3; // First let's create our buffer, 3 channels per Pixel char* dataBuffer = (char*)malloc(nSize*sizeof(char)); if (!dataBuffer) return false; // Let's fetch them from the backbuffer // We request the pixels in GL_BGR format, thanks to Berzeger for the tip glReadPixels((GLint)0, (GLint)0, (GLint)w, (GLint)h, GL_BGR, GL_UNSIGNED_BYTE, dataBuffer); //Now the file creation FILE *filePtr = fopen(filename....

September 8, 2012 · 1 min · 199 words · David Amador

QuakeCon 2012 - John Carmack Keynote

I usually don’t do this, but come on, it’s John Carmack, and this 3h30m keynote given at QuakeCon 2012 is fascinating.

August 4, 2012 · 1 min · 21 words · David Amador

Gamedev is like a house of cards

It all starts so pretty isn’t it? A clean project, a quick prototype, it works! It’s beautiful. Now it’s time to add more features, everything is planned out, all cogs have a place to be, it goes smoothly for a while. Now you realize other small components are needed, no problem, let’s make them… Eventually you do need to plug them into the game itself, and that’s when the problems start, most of the other stuff wasn’t built considering these new components....

July 30, 2012 · 1 min · 156 words · David Amador

Dary's Legend development Timelapse sample

Working on Dary’s Legend has been my daily routine so I decided to make a time lapse. So this is a video compiled using Chronolapse, by taking a screenshot every 60s during a couple of days while I’m working on Dary’s Legend, the new game from Different Pixel. The video is being played back at 10 real minutes per second. This was recorded between 14-06-2012 and 30-06-2012 (some days are missing)

July 1, 2012 · 1 min · 71 words · David Amador

Detecting C++ memory leaks in Visual Studio - again

I made a small post about detecting C++ memory leaks in Visual Studio in 2010. At the time that seemed to suffice, but some months ago someone told me about Visual Leak Detector and boy does it work. According to the website itself Visual Leak Detector is a free, robust, open-source memory leak detection system for Visual C++. It’s pretty easy to use. After installing it, you just need to tell Visual C++ where to find the included header and library file....

June 3, 2012 · 1 min · 154 words · David Amador

Dary's Legend First Teaser

So, yeah I know I’ve been a little lazy about my blog it’s for a good cause. We decided to release a small teaser showing what we have. I can’t stress this enough, it’s a work in progress. I can’t find out how to embed the video with HD by default so don’t forget to see in 720p Lately I’ve been working mostly on small UI stuff, pixel tuning every menu/button and graphical interfaces in the game....

June 1, 2012 · 1 min · 148 words · David Amador

Xbox 360 Controller Input in C++ via XInput

So you have that Xbox360 controller laying around and want to connect it to your game? On XNA this is an out of the box option but if you’re using C++ you have a bit more work to do first. First of all, you will need the DirecX 9.0+ sdk. The includes. #define WIN32_LEAN_AND_MEAN // We don't want the extra stuff like MFC and such #include <windows> #include <XInput.h> // XInput API #pragma comment(lib, "XInput....

April 15, 2012 · 4 min · 842 words · David Amador

Screenies time...

We finally released some screenshots of Dary’s Legend. Lately I’ve been working on the light system and fog of war for the game, it’s visible on the images. Here’s the official post but I’ve placed the images here for convenience.

March 30, 2012 · 1 min · 40 words · David Amador

New game...

New game, called Dary’s Legend, a roguelike, dungeon crawling type. This is what I’ve been working on lately, and … well not much more to say. I’ll try and do posts with relevant stuff regarding the development of the game from now on. Going back to coding now…

March 16, 2012 · 1 min · 48 words · David Amador

Where do you like games to store their save data?

Quick question. I’m trying to decide where my next game should store their save files so I decided to make a poll. Personally I think that C:/Users/$USER$/AppData/Local/ is a total idiotic thing. Starting on Windows Vista there’s a pre-created “Saved Games” folder but most people seem to miss it since it’s not on the “My Documents” folder. There’s also other possibilities which many games I own use like My Documents\My Games\Game\ Others just create a folder directly on “My Documents” which some users find a bit obstructive....

March 3, 2012 · 1 min · 139 words · David Amador

Some thoughts about indie dev

1 – You either are, or you aren’t. People can go and , “I’m an aspiring indie game developer”. You are either doing games or not, period. If you are starting in development with your own money then you are one. People tend to think they are indie developers when money starts rolling in, well think again, cause money may never come. 2 – It’s a jungle out there...

February 23, 2012 · 3 min · 454 words · David Amador

Engine, video player and tools, tools tools!

So these past 2 weeks I’ve been adding some “bits and bytes” to the engine. Taking a rest between some more complex game mechanisms I decided to start doing a video player. After a bit research I decided to choose theora, but a bit skeptic, I’ve used it before on a game company I worked at and I remember being a tiny nightmare, specially because of YUV->RGB(A) conversion and because of video/audio sync....

January 29, 2012 · 3 min · 532 words · David Amador