User:Codehead/Journal

From GPWiki
Jump to: navigation, search

29/04/06
Home Again
Back home from my overseas service. I managed to get a little done on AMBER. However, I have been asked to produce a 'proper' app for a local company, so my time is being eaten by that. Still, I do get to use OpenGL for it. \o/. Also, I get to re-jig my Font Generator as I'll need it for the project.
FloorPlan.png


02/02/06
Damn Hot!
Seeing as my journal hasn't been updated for a while, I thought I'd chuck in a quick entry. I'm not getting much time for coding out here in Afghanistan. The biggest session I've managed added a few features to my font gen tool. I've read many articles on things that I'd like to try in AMBER, but I doubt I'll see any of it through while I'm stuck out here.


28/09/05
Coding Away from Home
Well my little trip away is almost over. I've had a few months away, with nothing to do in the evening but code. I've done some nice work on AMBER's GUI system.

guiwip.jpg

It now supports Messageboxes, Listboxes, Scrollbars, Text, Button and Static controls. There's a nice hierarchical child system too. Now I just have to streamline and optimise the code and finish the documantation so that when I come back to it in a few months, I can work out what the hell it all does!


01/07/05
The Joy of Programmer Art
I've had some contributions to AMBER from interested people. I've had to low polygon-ize and skin them myself, so I've been busy being arty and not coding much recently. The mechs in the back row in this render haven't been skinned yet.
mechgroup5.jpg
I did manage to get an MD3 loader to work and YES! The animation is more accurate and the UV mapping works better too. Yay!
I'll be going away for some training shortly, so don't expect any updates for a good while. :)


01/07/05
Model Format Blues
Well, MD2 isn't as nice as it seems. The model wobbles and the textures flutter when animating. This is due to the low data resoultion in the file. Still, I've skinned the model up whilst playing with Milkshape:
skinnedmech.png
I'm looking at MD3 now, the format is similar, but has higher resolution and supports joining of separate meshes (legs, torso, weapons, etc). This will work well for customising the mechs, I just hope the animation is more solid.


17/06/05
MD2 Breakthrough!
Finally managed to extract the model data from an MD2 file. The stumbling block was the frame_t structure, some docs don't mention it, grrr. That explains why the vertex data I was getting was mangled. One doc even said that the vertex data was a float array, even worse.
For any interested parties, each frame chunk begins with a frame_t defining the scale and translation to be applied to each vertex, which are held in an unsigned char array.
Now on to the animation, Yay! I feel an MD2 wikipage comming on.


26/04/05
Seems like no-one is updaing journals anymore, but here goes.....
I got fed up with tweaking the output of other people's font generators so decide to do one of my own. It's been fun, a nice diversion from AMBER, and a learning experience in Win32 coding. I've learnt alot about owner drawn-controls and a few other areas that I've avoided in the past. I would recommend diving in head first to anyone who wants to learn about any area of coding, it seems the more you think about stuff, the less you get done. I just waded into the code and somehow it all came together.
fontgen2.jpg

The new addition to the family is keeping my coding time to a minimum, but I'm sure things will settle down soon.


24/04/05
I've been playing with missile movement and trying to get an interesting curvy flight path. My first attempt used a direction vector and angular adjustments. Although the missiles hit the target (most of the time), the flight path was dull and unrealistic, there's no acceleration and the missile sometimes can't hit the target as it can't turn fast enough.

missile1.jpg

My 2nd attempt used a direction vector which is modified by a 'thrust' vector. This looks much nicer, but as you can see from the picture, most of the time it misses the target.

missile2.jpg

Ah well, back to the drawing board.


10/04/05
AMBER's been on a back burner recently. I've made some good progress in fixing the sub-systems. The GUI's coming on nicely, if I can just stop myself adding 'cool features'.

guitest.jpg

My main thing recently has been the OpenGL tutorials here at the Wiki. With Marijn's help I've finally got some GL examples together in a 'framework' that allows multiple examples to be dropped in. The next two I'm preparing are display lists and billboarding/particles:

DispList.jpg

Particles.jpg

I'm starting to run out of ideas for GL stuff. Also, the framework could do with a utility library to encapsulate some of the previous examples (IE texture loading) to allow more advanced examples to be produced.


25/02/05
After noting the observations in Joshua's Journal, I've decided to tackle some of the lower level aspects of AMBER. I've been fixated on the 'Eye Candy' recently and I need to go back to some of the flaky sub-systems that I put in place right back at the beginning. Text rendering is the first candidate, I've lived with wglUseFontBitmaps up until now, but for performance and portablility I'm implementing my own textured quad text renderer. Early results look promising, a fixed pitch font bitmap combined with an array of values for character widths gives nice output.
Next is the interface and config screens, currently configuration of screen res, color depth, etc is hard coded. I need to look at the best way to add buttons, controls and dialogs without resorting to GLUT or GLUI.


13/02/05
Well, what I learnt on my trip was, "Don't install Dungeon Siege and then expect to get any work done." I did manage to do a bit of useful stuff with particles and stuff.

missile.jpg

MD2 Model loading is beating me at the moment, but the my 3DS loader seems to be doing the trick until I need animation.

mechonmap.jpg


