[OpenGL] Terrain generation in OpenGL

monoVertex

I'm back!
Reaction score
460
I have an assignment for college in which I have to generate terrain programatically and display it lighted and also be able to tessellate it. I generated my terrain through Perlin noise and also through the diamond-square algorithm (fractal). During this I encountered some bugs and some of them looked pretty sweet.

You can read and see more of this on my blog here (noise terrain) and here (fractal terrain).

Here are some examples:

2.png


5.png


8.png



And here is the correct fractal-generated terrain:

6.png


If you have any questions about terrain generation related to what I did here, don't be afraid to ask.

Extra info: this is built in C++, using OpenGL, GLEW, freeglut and a wrapper framework provided by our teachers.

I dislike C++, but the focus of this class is on the graphics themselves, algorithms and stuff, and trying to develop in something else would just waste time (learning how to use other libraries, no wrapper framework, etc). So don't give me a hard time about using C++ :D.
 

tom_mai78101

The Helper Connoisseur / Ex-MineCraft Host
Staff member
Reaction score
1,678
Interested in your source code, regardless of how buggy your code reads.

But I never realized that you had to use so many libraries in order to write OpenGL code using C++.

If your class is all about graphics programming, I seriously need to reconsider where I can learn more of this, unless I'm not good enough for it.
 

Accname

2D-Graphics enthusiast
Reaction score
1,462
You dont >have< to use GLEW and GLUT in order to work with OpenGL tom. But it adds a great deal of useful utility functions which you probably dont want to miss out on.
 

tom_mai78101

The Helper Connoisseur / Ex-MineCraft Host
Staff member
Reaction score
1,678
I know, but to mix C++ and OpenGL, you need extra libraries.
 

monoVertex

I'm back!
Reaction score
460
Not exactly, tom_mai78101. I never tried to code straight in OpenGL using C++, but from what I know and read, you can do that. Only your code will be bloated as hell with low level calls.

Using these frameworks allows us to focus on the algorithms for terrain generation, for example, instead of how to instantiate and control the window, the events on keypresses / mouse moves, etc, etc.

I can provide the source-code, only it's a bit undocumented, as I usually do that when I'm finished. If you prefer, I can give it to you when its finalized, that way you'll have a working project to dig into and it's also going to have more features.

I've added fog and right now I'm creating a quadtree system, in order to create an infinite landscape and cull everything outside the fog cutoff. That way you can go as far as your RAM allows :D.

I don't think anyone can not be good for this. If you can understand vector and matrix math, then the algorithms are not a big deal. For low-level calls, I think you should definitely know the basics, to know what's happening in the backstage, but you should use utility frameworks to make your life easier.
Generally you can find all of this on the Internet, but it's fragmented. My advantage of learning this in a class is that someone collected the information and organized it, so we were able to learn faster.
If you want to learn OpenGL fast, then I recommend taking a course. However, you can also do it by yourself.

I can give you the PDFs of our laboratories (practical classes, as opposed to courses where there's theory only), but they are in Romanian :(.
 

tom_mai78101

The Helper Connoisseur / Ex-MineCraft Host
Staff member
Reaction score
1,678
Other than courses, do you have a list of textbooks that you're using to educate yourself with? Not recommendations from you, but actual textbooks used in your classes.

I can provide the source-code, only it's a bit undocumented, as I usually do that when I'm finished. If you prefer, I can give it to you when its finalized, that way you'll have a working project to dig into and it's also going to have more features.

Guess I'll be waiting for a while...

I can give you the PDFs of our laboratories (practical classes, as opposed to courses where there's theory only), but they are in Romanian :(.

Sad.
 

monoVertex

I'm back!
Reaction score
460
Other than courses, do you have a list of textbooks that you're using to educate yourself with? Not recommendations from you, but actual textbooks used in your classes.

I'll be honest, I only went one time to the course (as opposed to the laboratories) and I have no idea what textbooks she suggested xD. I'll ask around and come back to you on this subject.

Guess I'll be waiting for a while...

No, the deadline is on Sunday, I'll finish today or tomorrow.

Our homeworks have 2-week deadlines, so what you see now I started last Sunday. I'm close to finishing it.


Yes, sorry about that :/. I'll see if the course slides are in English, not sure about that.
 

monoVertex

I'm back!
Reaction score
460
And it's finally finished. Check it out:


Also, see the blog post.

@Tom, as soon as I finish documenting the code (I have to do that for the assignment anyway), I'll send you a link to get the source.

EDIT: Here is a GitHub repository with the source: https://github.com/monovertex/fractal-terrain. I'm providing this as is, with what will probably be minimal support. It's there just so other can learn something from it and it probably has downsides in optimization. If you're interested in the actual Visual Studio 2013 project, drop me a PM.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top