8:00 – FP
Category Archives: Phil
Phil 2.1.12
8:30 – 4:30 FP
- Starting the OpenGl SuperBible 5th Edition, which covers OpenGl 3.0+
- Hmm. Can’t check out code from svn http://oglsuperbible5.googlecode.com/svn/trunk/
- Here’s the useful SVN fix of the week: “SVN uses a few HTTP commands that not every web proxy and/or firewall understands, which can lead to errors. There is one thing that might fix this for you, and that is to use HTTPS instead of HTTP, because then the
connection is encrypted and any proxy/firewall in between can’t mess with the content. I checked, and the server provides HTTPS access, although that is not necessarily always the case. “ - Ok, after some heroic struggling with getting libraries to behave and dealing with static declarations, I can now draw a simple triangle. I’m going to try to do the same in FLTK now, since I’d like to get away from static libraries…
- Got a basic Shader Window framework compiled. Will test tomorrow.
Phil 1.31.12
8:30 – 4:00 FP
- Good math library if I need it later: http://cmldev.net
- Cleaning up the collision detection

- And collisions work with multi-axis roatations. Cool.
- Starting the OpenGL 4.0 Shading Language Cookbook.
- Immediate mode has been deprecated! Going to get the GLEW (openGL Extension Wrangler) from sourceforge
- Wow. No matrix mode either. Getting the GLM library
- Code download is here: http://www.packtpub.com/code_download/7658
- Hmm. I need to understand how the camera is setup in OGL 4.0.
Phil 1.30.12
8:30 – 5:30 FP
- Adding environment methods that will coordinate the interactions of the objects.
- Cleaning up Arvo’s so that only 3D collisions between solid objects are calculated, with a resulting unit penetration value.
- Collision detection and response are now working!
- Adding a few more cubes to collide with. Then work on global to local mapping so that I can have the cubes at arbitrary angles.
Phil 1.27.12
8:00 – 10:30 FP
- Working on collision detection. It just needs to be convex hull. At this point I’m thinking of doing the following:
- For each polygon
- calculate the shortest distance to the plane
- If the square of the distance is less than the collision radius
- See if the collision point is within the polygon (project the plane onto X, Y or Z, if it crosses an odd number of line segments, it’s outside – for convex polygons we can stop at one crossing)
- If the distance from the “center” (average of all points) to the collision point on the plane is less than the distance from the “center” to the test point, then the collision is happening outside the hull, and the force can be calculated based on the difference between the collision radius and the surface. Otherwise, it’s within the hull, and the force is based on the collision radius + the distance from the polygon.
- Well this is convenient – The Game Programming Wiki
- Looks like we can use Arvo’s algorithm. Going to see how this works. Discovered Arvo here at Gamasutra.
- Graphics Gems code repository
- www.geometrictools.com: source code for real-time computer graphics and physics, mathematics, geometry, numerical analysis, and image analysis
- http://www.realtimerendering.com/intersections.html
10:30 – 12:30 Interview
- Went well. The work would be entirely on site. Ah well.
1:30 – 5:00 – FP
- Got Arvo’s in. I can clean it up so that the collision test is only for solid shapes, which will allow me to get penetration values out of the collision. There was one tricky bit – I had to get the viewpoint matrix multiplies out of the collision calculations. So now there is a render() pass which draws, and a calculateCollisionPoints() that is called at some other time without any glBegin()/glEnd() blocks, and starting with an Identity matrix. I then pull the result of all the calculations off the matrix stack and save for the collision calculations. This does need to be cleaned up, but it’s not bad.
- Collisions!

Phil 1.26.12
8:30 – 5:00 FP
- Wire up the force sliders
- Index finger is done
- Thumb finger is done
- Ring finger is done
- Middle finger is done
- Pinky finger is done
- Added text within the 3D environment, partially to show Dong how it’s done, but also because it could be quite useful. It’s in the DrawableObject base class.
- Add collision detection
- Add force output display (Small GL windows, drawing only 2D?, slider?)
Phil 1.25.12
8:30 – 5:30 FP
- More on the HandControlUi and RightHand proper.
- Added a clock to calculate elapsed time between frames for physically-based modeling.
- Got the basics of the hand working, but I need to rework the eyepoint/model control. Adding a popup menu to select the mode.
- This is a great source for FLTK coding examples (Erco’s FLTK Cheat Page)
- Done with the popup menu
- Adding the matrix analysis to get the position of the fingertips. Done for one finger. Need to add methods to store and access all the position information. May need orientation. If so then I could subtract the position from the current matrix, then multiply a vector by the resulting matrix.
- Might need this: http://www.cprogramming.com/tutorial/3d/rotationMatrices.html
Phil 1.24.12
8:30 – 2:30
- Well, I was hoping to use the MODELVIEW_Matrix to determine the orientation vector of the camera, but no luck. Time for classical spherical coordinate transforms. Transposing Y and Z, since OpenGl likes to have Y as the up vector.
- phi = angle from vertical, theta = angle from x axis
- z = cos(theta)*sin(phi)
- x = -sin(theta)*sin(phi)
- y = cos(theta)
- And that is now working. Note that we had to multiply the x component of the view vector by -1.
- Oooo – new shader book: http://www.packtpub.com/opengl-4-0-shading-language-cookbook/book
- Started on the HandControlUi fltk class.
Phil 1.23.12
8:30 – 5:30 FP
- Fixing up a few things with eyepoint control, then adding the hand
- Got sidetracked about adding text overlay capability. Also, to truly make the eyepoint controls work, the eye vector needs to be transformed by the view matrix rotational component
- Big lesson of the day – if you declare a static variable in the header file, you must reference it outside the methods in the .cpp file. But Dprint() is now working as an overlay!
- Filled out paperwork for Clif’s project, looks like there is progress.
Phil 1.20.12
8:30 – 5:30 FP
- Since I have to change my insanely long FGM password, I swing by the customer to check all my passwords. They won’t need changing for a while. Looks like FGM’s password schedule is now at a different frequency. More stuff to remember. I think it’s crowding out the calculus.
- Working on the Fl_GL_Window extension (Gl_View_Window) that will handle the drawing of all the items in the universe. Got the callback working nicely.
- Add mouse functions for world and camera control – mostly done.
- Working out how to set up callbacks using Fluid. Remarkably, it seems to be making sense.