23/01/05
Well, this journal has been quiet for a month so I thought I'd just note my latest work. I got an A-Star pathfinder going. The nature of Battletech movement is causing some problems, but I'm sure I can tweak the values to compensate. I've also knocked together a 3DS loader after referring to Doug's article and a few docs I Googled up. I have to go away for a fortnight next week for a training course, but I'll be taking some dev tools away so I'm hoping to get lots done.


24/12/04
Woo, transparent water with blended reflections. I've added a skybox, and rendered the inverse view(s) to a texture. Overlaying that texture with a stencil allows blending with the existing 'water' polygon. Screenshot.
Now to fix the lighting and correct the mess I've made of the projection matrix. :)


23/12/04
Got the reflections working(ish). screenshot - The lighting (next task) is messing it up. I think I'm going to have a problem with the reflection plane as the water level can vary between separate water hexes. I think this means I'll have to render a different reflection plane for each level of water. How slow will that be?
Anyway, more relatives comming tomorrow so I'll have a few unplugged days to think about it.


20/12/04
Relatives certainly eat into your coding time! Visitors over the weekend meant I got nothing done. Now I'm off work, armed with NeHe's article on reflection and a few ideas of my own. I'm going to work on adding nice reflective water to AMBER.


08/12/04
Well, Geocities' banners finally got the better of me and I've bought some hosting, so I've been playing with PHP and mySQL recently instead of working on AMBER.


04/12/04
OK. So the 'routine' failover resulted in 2Tb of lost data and a dead SQL server. Never trust Doubletake in an untested environment. I hope tonight's coding session is more successful.


03/12/04
Managed to tear myself away from heightmaps and get back to AMBER. Various things on the ToDo list at the minute. Looking at some GUI stuff (file requestors, message boxes, etc) I've looked around the various libs, but I want to use groovy images for the dialogs, so I'm starting from scratch. I've also looked at text rendering libs 'cos up until now I've used the WGL text function, which ain't very portable. Lastly I'm trying out a few things to blend together the textures at the edges of the hexes in AMBER's maps. Where there is a transition from grass to mud or rock it's very sharp ATM. I'm playing with blending a custom map for each hex at startup, but I think that's a bit wasteful on resources. As there are at least 280 hexes per map!
On top of that I have to go into work tomorrow to failover and bring down half our SAN so we can move the primary to a new building. No data loss? watch this space.


01/12/04
Well, I was going to go back to work on AMBER tonight, glSandbox is at a point where I can leave it alone for a bit. However, I seem to have pissed my time away installing Mandrake on my spare box whilst playing with GLFW and heightmaps on the other. I blame FlipCode for the loss of my evening, I was browsing the ITOD archive (Here) looking at older stuff from 2000 and I was inspired to give heightmaps a go. Surprisingly simple to do and quite funky results. The next thing to try is 3D textures using Doug's tutorial


30/11/04
Well it works fine from a console win32 app. Leaves a nasty DOS box lurking around though.

// Works for VC++.NET once opengl32.lib and glfw.lib are linked.

#include <gl\glfw.h>
#include <iostream>

using namespace std;

int main(void)
 {
  float Rot=0.0f;

   if(glfwInit()==GL_FALSE)
    {
     cout<<"Init failed!"<<endl;
     return 0;
    }

   if(glfwOpenWindow(400,400,8,8,8,8,32,0,GLFW_WINDOW)!=GL_TRUE)
    {
     cout<<"GL window creation failed!"<<endl;
     return 0;
    }

   while(glfwGetWindowParam(GLFW_OPENED)==GL_TRUE) // Draw something
    {
     glClear(GL_COLOR_BUFFER_BIT);
     glLoadIdentity();

     glRotatef(Rot,0.0f,0.0f,1.0f);

      glBegin(GL_TRIANGLES);
       glVertex3f( 0.0f,-1.0f,0.0f);
       glVertex3f( 0.5f, 0.5f,0.0f);
       glVertex3f(-0.5f, 0.5f,0.0f);
      glEnd();

     glfwSwapBuffers();

     glfwSleep(0.0001);

     Rot+=0.2f;
     glfwPollEvents();
    }

  glfwTerminate();

  return 1;
 }


29/11/04
Downloaded and set up GLFW after Marijn's suggestion.
Very cool and easy to use.


int APIENTRY WinMain(HINSTANCE hInstance,
                     HINSTANCE hPrevInstance,
                     LPSTR     lpCmdLine,
                     int       nCmdShow)
 {
   if(glfwInit()!=GL_TRUE)
    {
     MessageBox(NULL,"GLFW Init failed!","Fatal Error!",MB_OK);
     return -1;
    }

  glfwOpenWindow(320,200,8,8,8,8,32,0,GLFW_WINDOW);

   glBegin(GL_TRIANGLES);
    glVertex3f( 0.0f, 0.5f, 0.0f);
    glVertex3f(-0.8f,-0.5f, 0.0f);
    glVertex3f( 0.8f,-0.5f, 0.0f);
   glEnd();

  glfwSwapBuffers();

   while(glfwGetKey(GLFW_KEY_ESC)!=GLFW_PRESS)
    glfwPollEvents();

  glfwCloseWindow();
  glfwTerminate();

  return 0;
 }

That's alot easier than the 3 screens of code I've used in the past to setup GL.