Jump to content

View more

Image of the Day

Boxes as reward for our ranking mode. ヾ(☆▽☆)
#indiedev #gamedev #gameart #screenshotsaturday https://t.co/ALF1InmM7K
IOTD | Top Screenshots

The latest, straight to your Inbox.

Subscribe to GameDev.net Direct to receive the latest updates and exclusive content.

Sign up now

C++ beginner to OpenGL

4: Adsense

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
4 replies to this topic

#1 burtybob   Members   


Posted 05 December 2013 - 06:27 AM

I am a C#/PHP guy so I don't need to learn from scratch as I know how to do a lot of the loops/conditionals and all of the "basic" stuff thats reasonably common across languages.

What I am looking to do is learn C++ from (almost) scratch right up to using OpenGL with the ultimate aim of making a Game (starting small with something like a pong/tetris/mario clone).

I am looking for some advice from the good people here about what they would recomend is needed to be known of C++ before moving on to learning OpenGL and also some recomendations of tutorials/books/videos etc...

I know "The New Boston" does some good C++ videos and I have been following his videos. I also heard of NeHe but know that a lot if not all of the staff there is outdated.
I've also got a copy of the "C++ Through Game Programming" by Michal Dawson.

Many Thanks in advance,


#2 Aliii   Members   


Posted 05 December 2013 - 07:52 AM











You dont need that much of C++ for openGL, but you have to be good at C. From my experience, its easier to find a good tutorial for both C++ and OpenGL than to find a good book.

Edited by Aliii, 05 December 2013 - 07:57 AM.

#3 Kaptein   Prime Members   


Posted 05 December 2013 - 08:04 AM


To be able to work with C++, you need to learn quite alot before you can actually get comfortably started.

There is alot to learn, and I could write a long list, but for a beginner let's just focus on the basics:


Don't use VC++, unless you have to, use G++ instead. If you are on windows you get this via mingw32/64.

G++ is (for the moment) a more up to date compiler than VC++. It is also multiplatform. Google it for more information.


If you are planning (in the long term) to release something for Xbox, you will probably want to use the Microsoft compiler suite.


1. Learning about the different parts of the compilation process

a) Writing your own simple makefile, so that you can compile your project from the commandline

b) Understanding how things get put together: preprocessor -> compiler -> linker -> executable


2. Learning to create small games, preferrably text-based

a) Getting comfortable with C++

b) Encapsulate concepts into classes and put them in separate files


3. Learning OpenGL

OpenGL is a specfication for C that let's you draw things. This means you will need to put the concepts you learn from OpenGL into classes, so that you are only working with your own abstractions. Unfortunately this is a complicated and long process. It is worth it, sort of.

I think it's not a bad idea. As a beginner, learning both the language, the toolchain AND how to use external libraries. Especially if its something that is considered advanced, like OpenGL, can be a major source of learning.


Just don't expect to make some great games this way. You won't! Not in the timescale you imagined, anyways.

Once you have the basics down, you might want to consider SDL, or some other library that does so many things for you. As a game programmer, you ideally want to focus on game programming. The aspects of multiplatform-programming and time consuming processes of setting everything up can be a major timesink that most people want to avoid.


Note that OpenGL is just a specification. And the implementation is driver specific. Not only that, but you will also want a window manager, like GLFW or freeGLUT. This is only for when you are working with the OpenGL implementation, however both GLFW and freeGLUT simplifies the process of getting a window up greatly.

Finally a warning: You need the proper graphics hardware and drivers to get access to modern APIs. Trying to learn old OpenGL is a hyperbolic mistake.


I think that's it. For tutorials I'm sure the good people here will be spamming them left and right.

Edited by Kaptein, 05 December 2013 - 08:07 AM.

#4 Eck   Members   


Posted 05 December 2013 - 08:10 AM

I think NeHe is still worth taking a look at. http://nehe.gamedev.net/ one of the first announcements references http://www.opengl-tutorial.org/ which should also prove useful even though the post is over a  year old.


To go from basic C++ to more advanced, I recommend learning about pointers and memory management. C# is an awesome language, but it lets you get away without thinking too much about newing up and deleting memory. With the garbage collection C# does for you automagically, programmers tend to get lazy and hand wave away any memory concerns. That being said, I can't count the number of times I've had to track down memory leaks in other people's C# code. >.<


C++ Templates are very similar to C# generics. You might convert some C# code using generics over to C++ just to get the syntax down.


And C++ function pointers are very similar to C# delegates.


And in general you might gain a lot of mileage out of converting an entire C# project over to C++. You'll learn what you can and can't do. And when you encounter a tough problem on "how the heck do I do this in C++" you can ask the GameDev community for help.


- Eck

EckTech Games - Games and Unity Assets I'm working on
Still Flying - My GameDev journal
The Shilwulf Dynasty - Campaign notes for my Rogue Trader RPG

#5 burtybob   Members   


Posted 05 December 2013 - 08:34 AM

Thank you to everyone so far for the amazing and detailed replies.

@Eck: Funny you mention trying to convert an entire C# project over to C++ as at my job as a software engineer I'm doing the opposite (C++ to C#) which is part of the initial spur to learn C++ so that I can understand better what the existing code is doing and how it's doing it. Mostly at the moment I've been looking up individual functions and learning what they do but in isolation.




Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.