Can Someone Code OpenGL Without math ?

closed account (DEhqDjzh)
Hi I am a very young c++ developer and In school I haven't learned matrix, vectors etc yet. I want to code a 3D Game engine but every tutorial I watch/read requires advanced math knowlege. Can i create 3d game engine without advanced math knowlege ?
yes and no :)

yes, you can do quite a bit with little to no math. You don't have to have linear algebra (matrix) but those are often use for what is called a transform -- it stores a number of rotations and positional changes of an object in space in a single operation. You can do them one by one, its just less efficient that way. There are about 3 billion examples of how to do those online, so you don't even have to understand them to code a monkey-see-monkey-do working program that uses them, though. You don't generally need other matrix code for basic, introductory / playtime graphics.

Vectors are used in a number of ways. Again, you can avoid most of them, and the examples and tools cover the rest. One of the issues with vectors is for lighting, which you can skip at first to just draw some stuff but at the end of the day, lighting is one of the biggest things in graphics and is critical to get right and fast if you want a usable engine, and it is unfortunately very complicated.

I would instead recommend you adjust your goal. Instead of trying to code an engine, which is very complex, try just drawing some stuff until you get the hang of that, and then maybe use someone else's engine for a bit, and do the engine last. You may have picked one of the hardest things to do first, which will make learning it frustrating.

Can i create 3d game engine without advanced math knowlege ?

You could perhaps use an existing engine without understanding the math, but writing one from scratch isn't feasible. The math is fundamental. Using a library like OpenGL Mathematics (GLM) would save you from having to implement the mathematics yourself, but you still would need to understand what's happening, if not how it happens.
https://glm.g-truc.net/0.9.9/index.html

You'd need to understand geometry and elementary algebra to treat linear algebra properly. And it's linear algebra which you need. How much math do you know?

In the U.S., most of the relevant mathematics is taught in high school - don't underestimate yourself - you can learn it. But while you're learning it, give something like Irrlicht a try:
http://irrlicht.sourceforge.net/
Last edited on
closed account (DEhqDjzh)
@jonnin @mbozzi Thank you for your answers :)
what math do you know, anyway? If you have had elementary highschool physics, even though they didnt tell you, you have used vectors... if you have solved 3 equations with 3 unknowns, you have seen a matrix without it being called such...



closed account (DEhqDjzh)
@jonnin I know only how to rotate and move 2d points.
I meant how much math have you had so far? Geometry/trig? Algebra? Less?
Last edited on
The math involved in making an engine is actually not hard and is quite easy to grasp with a bit of effort. It gets a bit complicated when it comes to collision detection but that's only if you're also writing your own physics component from scratch and not using an already existing library. I think, to get you started, you can try writing your own game in an already existing game engine like Unity. There, you will learn about transformation and the different components that make up an engine.
I was thinking normals and lighting would be a chore, and possibly the advanced texturing which uses those ideas.

You can do a lot with a few strategically placed points and a radius off them for checking collisions if you don't want to dig into the fancy approaches. You can even avoid the sqrt and just work off the squared values. Very fast, a little sloppy.

There are various ways to do collision detection, you can come up with your own creative solutions or you can use the ones that's already been researched and provided to you since they are proven to work and will likely save you production time. The better you are at math, the easier it is for you to write these algorithms yourself. You will understand things like the separating axis theorem (SAT) and collision detection within a cloth simulation to ensure the cloth doesn't go through itself in an efficient manner a lot faster. Though these concepts do seem far more advanced then setting up a model or view matrix which is why I think collision detection is where an advanced math knowledge can be increasingly helpful.

Personally, I never found lighting to be challenging at all. Though I guess it depends on the sort of light model you're making. The Phong light model is the one I usually go for due to its simplicity and the believable results it generates. To implement this, all I need to do is pass in an object's normals (which can be obtained using a simple cross product computation), your camera's position and your view direction for things like specular lighting to the shader. From there, all you have to do is couple of arithmetic and different operations GLSL already supports (like reflect() and normalize() functions) to calculate the color output for a fragment.
Topic archived. No new replies allowed.