Jump to content

  • Log In with Google      Sign In   
  • Create Account

Banner advertising on our site currently available from just $5!

1. Learn about the promo. 2. Sign up for GDNet+. 3. Set up your advert!


Member Since 20 Jun 2010
Offline Last Active Sep 16 2012 02:41 PM

Topics I've Started

Procedural Terrain Progression and Queries

22 August 2012 - 09:27 AM

For a while now I have been trying to accomplish nice smooth and somewhat complex terrain generation, in the long run I would like to evolve this into a planet generator.

Started out with reimers tutorials in XNA
Posted Image

Then moving onto pure OpenGL and trying to accomplish creating and displaying the map via shaders:
Posted Image

Which takes me to my last attemp
Posted Image
Posted Image

I have recently been looking up quadtrees

But im stuck as to what to do next.

My thoughts are:
Generate a large and detailed plane, say 10.000x10.000 units
Use some noise function to give it height
Create normals
Then create index list
Create a quadtree of max level 100(for example)
then using the current quadtree level, use it as a stride for the index list (so at level 0 I draw a single quad using each corner of the plane as a vertice, at level 1 its subdivided into 4 quads and so on untill the max level)

But I dont know if this is how it works, can anyone give me some advice?
Also If anyone has some resources on Procedural Terrain on Procedural Planets it would be much appreciated.

Simple OpenTK program not working

17 August 2012 - 05:22 PM

I was trying to port some of my old OpenGL stuff to OpenTK however I couldnt get it to work.
I am now trying a simple program to display a triangle:
This is my setup:
MVP = Matrix4.CreateOrthographicOffCenter(0.0f, 1.0f, 1.0f, 0.0f, 0.0f, 2.0f);
where the screen is:

[source lang="plain"]0 - 0 1 - 0---------------------------------------------| || || || || |---------------------------------------------0 - 1 1 - 1[/source]

And these verticies:

[source lang="csharp"]float[] vertices = { 0.5f, 0.0f, 1.0f, 0.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f };[/source]

The triangle should be right in the midle of the screen, well for some reason it isnt.

Heres all the code encase its something other than positioning
[source lang="csharp"]// Released to the public domain. Use, modify and relicense at will.using System;using OpenTK;using OpenTK.Graphics;using OpenTK.Graphics.OpenGL;using OpenTK.Audio;using OpenTK.Audio.OpenAL;using OpenTK.Input;namespace StarterKit{class Game : GameWindow{ float[] vertices = { 0.5f, 0.0f, 1.0f, 0.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f }; int vbo; string fragmentSource = "#version 120\n" + "void main(){gl_FragColor = vec4(1.0f, 0.0f, 0.0f, 1.0f);}"; string vertexSource = "#version 120 \n" + "uniform mat4 MVP; attribute vec4 Position;" + "void main(){ gl_Position = MVP * Position; }"; int shaderProgram, vertexShader, fragmentShader; int MVPID, PositionID; Matrix4 MVP; /// <summary>Creates a 800x600 window with the specified title.</summary> public Game () : base(800, 600, GraphicsMode.Default, "OpenTK Quick Start Sample") { VSync = VSyncMode.On; } protected override void OnDisposed(EventArgs e) { GL.DetachShader( shaderProgram, vertexShader ); GL.DetachShader( shaderProgram, fragmentShader ); GL.DeleteShader(vertexShader); GL.DeleteShader(fragmentShader); GL.DeleteProgram(shaderProgram); GL.DeleteBuffers(1, ref vbo); base.OnDisposed(e); } /// <summary>Load resources here.</summary> /// <param name="e">Not used.</param> protected override void OnLoad (EventArgs e) { base.OnLoad (e); GL.ClearColor (0.1f, 0.2f, 0.5f, 0.0f); GL.Enable (EnableCap.DepthTest); GL.GenBuffers (1, out vbo); GL.BindBuffer (BufferTarget.ArrayBuffer, vbo); GL.BufferData (BufferTarget.ArrayBuffer, (IntPtr)(vertices.Length * sizeof(float)), vertices, BufferUsageHint.StaticDraw); vertexShader = GL.CreateShader(ShaderType.VertexShader); GL.ShaderSource( vertexShader, vertexSource ); GL.CompileShader( vertexShader ); fragmentShader = GL.CreateShader( ShaderType.FragmentShader ); GL.ShaderSource( fragmentShader, fragmentSource ); GL.CompileShader( fragmentShader ); shaderProgram = GL.CreateProgram(); GL.AttachShader( shaderProgram, vertexShader ); GL.AttachShader( shaderProgram, fragmentShader ); GL.LinkProgram(shaderProgram); MVPID = GL.GetUniformLocation(shaderProgram, "MVP"); PositionID = GL.GetAttribLocation(shaderProgram, "Position"); MVP = Matrix4.CreateOrthographicOffCenter(0.0f, 1.0f, 1.0f, 0.0f, 0.0f, 2.0f); } /// <summary> /// Called when your window is resized. Set your viewport here. It is also /// a good place to set up your projection matrix (which probably changes /// along when the aspect ratio of your window). /// </summary> /// <param name="e">Not used.</param> protected override void OnResize (EventArgs e) { base.OnResize (e); GL.Viewport (ClientRectangle.X, ClientRectangle.Y, ClientRectangle.Width, ClientRectangle.Height); } /// <summary> /// Called when it is time to setup the next frame. Add you game logic here. /// </summary> /// <param name="e">Contains timing information for framerate independent logic.</param> protected override void OnUpdateFrame (FrameEventArgs e) { base.OnUpdateFrame (e); if (Keyboard [Key.Escape]) Exit (); } /// <summary> /// Called when it is time to render the next frame. Add your rendering code here. /// </summary> /// <param name="e">Contains timing information.</param> protected override void OnRenderFrame (FrameEventArgs e) { base.OnRenderFrame (e); GL.Clear (ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit); GL.UseProgram (shaderProgram); GL.UniformMatrix4(MVPID, false, ref MVP); GL.EnableVertexAttribArray(PositionID); GL.BindBuffer(BufferTarget.ArrayBuffer, vbo); GL.VertexAttribPointer(PositionID, 3, VertexAttribPointerType.Float, false, 0, IntPtr.Zero); GL.DrawArrays(BeginMode.Triangles, 0, 3); GL.DisableVertexAttribArray(PositionID); GL.UseProgram (0); SwapBuffers (); } /// <summary> /// The main entry point for the application. /// </summary> [STAThread] static void Main () { // The 'using' idiom guarantees proper resource cleanup. // We request 30 UpdateFrame events per second, and unlimited // RenderFrame events (as fast as the computer can handle). using (Game game = new Game()) { game.Run (30.0); } }}}[/source]

