Posts Tagged ‘trouble’

h1

possible new pages and game menu sphere trouble.

September 17, 2008

I’m having mega trouble with this sphere business.  I have been trying to create my own version of the menus in Metroid Prime 2.  If you played that, you know these menus are totally sweet, and consist of a hub in the middle with spokes coming out as menu items.  You rotate this hub in 3D, and the front most option is what is selected.  I’m making a more solid version with cylindrical spokes (easy) and a sphere in the middle (hard.)  You’re probably thinking, “why doesn’t this idiot just use latitude/longitude for his sphere?”  Because it’s not as efficient as a geodesic sphere.

Now, by my understanding, the best method for triangular tessellation of a sphere is simple.  Basically, we have several arrays of longitudinal looking great circles, each one with a different pole pair.  The intersection of three great circles then is a triangle on the surface of the sphere.  Problem is, I have no idea how to store and calculate the intersections of these great circles, even though I have a perfect understanding of the geometric concept.

Fig. 1

Fig. 1

Fig. 1 shows a great circle.  That green plane intersects the center of the white sphere forming the red great circle.  So, it’s not that hard of a concept.

But do we store the plane’s information, or the circle’s?  It makes sense to me we should store the plane’s information with an orientation matrix (or other orientation representation) for the plane.  So that’s out of the way.

Now, in Fig. 2, we see what a great circle array looks like.  This is what I want each pole pair to have.

Fig. 2

Fig. 2

This is actually an image of the longitudinal lines on a lat/lon method sphere, such as a planet.  These are actually, like I said before, a great gircle array.  Now imagine a set of these, each with one pole originating from the vertex on a tetrahedron.  This is a perfectly triangle tesselated sphere.  I am really having trouble with the geometry math on this though, and would appreciate any help.  If I get this working, I will do a page in the blog pages for it.

Speaking of pages, I am thinking of creating a blog page about text rendering in OpenGL.  This will include instruction of how to load freetype fonts and how to display texture fonts.  I will discuss the converting of the alpha-luminance bitmaps given by freetype in to power of two 8 or 4 bit alpha textures, and how to make and load pure bitmap fonts.  Then displaying the textures with a simple function.  I’ll also cover metrics.  But only if it’s requested.  Or if I feel like it.

Advertisements
h1

floculate continued, freetype blues

September 11, 2008

So, I’m still working on the codebase for this Floculate game.  Here’s what I’ve done so far:

  • Wrote a new video code base.  It has one API in a header file, and it compiles a different C file depending on the platform you’re compiling on.  This is done by having system.c include either system.linux.c or system.win32.c depending on platform defines.  system.win32.c is empty right now, because I’m still working on the GNU/Linux platform.  When I finish the platform specifics and rendering fundementals I’ll do the Win32 version.
  • Took the physics engine source dir and copied it over to the Floculate source dir, and then did a make reference to the rat_physics makefile of choice, followed by copying a temp file of librat_physics_double.a.  Double is the precision of the real type it’s compiled with.

Here’s what I’m working on now… freetype font rendering in OpenGL.  I want to make my own font engine so that it’s in C and only as big as it has to be.  Problem is, I have no idea where to start.  I know what I want to do, and how to do the second part.  Basically it goes like this:

  1. Use FreeType to render the desired glyphs to pixmap surfaces.
  2. Create a texture and metric datum for each glyph.
  3. Display them as textured quads given text input / special effects.

So I can create textures from pixmaps and display them as textured quads.  What I DON’T know how to do is render the font.  If anyone out there has some advice, please come forward.  And please, don’t be all ‘hurr hurr use a redy madee font engin.’  I don’t want to.  But if someone knows of a good example of using freetype to render to pixmaps, then making textures from that, great.  I’ll keep posting on this until we’re all resolved.

On a random tangent: listen to Under The Weeping Moon.  It’s an awesome song.