math and openGL

I taught myself Algebra 1 and 2 and am begining Trig, after I finish Trig I’m going to calculus, and from there, probably calculus 2 and then phyiscs, then I’m going to try to learn all their is to know about projection geometry.

I love math and have little trouble understanding it and teaching it to myself, and I’m doing intensive math study everyday, and also teaching myself C++.

I was just wondering, can someone at my level do any basic openGL programming? Or will it be impossible without trig and calculus and advanced programming skills?

I’m still working hard at studying but its fun to actually do some real programming instead of just learning new languages, commands and math skills.

Also I could use some actual practice with my programming knowledge so I can remember it better.

I get the impression you’re pretty new to programming, so you’re probably better off starting with 2D stuff.

A lot of stuff is easier to figure out in 2D than in 3D.

Also, you can use OpenGL for the 2D drawing (even if it isn’t its forte). All you need to do for that is not specify a 3rd coordinate…

For 3D stuff, you’ll probably want to check out NeHe:

You might want to do geometry a bit earlier if you’re interested in OpenGL. But the basics should be covered with Algebra 1 and 2 (if your Algebra 1 and 2 is roughly the same as the Algebra that’s thought at my university). Calculus isn’t that important. And physics, well, if you’re thinking of writing physics simulation based stuff, that’s really complicated and you have to be really good at Calculus and Numerics for that…

I’m not sure if starting with 2D is really neccesary in your case. If you’re as good with math as you say, you shouldn’t have any problems with 3D graphics. Just don’t try to start off too complicated, you propably won’t yet be able to write a game :wink:

Just try to understand the NeHe tutorials, and then try to code a few graphics demos on your own. And don’t forget to practice general programming. You could for example write a simple text based game just to learn the concepts involved without being distracted by graphics problems…

Mixed oppinions it would seem.

I am very new to programming. I have studied a lot but I’m still a beginner. Most of my time is taken up with math study. After I finish math then I’m going to concentrate more heavily on programming.

I find I have little trouble with understanding programming concepts and how functions work. I define my own functions in gamemaker that work better then the built in functions. (better collision detection and reflection engines) Sadly they are only local functions, and the frame rate of gamemaker still causes trouble. Also I can’t do much with game maker cause I know very little about GML. If i can program 2d games in openGL with C++ that would be nice and easier. And I should have less technical problems with the program itself.

If I may ask, how difficult is it define collision detection in openGL? How about angle of impact and reflection? I know basic vector math, I just haven’t gotten into matrices yet. Though I should be learning about them soon. Its coming up in my book.

Matrices are really important for OpenGL. You can write OpenGL programs without understanding it, but a basic understanding of matrices and related topics like vector spaces, base vectors and base transformations will help you understand it better.

Collision detection doesn’t really have to do anything with OpenGL, you have to do that yourself. It’s a rather advanced topic with a lot of vector math and a lot of algorithmics involved. Deciding if objects collide is easy, but testing each object with each other object is too slow, so you have to use smarter algorithms…

If I understand you correctly, you have no problem with programming small isolated code pieces but you have problems with the overall structure of bigger programs. That’s why I suggested starting with small graphics demos, because for bigger things like games a well designed code structure is crucial.

Well i never said I had trouble with the overal structure of bigger programs, I’m just not really experianced in programming, so thats probably true anyway.

I understand that with collision detection you can’t write a new program for each collison, you need to simple to say if this object collides with this object moving at this angle impacting at this point, do this. But the collision detection function itself is already defined and set up so it can be a method of all objects, etc.

Well if u look at a post i did recently, theres some openGL code to demonstrate bounding circle -circle collision detection, probably the basic of all collision detection :slight_smile:

sofar for opengl programming i havn’t needed calculus. i use a lot of algebra and geometry/trig. it all depends on the kind of games u want to make. if u want to make a simulator like i want to then your going to need physics, geometry, and basic trig. matrices arn’t needed but i’ve heard that it can make the program much faster.

I’ll have to agree with the first couple of replies. Stick to 2D until you’re comfortable enough for 3D. There’s plenty of nifty things you can do in 2D, so don’t discount the power of learning it. 3D takes a bit of work to really harness, and it does help to have a course where you’ve constantly manipulated 3D vectors, like university physics or multivariate calculus. However, probably the best course to take specifically for OpenGL is a computer graphics course.

Im currently on a course in England similar to what KenCS suggested, tho mine is computer game technology one, we cover alot of the math your learning or want to learn, also openGL, directX etc AI etc etc start off with 2D and learn things like double buffering, heh, you could even try and learn some physics on the side and try and simulate them in simple 2d code etc

While agree with the general advice to learn (as much as you need/can) about vector and matrix math in the context of 3D visualization, I do not see it as a requirement to write at least simple 3D visualizations (which is often what makes you see how all this “comes together”).

Changing something small, recompiling and running to see what it did is often way more rewarding (and as the human mind works using a reward system, this is often a greater motivating factor to learn the how’s and why’s).

I can even see someone not understanding matrices at all doing some rather impressive stuff in the 3D visualization area. However, when we start to move into the “space” of vertex manipulation in e.g. VP’s, or optimizations (e.g. pre-calculating relative object position/rotation/scale), then the matrix (and therefore vector) understanding comes in handy.

But until that time, my advice would rather be to experiment with what you find interesting and awarding at the time. When you find you need the “heavy” math, a solid understanding of it will help you, and if you haven’t got it by then you will by then want to learn it (and therefore do it). :slight_smile: