0

To give you an idea of where I'm coming from, this started as a teaching exercise to get a 12-year-old video game addict into coding. The 2D games, I did in SDL with him and that was fine because I wasn't planning on going into 3D. Yeah, right! So now I'm in at the deep end in OpenGL and mainly trying to figure out exactly what it can and cannot do. I understand the theory (still working on beziers and nurbs if the truth be told) and could code the whole thing by hand in calculated triangular vertices but I'd hate to spend days on that only to be told that there's a built in function/library that does the whole thing faster and easier.

Quadrics seem to be extremely powerful but not terribly flexible. Consider the human head - roughly speaking a 3x4x3 sphere or a torso as a truncated cone that's taller than it is wide than it is thick. Again, a quadric shape with independent x,y and z radii. Since only one radius is provided, am I right in thinking that I would have to generate it around the origin and then apply a scaling matrix to adjust them? Furthermore, if this is so, am I also correct in thinking that saving the results into a vertex array rather than a frame list results in the system neither knowing or caring how they got there?

Transitions: I'm familiar with the basic transitions but, again, consider the torso. It can achieve, maybe, a 45 degree twist from the hips to the shoulders that is distributed linearly across the entire length or even the sideways lean. This is applied around the Y or Z axis respectively but I've obviously missed something about applying transformations that are based on an independent value. (eg rot = dist x (max_rot/max_dist). Again, I could do this by hand (and will probably have to in order to apply the correct physics) but does OpenGL have this functionality built in somewhere?

Any other areas of research I need to put in would be appreciated in the notes.

genpfault
  • 51,148
  • 11
  • 85
  • 139
Mike
  • 2,721
  • 1
  • 15
  • 20
  • OpenGL doesn't have beizers or nurbs or quadrics or anything of the sort. It has triangles, lines, and points. That's it. You're responsible for making the triangles. Typically you'll use a 3D modeller such as Blender, which can export a model as a bunch of triangles. (You can actually render other shapes in the fragment shader, bypassing normal rasterization, but this is unusual and esoteric.) – Dietrich Epp Feb 09 '15 at 04:40
  • You may find it more enjoyable to use Unity. You'd still be writing code, but you don't have to write a 3D engine--something that most CS graduates would find a serious challenge! – Dietrich Epp Feb 09 '15 at 04:43
  • Glu (tag added) provides many features, including those mentioned and it's those I'm trying to get a handle on. I'll look more into Unity but at first glance, it seems a little too flash-like which, bearing in mind that the purpose is to get him thinking about code, program structure and problem solving, might be a little too far removed from what I'm trying to achieve. – Mike Feb 09 '15 at 04:56
  • You do make a good point, though. For the final result, the composite parts (however derived) should be replaced by a straight forward vertex list. Maybe I just need to stick to absolute basics in the meantime and apply the final bespoke outline to the generated pivot/rotational points. – Mike Feb 09 '15 at 06:43
  • 1
    I, too, dismissed Unity at first. I've written several small games, mostly C++ with OpenGL (2D and 3D), but some with Unity. I also taught virtual reality classes to teenagers. My experience with Unity is positive: it doesn't dumb things down like I feared, I still write all the game logic and work with vectors / matrixes / quaternions. It does handle the drudgery of loading textures and models, and it comes with decent physics too. My complaints are: I want to write my own shaders and the physics is bad for platformers. – Dietrich Epp Feb 09 '15 at 07:29
  • In that case, I will look more closely into it. Thanks. – Mike Feb 09 '15 at 07:39
  • OpenGL is also worth teaching, but the amount of work necessary to put together even a rudimentary 3D game is daunting. Maybe putting together a graphics demo, rather than a full game, would be worthwhile. With WebGL, you get running quickly and yet still have the full power of shaders to work with. E.g.: http://madebyevan.com/webgl-water/ http://alteredqualia.com/three/examples/webgl_terrain_dynamic.html – Dietrich Epp Feb 09 '15 at 07:44
  • I don't think I'm actually trying to write a game - that's just the hook I'm using. My initial goal is to create a pseudo-biped which reacts (and can be programmed by him to react) to regular physics. – Mike Feb 09 '15 at 21:16

0 Answers0