Making a C++ 3D graphics engine (like source) with SDL and opengl. Need help.

Joined
Apr 16, 2026
Messages
33
Reaction score
28
Credits
262
I really have never made ANYTHING 3d with c++ or opengl or sdl and all that

i dont know how im gonna make the engine draw everything frame by frame and its kinda making me go coo coo.
Here is my current code.

C++:
#include <glad/glad.h>
#include <SDL2/SDL2.h>
#include <SDL2/SDL_opengl.h>
#include <iostream>
#include <string>
#include <vector>
#include <SDL2/SDL_mixer>


bool run = true;
SDL_Event event;

while (run) {
    // this is where i put all the raytracing & stuff but idk how so i deleted it.
}
 


just crashed out. tried to figure everything out myself and compile it AND IT SAID THAT FREAKING <glad/glad.h> DONT EXIST??????????? WHY DONT THEY INCLUDE IT WHEN YOU INSTALL C++? AND I DONT EVEN FREAKING KNOW MY C++ OR OPENGL VERSION!!!!!
 
lol dude, judging by your pseudo code, all capitals and inability to find and include correct headers means you won't get far with what you plan to.

Maybe start with something simpler like a console hello world program.

If you insist then I'd suggest to build vulkan SDK from source and learn it instead of sdl or what ever other library.
If you manage to build it you're good to go, and next step is to read the docs for as long as it takes. (years)
 
I have to agree with @CaffeineAddict.

Start small. Try simple examples. Get them working, and - more importantly - make sure you understand WHAT the script is doing, and how (and why) it's doing what it does.

Then try something a little more adventurous. Try combining two simple examples; again, get it working. If you get error messages, learn from your mistakes, and understand how you made them.

As the old saying goes, ya gotta learn how to walk before you can run.

~~~~~~~~~~~~~~~​

I've only ever used Bash scripting, but it's pretty versatile. When I started with Linux nearly 13 years ago, I didn't know one end of a Bash script from the other. Curiosity, interest & perseverance - along with LOTS of practice! - have paid off.....and I now write my own custom utilities from scratch, researching stuff I don't understand, on-the-fly, as I do so. Often, I'll end up building a GUI for the application, just to make it easier to control. (I LIKE my GUIs. A hangover from all those years with Windoze, I guess!)

There's an enormous amount of information, AND valuable resources, out there online.....in most cases, free for the taking.

It's incredibly rewarding to see the results of your own work finally "bear fruit", and eventually do exactly what you envisaged them doing in the first place. Take things one step at a time. Break a program / app / utility down into individual steps. Work on one step at a time, until it works flawlessly, and can be reproduced over & over again. Then you can string all those steps together, in the appropriate order.

Practice makes perfect.....so long as you don't lose interest. Once that happens, put the project to one side and come back to it again at a later date. It's pointless banging your head against a brick wall..!

Others will tell you pretty much the same, though perhaps not in so many words... :D


Mike. ;)
 
@johnblackwood1
btw. I have something to add to my previous comment...

I see you don't know C++, so you need to understand benefits and downsides of it:
it is major programming language to write video games and is most popular for AAA games, however there is a lot of to it, it's not like python or bash that you learn in few weeks or months, you'll need at least a year or two just to learn the language, without even touching GUI, networking, rendering and other topics that are completely separate thing to learn and few more years to practice and study about.

Secondly you've jumped straight into fire, one obstacle is complex language, another obstacle is graphics which demands quite a bit of separate knowledge and on top of that it's not even 2D but 3D.

You'll have a lot of trouble to do anything, people like indie devs master game programming and graphics their whole life.
Don't think you can do it, because programming is one thing while making GFX resources (aka. assets) is yet again something totally different.

Games are made by 10's of people working on it, graphics designers, programmers, game designers, audio technicians and so on, one person alone doing all that has to be very skillful guru, it has to be nerd that does only this and nothing else, so good luck.

Start with basics, in this order:
1. Mastering the language first
2. GUI
3. Networking
4. Audio (both coding and editing/making)
5. Graphics (both coding and making quality assets)
6. A scripting language like LUA for scripted content in game.

When you master this you're ready to attempt working on a simple game, nothing complex because for complex you need a team of people (or a lot of time wasted on your own)
 
@johnblackwood1
btw. I have something to add to my previous comment...

I see you don't know C++, so you need to understand benefits and downsides of it:
it is major programming language to write video games and is most popular for AAA games, however there is a lot of to it, it's not like python or bash that you learn in few weeks or months, you'll need at least a year or two just to learn the language, without even touching GUI, networking, rendering and other topics that are completely separate thing to learn and few more years to practice and study about.

Secondly you've jumped straight into fire, one obstacle is complex language, another obstacle is graphics which demands quite a bit of separate knowledge and on top of that it's not even 2D but 3D.

You'll have a lot of trouble to do anything, people like indie devs master game programming and graphics their whole life.
Don't think you can do it, because programming is one thing while making GFX resources (aka. assets) is yet again something totally different.

Games are made by 10's of people working on it, graphics designers, programmers, game designers, audio technicians and so on, one person alone doing all that has to be very skillful guru, it has to be nerd that does only this and nothing else, so good luck.

Start with basics, in this order:
1. Mastering the language first
2. GUI
3. Networking
4. Audio (both coding and editing/making)
5. Graphics (both coding and making quality assets)
6. A scripting language like LUA for scripted content in game.

When you master this you're ready to attempt working on a simple game, nothing complex because for complex you need a team of people (or a lot of time wasted on your own)
well i do know a bit of C++ like std::cout << "hello <<std::endl; but im not very advanced at it so you are partially right. But you are right that i did jump right into fire (trying to make a 3d graphics engine). Im gonna try and switch to python or lua for this project. I know python and lua so i think its maybe a good idea to switch to that and try and make it in there cause python and lua is much more easy and theres stuff that will help me like matplotlib with something like turtle or pygame and a keylogger script that gets input (like wasd movement keys) and sends it to the engine or i could just put the keylogger inside the engine. Thanks man
 


Follow Linux.org

Members online


Top