How to start OpenGL coding?

Hi. I am first user to opengl.

Where can I start?

I have used Unity engine and C#, Visual Studio.

OpenGL has also editor like visual studio? or?

Where should I start? and can I use C# with opengl?


OpenGL is a standard, not a tool or a library or anything like that. You can use it with anything as long as you have a graphics card and a driver which implements the OpenGL standard. I would suggest you read up on OpenGL first, perhaps in some of the great online tutorials out there or perhaps a book if you prefer those.

OpenGL is a standard which looks like a subroutine library when you get down to using it. It is not a development environment (IDE) and does not come with an editor. The good news is that most major IDE’s such as Visual Studio and Code Blocks come with examples, sample projects, etc., which make it very easy to get started with OpenGL. How do you do your C# programming? What development environment do you use? There are probably tutorials with sample code that show you how to add an OpenGL window to a project in your IDE. Try Googling C# OpenGL.

Good luck.

It is possible to do OpenGL with C# but it is very uncommon.

Most people who do OpenGL use C++ (usually with Visual Studio but there are other options) which is very much like C#.

I think this website gives a pretty good introduction to OpenGL.

Here is a list of all implementation bindings of OpenGL for this language.

I’m also somewhat of an OpenGL newcomer and used Unity a few years ago, so I know where you’re coming from. As Carmine mentioned, OpenGL is a standard so don’t expect any Unity hand holding. I remember just pressing “play” on Unity and getting a game running. I understand how some people find the benefit in that, but I personally get more ideas and inspiration building everything myself. Most people nowadays might call that “re-inventing the wheel”, but don’t listen to that trash, seriously. You’re not re-inventing the wheel, you’re learning.

You also might want to be prepared to learn some areas of maths. You don’t have to become to the next Paul Erdős, but math is unavoidable. Like myself, I’m sure a lot of people fell in love with maths when they got into game development, so just embrace it and have fun. It took me a while since I had such a poor and embarrassing math background.

About c#. I actually enjoyed it during my Unity days, but I strongly recommend learning C++ for several reasons. You’ll also get a greater understanding of programming in general. Plus, most OpenGL tutorials are written in C++.

The biggest challenge I had learning OpenGL was organizing my study material and finding the right tutorial sites and videos. Everything felt so scattered all over the place, I thought it might help sharing a short list of useful links to OpenGL and Math tutorial sites.

Oh and there’s a YouTube chan I’m sharing called TheBennyBox. I seriously recommended starting there, since he guides you into drawing your first triangle , all the way to building your own game engine, not kidding…it’s great. You’ll also learn the necessary math.

Good luck to you, and hope this helps.


Video Material

TheBennyBox: One of my favorites. I learned so much from this guy. I’d recommend starting with this chan.

Reading Material

LearnOpenGL: BBeck mentioned this one and it’s one of my favorites. They even offer an offline pdf book of the site. Great stuff.
OpenGL-Tutorial Dot Org: Also one of my favorites. Highly recommended after trying LearnOpenGL.
OGLDev: I’ve never used this site much, but it looks very complete.
Anton’s OpenGL 4 Tutorials: You’ll love the quality of these tutorials. Although the rest of the tutorials are found in his book, but getting started is free at this site.
MbSoftworks OpenGL Tutorials: Another great OpenGL Tutorial. From drawing a triangle to creating landscapes. Excellent tutorial site and he’s already working on a newer tut series.


Video Material

Math For Game Developers: You won’t learn about OpenGL here, but once you learn to start a window and draw a triangle with one of the tutorial sites above, come back to this YouTube Chan. You’ll find all the math you need to create a game. Oh and no boring school math teacher methodology, you’ll learn from the point of view of a game dev.

Coding Math: Although the tutorials are mostly are in 2D and JavaScript, it shouldn’t be a problem porting it to C++, plus it’s great excercise.