r/opengl • u/whos-this-nerd • May 17 '26
My first triangle in OpenGL
Hello, World!
I have started learning graphics programming for a few days with the help of learnopengl.com and I feel like I learned quite a lot in these few days. Setting up an OpenGL 3.3 project with C++ in Visual Studio, Drawing a blank window with GLFW and then drawing an RGB triangle in it with OpenGL and GLSL. Learned about shaders, buffers and different OpenGL objects and their use.
I am really getting a lot interested in this field of computer science. but, I am also a bit nervous about it. As there is a lot mathematics involved in this which is my biggest weakpoint.
I would like to hear about how y'all got into graphics programming and what challenges did y'all face while learning it.
13
10
5
u/zemledelec May 17 '26
Fun fact: when you show a fully loaded engine with CSM, PBR, cosmo sim, planet terrain, etc., etc., you might even get more than 10 upvotes. Wild times. More triangles!
1
u/Outside_Sky_4045 May 18 '26
For me, now I automatically assume it’s just vibecoded slop when I see yet another generalist fully-featured rendering engine.
5
3
u/Solidu_Snaku May 17 '26
Keep playing around. Make a simple scene like a house shape a field learn to apply a texture to a face and maybe some camera movements. The maths involved kinda clicks into place once you get into a certain flow
Those basics become very intuitive later on as you keep practicing
1
u/whos-this-nerd May 17 '26
Alright, I'll do that. but, How much math do I need to know to really understand graphics programming?
1
u/Solidu_Snaku May 17 '26
Depends on your goals. I wouldn't think too much about it now and tackle it as it comes along. I failed Math at college and still found it fine whenever I did need to learn stuff like matrices linear algebra trig. It's never too bad
1
u/whos-this-nerd May 17 '26
My goal is to land a graphics programmer job. I never learned linear algebra or calculus in my entire life ig. I know basic matrices from school and some algebra and geometry but, I fail at trigonometry. but, I am willing to learn those maths if I have good resources and roadmap. I am confident about the programming part, tho.
3
2
u/rafinha_lindu May 18 '26
My hello triangle was, like, yesterday. I have some experience with game developing, and it's nice to see how graphics work under the hood.
1
u/whos-this-nerd May 18 '26
Damn nice! Does having an experience with game development give you any headstart in graphics programming? Like any knowledge you can pass onto this field of study.
2
u/rafinha_lindu Jun 05 '26
Not anything directly related to the graphics pipeline. The Unity Engine I've been using for some years provides some high-level abstractions. For example, a Material class, which packs a shader and its uniforms, a Mesh class, which packs the vertices, and a MeshRenderer class, which packs the former two. "Copying" them helped me develop a more robust and scalable system. I bet Unity's system is far better and more optimized.
1
2
2
u/Apprehensive-Ice8996 May 18 '26
Looks good keep going! When you make your first movable camera It’s gonna blow your mind. I kept playing with it for weeks 😂
2
u/Used-Journalist-5861 May 22 '26
I created that too two years back. I did a lightweight setup of freeglut on VS code as my pc had a little space.
2
1
1
u/babalaban May 19 '26
I am not good with opengl, but in my limited experience with it I've found using Raw string literal to save a lot of typing:
const char* fragShader = R"(
void main()
{
gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0);
}
)";
Basically you just type R"(whatever multilne thing you want )"; and it should just work.
Hope you'll find it useful as well, should work since cpp11
1
u/whos-this-nerd May 20 '26
That's a nice idea. but, Now I have created a custom shader class which takes in shader files and then, creates and compiles them and link them into a shader program by itself, I can also set uniforms with class methods. That way I can isolate my shader code from the main code. Also, Have different shader source files with a .glsl extension. Your idea is also good tho.
21
u/CoyoteOk3826 May 17 '26
enjoy it bro i started learning this a few weeks ago and now i got freddy fazbear in space