Phil 1.19.12
8:30 – 4:30 FP
- Gave Dong my copy of the OpenGl Superbible so he can have a good grounding
- Set up a window in Fluid that has all the pieces needed for display and testing
- Figure out timers in C++ (FLTK?) and incorporate. Working, though I can’t get a callback to work inside of a class. I may need to go to FLTK 3.0? Downloading and testing. Nope, doesnt work.
- The way you do callbacks with classes is to have the callback be static. You pass the “this” address of the class in so that you can work with the class that is active at the moment. This is covered in detail here: http://www.fltk.org/articles.php?L379+I0+TFAQ+P1+Q, which is from the generally useful http://www.fltk.org/articles.php?L+TFAQ
Phil 1.18.12
8:30 – 4:30 FP
- Asked Dong to look at setting up the first pass of the chart applet using the potatoland.org/gl code as a possible foundation, since it seems to be the best example of working text overlays.
- Getting openGL running in FLTK, then porting the hand
- Got the CubeView program compiling and linking. To do this, I pointed the “additional include directories” to point to C:/FLTK/branch1.3, which has FL/ underneath it. Then I pointed the “additional libraries directories” to C:/FLTK/branch1.3/lib. The last thing I had to do was point at the proper libraries (note that these are debug directories):
- glu32.lib
- fltkgl.lib
- fltkd.lib
- wsock32.lib
- comctl32.lib
- opengl32.lib
- Once I got the system running, there were piles of “PDB” warning messages (i.e. “‘C:WindowsSysWOW64ntdll.dll’, Cannot find or open the PDB file “). You can fix these by getting the debug symbol tables from microsoft:
- tools->options…
- Having an odd problem with setting the background color. I need to set the glClearColor() in the predraw, before every frame, otherwise it comes up as black. Not sure why.
- Turns out that in FLTK GL windows, the graphics context is reset after things like a resize. THis means that the init code can’t be in the constructor, but rather needs to be in the draw function in the following way:
drawUniverse(){
if(!valid()){
glEnv->init(w(), h()); // called when the context
// has been (re)created
}
glEnv->predraw(w(), h());
draw();
}
Phil 1.17.12
8:00 – 5:00FP
- Continuing on with collision detection
- But first, I need to be able to see a text overlay. Looks like lwjgl has this with their Slick-Util lib. Ugh. This is getting harder than I was hoping….
- Moving hand code over to MSVC, after installing updates
- Building the debug and release dlls
- Another take on 3D. This works in your iPhone: http://css-3d.org/. An example of a website that uses this is http://acko.net/. And there’s http://mrdoob.github.com/three.js/, also. It’s a JavaScript library that renders to WebGL or SVG
- Getting Started with Three.js
Phil 1.16.11
8:00 – 3:30 FP
- Working on getting the fingertip positions out of the modelview matrix
- mat[12] = x
- mat[13] = y
- mat[14] = z
- Added the ability to change colors in the hand and joints for Dong’s test. It didn’t work on his machine at home?
- There is something odd about how the model view matrix is being affected by the fingers? Nope – just had the test transformations happening while the view transforms were still on the stack. So local to global coordinate transformations are working. That was *much* easier than I expected.
- Building collision detection into sphere and box. Rather than reinventing the wheel, I’m going to see if I can use a library. Checking out bulletphysics.org, and the java implementation, JBullet
Phil 1.13.12
8:30 – 4:30 FP
- Interview
- Spent some time with Tom talking about sending data between two data dictionaries
- Building a Finger on my way to building a RightHand
- Hand graphics are done, now working on getting the fingertip positions in word coordinates.
- Think I found it here: http://lwjgl.org/forum/index.php?action=printpage;topic=1866.0 My version of the code follows:
protected float[] getGlMatrix4x4(int matrixId){
float minv[]=new float[16];
ByteBuffer temp = ByteBuffer.allocateDirect(64);
temp.order(ByteOrder.nativeOrder());
GL11.glGetFloat(matrixId, (FloatBuffer)temp.asFloatBuffer());
temp.asFloatBuffer().get(minv);
return minv;
}





You must be logged in to post a comment.