OpenGL in Visual Studio Code

Has anyone got OpenGL/C++ working in Visual Studio Code? Would appreciate a step by step guide in that case. I am in a Windows environment but VS Code would be cross-platform presumably.

… I recall “Visual Studio” as an editor. And, that it comes in 3 versions (for the C++, C# or Visual Basic language). It likely doesn’t matter, what language you write a for-loop in, as long as the gl-execution within the loop is in the scoop of openGL (proper linking & inclues).
Some gl-types are interchangable with types of your language (gl_int, gl_enum etc ), but, when you do have the openGL included, you can use all it’s types.
Once you’ve sat it all up, you won’t need a step by step instruction … it will be obvious to you.

Visual Studio Code is another, separate thing that was stupidly named.

But yes, this question doesn’t make much sense. VS Code is an editor and has nothing to do with OpenGL in itself.

VS Code is actually more than just a passive editor. Like Visual Studio (yes, all stupidly named) it can run programs and show output. E.g., VS Code can be used to develop Javascript code and output to the console (just as Visual Studio can).

So I was wondering if with appropriate links, includes, etc., just as for Visual Studio, VS Code could be used to develop C++/OpenGL so that one can run and show the scene in a separate window.

I have been using Visual Studio/C++/OpenGL a long time now. But with each iteration VS seems to be becoming more and more bloatware. VS Code on the other hand is pleasantly lightweight. Hence the inquiry.

For those unaware of this, think of “Visual Studio Code” as “Emacs, if it were developed today, with a focus on programming environments”. It is a text editor that is highly extensible and recognizes concepts like external debuggers, projects, compilation of projects, and so forth. There are lots of extensions that work with its higher level understanding of projects that make programming simpler.

Your first step should be to search Google for “Visual Studio Code C++”. That should help you get started on getting C++ compilation and debugging going through VSCode. Once you get that sorted out, you can move on to OpenGL specific issues.

Exactly, the core is lightweight and then one extends as needed. I would only be interested in C++ on VS Code to write OpenGL apps. Which is why I am looking to see if someone’s already doing this.

Online search shows one person claiming to have been successful but responses to his article suggest his method has problems. I could not find any OpenGL-specific extensions currently for VS Code, so maybe the environment can’t quite be set up as yet.

In any case, I am using VS Code currently to develop WebGL apps, which don’t need OpenGL-specific extensions because GL calls are handled by the browser. I like VS Code a lot. And it’s supposedly cross-platform, though I use only Windows myself, so would be the perfect platform for developing desktop OpenGL apps.

Why would there need to be any such things? If you can write/compile/debug C++ code in VSCode, then you can write/compile/debug C++ code that just so happens to use OpenGL.

The reason why there’s not much information on this specific thing is because there doesn’t need to be. If you can build a C++ program in VSCode, and you know how to use your build system to link with libraries, then you can build a C++ program that uses OpenGL in VSCode. From the perspective of a C++ program, a C++ build system, and so forth, OpenGL is just a library, like any other library it can link to.

Using OpenGL through a C++ VSCode application doesn’t need special instructions that are different from using any other library through C++ VSCode.

At least, from the perspective of VSCode and things that deal with it.

The linking with external libraries might not be as simple in VS Code as it is in Visual Studio where one just has to open config properties and click link, include, etc.

Incidentally, even opening a separate debugger window in VS Code for Javascript (instead of output appearing in a split below the edit window) had a lot of back and forth online before someone from Microsoft came along and explained a workaround. This would be an issue too for running OpenGL obviously as it would ask a separate window to draw.

In any case, I’ve not been able to figure it out and I don’t see anyone out there who has even though the question has been asked before. If you succeed please share with specifics. VS Code being lightweight cross-platform this would be a boon to developers. Otherwise, It’s not helpful saying that it’s easy if only you knew how to do this and that.

Of course not, but that’s not an OpenGL problem. Or even a VS Code problem, really, because that’s not going to be a thing VS Code does.

It’s a C++ build system problem. VS Code may make talking to that build system easier or harder, but you’re still going to have to understand how it works.

Figure what out, exactly? It’s hard to give advise when you’re not able to say what part of the process is giving you trouble.

Can you make VS Code command the building of a C++ application? Can you make it debug that application? Can you make it link with a library? Can you make it link with the OpenGL library in particular?

These are all different problems with different resolutions, most of which aren’t about OpenGL programming specifically.

I am not here to sit for an exam from some self-important twit on the internet:-) But I mean no offense. I asked a very specific question: how to run a C++/OpenGL program on VS code. If you know how then spell it out. If not save pontification for friends and family.

1 Like

I found the perfect link to setup opengl in VS Code.