0
\$\begingroup\$

For example say you wanted to draw a 3D cube you can define an array of hard coded vertices using float3, here is an example. http://msdn.microsoft.com/en-us/library/windows/desktop/jj552949.aspx

But you obviously can't define by hand large and complex changing geometry vertices such as you would have in a game. So I am trying to understand the mechanics behind how these vertices are loaded/interpreted into the Engine.

Another example, you could create a model in say Maya and export this vertex data to say an XML file, then load up the model using GL/DX. So Maya is doing all the work determining the vertex data. You could do this for terrain also, any vertex geometry.

However a game state is constantly updating, it is not static, the camera is constantly moving with user input. So what is the mechanics behind constantly re-evaluating new vertex data depending on user input.

\$\endgroup\$
  • 4
    \$\begingroup\$ this question is too broad \$\endgroup\$ – Raxvan Apr 3 '14 at 11:31
  • 3
    \$\begingroup\$ I suggest you pick up a book about computer graphics. \$\endgroup\$ – concept3d Apr 3 '14 at 11:32
  • \$\begingroup\$ There are a couple of tutorials from the internet i would recomment this one to begin with open.gl/transformations \$\endgroup\$ – Raxvan Apr 3 '14 at 11:33
  • 3
    \$\begingroup\$ Some books you could look at are Real Time Rendering 3rd by Tomas Akenine-Moller et al (Quite advanced though), Game Engine Architecture by Jason Gregory (Good all round book) and if you're doing OpenGL, OpenGL Super Bible 5th by Richar S. Wright et al. \$\endgroup\$ – Soapy Apr 3 '14 at 12:26
1
\$\begingroup\$

It's not very clever—basically you update the data in memory and then call direct3d/openGL/whatever to do a new render at each update. A single rendered image is called a frame. So in a video game, you render like 50 frames in a second (written 50 FPS).

As Raxvan, I suggest you to read a book about computer graphics as the subject is vast and cannot be satisfactorily covered in one stackexchange answer.

\$\endgroup\$
  • \$\begingroup\$ I know you update the data, I stated that, what I asked was how are the new data vertices determined, it's not like you have a massive hard coded array of every possible game state. A new frame of vertices are calculated for every 1/res(Hz). So you have some algorithms to do this and send this new vertex arrays to the GPU. But how do these algorithms work is what I am really asking. Where do the algorithms get there references points to create a new game state with regard to user input. \$\endgroup\$ – user3333072 Apr 3 '14 at 12:39
  • \$\begingroup\$ Lets say the user moves the mouse 45degrees to the left, the camera position does not change, rather the game world changes with regard to the camera. So how do we know how to describe what we see at 45deg. There doesn't seem to be a master description of the game world, a master reference stored somewhere. If you were creating a demo you could hard code everything and just load and stream, whereas a users input is unpredictable so everything has to be recalculated but recalculated against what, what's to say we should see what after user input. \$\endgroup\$ – user3333072 Apr 3 '14 at 12:44
  • \$\begingroup\$ It's up to you to program how to implement how data should be updated—you are a programmer after all. In openGL for instance, you just link a chunk of memory to the renderer. Everything else is up to you : how you declared your memory (static array, malloc array, ...???), how you filled the data (read from a custom file, generate it procedurally, ...???) and how to modify it (having a function that adds a value to the y coordinate whenever you press key up, reading every T a file and reload data in the array, ...???). Be creative ! \$\endgroup\$ – Lærne Apr 3 '14 at 13:29
  • \$\begingroup\$ I think I get what your saying, Laerne. In that case it could be fairly straightforward, but I just didn't click with that. So check for input and you increment/decrement all/selective vertex points accordingly to the input position. Why didn't I think of that, that is so simple. Or as you said you could read the necessary sections from a file and send that to the screen. \$\endgroup\$ – user3333072 Apr 3 '14 at 13:44
  • \$\begingroup\$ You dont (usually) mess with the vertices after they are in memory, what you do is use a shader and matrix transformations to move your objects around \$\endgroup\$ – Luke B. Apr 4 '14 at 9:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.