Non deprecated tutorials

24 July 2011 - 05:57 PM

As you know with openGL 3.x they have deprecated the fixed function pipeline meaning that everything has to be done with shaders and VBO, so I was wondering if there are any plans to swap all the NeHe tutorials into non deprecated openGL?

another UK university help thread.

06 November 2010 - 01:46 PM

Hi i first of all just want to say that all though i haven't posted much on here i have been lurking the forum for a while, and by doing that i have seen a few of the "what course to do" threads.

I have read all the information you usually give those people as well as some other stuff i found, the thing is:

Next year 2011 i will be starting university and there fore now is the time i have to choose and apply for them, however im having a bit of a hard time choosing what course to do, on one hand i love games and programming and i would love to work as a programmer, on the other hand im realistic and know that its hard enough to get a job at all let alone one in the games industry.

So my debate is whether to try and go for derby's programming course(which i have seen people say is very good) or go to one of the other universities and take computer science with a few modules that would benefit a games career.

Now until now i wouldn't even of asked however i am reading more and more here and i see that derby's got probably the best course for programming(games wise that is) and they probably have good contacts within the industry, so they would be best suited for say helping me get a summer internship or something.

Apart from that i would also like your help with anything i can do at home to further my knowledge into the subject, im currently learning C++ by creating a simple game with SFML as well as learning some advanced maths.

Oh and also would it be ok if i posted a personal statement once i have a draft see what you think?
As well as if you have any advice on it?
Finally i dont know if anyone here goes or has been to Hull university, but anyone know what their contacts in the industry are like and such?

Thanks to anyone and everyone that has taken the time to read that, really appreciated.

C++ or C# as first C language

20 June 2010 - 09:27 AM

OK so this summer i want to learn a new language (or at least the fundamentals)
and i want this language to be game related
therefore i have deducted it down to C++ or C#

i know vb and java as i have studied them for college so i understand the fundamentals of programming
i would mainly be using the workshops on the forum as well as a book or 2

i have got the beginning C++ game programming and i have seen on ebay a XNA programming book so either way i can get a book on it

so the main things are:

C++ :
+ multi platform (windows, Unix...)
+ multi purpose (games and other software)
- harder to learn (not really harder but C# is easier due to optimizations)

+ game orientated
+ can make games for XBox 360
- only works on Microsoft products (you can use monoXNA but i dont know if games created with this would work on 360)
- needs .net framework to play (you can compile your games to have the necessary .net files with it but then it uses more ram)

So at first i would be developing simple games for Windows and if i can make them run on Linux then that's a bonus however in the future i will want to develop 360 games as well.

also worth noting that i will be learning both these languages at some point
so really its just a question of which one is easier to learn and then lean on when learning the other or different languages