Category Archives: 3D Charting

Phil 3.27.12

8:00 – 8:30 FP

  • Tried running the hand code on my laptop but ran into DLL problems. It was the debug version, so I recompiled the release version today. Let’s see if that makes it easier.
  • A useful page explaining all this, including that debug dlls are not redistributable.

8:30 – 4:30 CSIP

  • Ok, now that I’ve got the examples compiled and running (In Swing! How quaint), let’s see how to use this thing.
  • Chapter 2. Use cases and examples
  • Sent Ed a status update
  • Ok, I got the Drools Developer’s Cookbook, and it looks like I was doing this in the wrong order. Going to start over with the rules engine (Expert)
  • Chapter 1. The Rule Engine
    • An object type constraint plus its zero or more field constraints is referred to as a pattern. When an inserted instance satisfies both the object type constraint and all the field constraints, it is said to be matched.
    • Downloaded drools-distribution-5.3.0.Final, which contains example code. Some problems compiling, but the HelloWorld works, so we won’t worry for now…
    • This process is called inference, and it’s essential for the working of a Stateful Session. Stateless Sessions typically do not use inference, so the engine does not need to be aware of changes to data. Inference can also be turned off explicitly by using the sequential mode.

Phil 3.25.12

10:00 –  2:00 FP

  • What a soggy weekend.
  • Integrating collision detection and response into the hand.
  • Checked out from SVN – still working!
  • Firngertips are now being calculated in world space.
  • Spent a good deal of time getting the global to local (CollisionCube) transformations working. They still haven’t been tested through the rotations, but are working for translation and scaling.
  • Wired up the volume components. At this point the simulation is pretty much ready to hook up to the Arduino.

Phil 3.23.12

8:00 – 12:30 FP

  • It’s going to be an abbreviated day. I’ve got to be over at my parent’s old house in the early afternoon to let in the GB&E guy, and since the weather’s * phenomenal* I’m going to go for a longer and early bike ride. Given all the rain in the forecast for the weekend, I’ll be here to make up the hours, probably more likely on Sunday.
  • Adding in CollisionCube. It’s drawing, and I’m getting fingertip position info for collisions. More on Sunday
  • Checked into SVN

Phil 3.22.12

8:00 – 4:00 FP

  • Looks like I’ll have the CSIP project to charge to soon. Woohoo!
  • debugging RightHand::drawPrimitive() – fixed. Passing by value rather than by reference. D’oh.
  • Shiny hand model! Now I need to wire the graphics to the FingerIO classes – partly done, waiting on putting in the CollisionCube.
  • Tried adding the FingerIO classes directly to RightHand, but the class isn’t instanced by the time show() gets called in KF_GUI. So the FingerIO classes went back to the KF_Hand_window class, and I added pointers to the RightHand class. Not really happy with this, but it will do for now as I get all the other pieces working. And better than the alternative of grabbing the parent of the window class while still reaching into the RightHand class.
  • Next, put all the changed code back into the fluid code – done
  • Adding CollisionCube drawableObject – most pieces are in and I need to test.

4:00 – 5:00 CSIP

  • Spent about 45 min talking CSIP with Ed.
  • Start figuring out drools, with particular emphasis on creating xml that can be ingested and used to create running rule sets. Note that RulePoint could be a starting point for look-and-feel, as this may be the basis for the request for the system.

Phil 3.21.12

8:00 – 3:00 FP

  • Now that the basic framework is put together, adding in the hand. Starting with making shiny cubes and cylinders.
  • When making textures, *don’t* compress your tga files!
  • Added a color modulated reflection shader. This will probably be our main shader for charts, too.
  • Need to add a bit of lighting to the shiny objects. Going to finish building the hand fist.
  • In the process of debugging RightHand::drawPrimitive().

Phil 3.20.12

8:00 – 5:30 FP

  • Spring! That bears repeating. Spring!
  • Working on the hand
  • Building a new FLTK widget to show
    • Communication with Arduino
    • Force on each finger
    • Volume for each finger
    • Sound for each finger
    • Hand view
  • Now I need to wire up the controls
  • Added pointers to the pressure and volume sliders as well as the sound text within the FingerIO helper class. Works well.
  • Wiring up the text output – done. Wound up using a simple multiline Fl_Output class rather than a Fl_Text_Output because when I tried to add a buffer, the code kept crashing trying to create a callback. Not sure that I was making the call in the right place?

Phil 3.19.12

8:00 – 10:30 VISIBILITTY/OH

  • Stopped in to talk to Al F. Things are proceeding apace, apparently.

10:30 – 12:00, 3:00 – 5:00 FP

  • Getting started on the final(?) version of the hand
  • Need to talk to Tom about coding up the arduino, but today’s schedule may not allow. Tomorrow?

Phil 3.16.12

7:30- 9:30 OH/VISIBILITY

  • Stopped by our servers to send Al Ferguson a note asking about positions. While there, I moved the map server over from Jeff’s machine to the integration server
  • Talked to Dong about getting started on charting now that the main pieces of the OGL 3.0+ libraries are written.

9:30 – 2:30 FP

  • Went to UMBC to meet the prototyping support group. It’s nice, there are a couple of makerbots, a laser cutter and several other interesting items. Also, it looks like CCBC has a much bigger lab that you can take a $50 training course on and then have access to. Need to check into that.
  •  Starting on building the hand visualization using the new library. First thing I need to do is make a new FLTK window that shown communication with the arduino.

Phil 3.14.12

8:00 – 4:30 FP

  • Happy PI day! I wonder if there will be bigger celebrations in 2015?
  • Back to building libraries.
    • Release Library is done.
  • Adding test project to solution that tests the library
    • Discovered that a dll was probably not the way to go, so changed the project settings so that it now generated a static library. For once, that was pretty straightforward – Properties->Configuration Properties->General->Configuration Type and select from the dropdown.
    • Everything is compiling and linking, adding some actual content now.
    • Well I’ll be damned – everything works (In debug and release mode!).
  • Same old picture, but with much better foundations:
  • Installed AtomineerUtils, a nifty plugin if Visual Studio that generates documentation frameworks

Phil 3.13.12

8:00 – 1:00 FP

  • Working on turning the base classes of ShaderLearning2 into a library
  • Creating DLL and static libraries in Visual Studio 2010: http://msdn.microsoft.com/en-us/library/bb384835.aspx
  • Adding copies of headers and libs to the dll project. Trying to make this self-contained.
    • Added include directories to properties
    • Added lib directories to properties
    • Added the following additional dependencies under Linker->Input->Additional Dependencies:
      • opengl32.lib
        glu32.lib
        fltkgl.lib
        FLTKD.LIB
        WSOCK32.LIB
        gltools.lib
    • Yay! My test (Dprintf) is compiling and linking. Onward!
    • Added the following to the “Ignore Specific Libraries”
      • msvcrt.lib
        LIBCMT.lib
    • Done with the debug version of the library, need to verify that it works, then do the release version.

1:00 – 4:00 VISIBILITY

  • Demo – 2, actually. It went well, though we do need to add a ‘loading’ screen to the main project screen. It hung for an awkwardly long time.

Phil 3.12.12

8:00 – 1:00 FP

  • DST == sleeeeeeepy
  • Class from 10:00 – 12:00
  • Going to start converting the hand to the new framework. I need to put some of these parts in a library.
  • Cool thing for the day: http://vimeo.com/36579366

1:00 – 4:00 VISIBILITY

  • Demo prep. Need to build a spreadsheet that has projects and timelines on them. Have a “most recent issue” column. Maybe a “number of times underbudget”  and “number of times late” columns as well
  • The demo is now tomorrow at 2:00, though Dukes will not be there. So it looks like we will have an additional meeting/demo.
  • Spent some time walking Sherry P through VISIBILITY and created an account for her on fgmdev Viztool

Phil 3.8.12

7:30 – 11:00 VISIBILITY

  • Demo prep. See Mike’s notes for more detail

11:00 – 4:00 FP

  • Now that I have the pick matrix worked out, I’m going to see how to ask the pipeline if any pixels have been drawn. Also need to see how to prevent the test drawing from going to the render buffer
  • Generating query indices and deleting them in cleanup()
  • Added a pickRender()  and pickResult() method to DrawableObject
  • Picking works, but seems to slow down the display. Also, GL_QUERY_RESULT_AVAILABLE always returns zero, even if there is a result. And just to make things a little weirder, the call glGetQueryObjectiv(drawQuery, GL_QUERY_RESULT_AVAILABLE, &result) does not slow down the display, but the following almost identical call glGetQueryObjectiv(drawQuery, GL_QUERY_RESULT, &result) does. No ideas about this right now.

 

Here’s the code in question

static enum TRANSFORM_MODE{UNAVAILABLE, HIT, MISS};
TRANSFORM_MODE pickResult(){
	GLint result;

	glGetQueryObjectiv(drawQuery, GL_QUERY_RESULT_AVAILABLE, &result);
	if(result == 0)
		return UNAVAILABLE; // always returns this

	glGetQueryObjectiv(drawQuery, GL_QUERY_RESULT, &result); // slows down rendering once called.
	if(result)
		return HIT;
	else
		return MISS;
};

Phil 3.7.12

8:00 – 12:00 visibility

  • Spent the morning putting together a demo walkthrough for tomorrow. We build an ‘enhanced’ data set that would support a lot of queries and started to use it to prepare a slideshow. Got through two slides until we discovered that slides weren’t loading properly.
  • The help for Project Assistant is a bit overwhelming. There needs to be some kind of overview and quickstart.
  • There are some issues on Project Assistant that need to be worked.
    • The help on the main screen and the dialog aren’t the same, and don’t look like buttons.
    • The app does not resize when the browser window resizes. It holds onto it’s original size, regardless.
  • Data Navigator’s ‘browser tab title’ is showing up as ‘#’ again.
  • It is possible to save two desktops with identical names

12:00 – 5:30FP

  • My FB account got hacked! Had to spend some time changing passwords and telling people to ignore my ‘hi ERROR!’ message. No idea how that could have happened…
  • Got the projection matrix set up for picking. Here’s how you do it:
void Gl_ShaderWindow::setPickMatrix(GLdouble x, GLdouble y, GLdouble deltax, GLdouble deltay, GLint viewport[4])
 {
	projectionMatrix.PushMatrix();
	if (deltax <= 0 || deltay <= 0) {
 		return;
 	}
	projectionMatrix.LoadIdentity();
	/* Translate and scale the picked region to the entire window */
 	projectionMatrix.Translate((viewport[2] - 2 * (x - viewport[0])) / deltax, (viewport[3] - 2 * (y - viewport[1])) / deltay, 0);
 	projectionMatrix.Scale(viewport[2] / deltax, viewport[3] / deltay, 1.0);
	projectionMatrix.MultMatrix(viewFrustum.GetProjectionMatrix());
 }

 

Phil 3.6.12

8:00 – 3:30 FP

  • Uniform Buffer Objects! Whee!
    • Urk: “Any type consuming N bytes in a buffer begins on an N byte boundary within that buffer. That means that standard GLSL types such as int, float, and bool (which are all defined to be 32-bit or four-byte quantities) begin on multiples of four bytes. A vector of these types of length two always begins on a 2N byte boundary. For example, that means a vec2, which is eight bytes long in memory, always starts on an eight-byte boundary. Three- and four-element vectors always start on a 4N byte boundary; so vec3 and vec4 types start on 16-byte boundaries. Each member of an array of scalar or vector types (ints or vec3s, for example) always start boundaries defined by these same rules, but rounded up to the alignment of a vec4. In particular, this means that arrays of anything but vec4 (and Nx4 matrices) won’t be tightly packed, but instead there will be a gap between each of the elements. Matrices are essentially treated like short arrays of vectors, and arrays of matrices are treated like very long arrays of vectors. Finally, structures and arrays of structures have additional packing requirements; the whole structure starts on the boundary required by its largest member, rounded up to the size of a vec4.
    • Need to write up a class that handles shared objects. Should be a variant on the dictionary pattern
      • DataElement class includes name, type, size, etc
      • UniformBlock class
        • Defines the name of the Uniform Block
        • Makes sure that there is room for this block, and the binding
          glGetIntegerv(GL_MAX_UNIFORM_BUFFERS)
          glGetIntegerv(GL_MAX_UNIFORM_BUFFER_BINDINGS)
        • allocates the memory
        • gets the block index
          glGetUniformBlockIndex(GLuint program, const GLchar * uniformBlockName);
        •  returns pointers to data
        • handles the writes into memory
        • bind to the shader program (I think)
          void glUniformBlockBinding(GLuint program, GLuint uniformBlockIndex, GLuint uniformBlockBinding);
  • Advanced Geometry Management (Chapter 12)
    • Queries (picking, hopefully)
      • Questions in OpenGL are represented by query objects, and much like any other object in OpenGL, query objects must be reserved, or generated. To do this, call glGenQueries, passing it the number of queries you want to reserve and the address of a variable (or array) where you would like the names of the query objects to be placed:
        void glGenQueries(GLsizei n, GLuint *ids)
        Gluint myQueries[10];
        glGenQueries(10, myQueries);
        for(int i = 0; i < 10; ++i){
            if(myQueries[i] == 0)
                // throw an error
        }
        // run queries
        glBeginQuery(GL_ANY_SAMPLES_PASSED, myQueries);
        glEndQuery(GL_ANY_SAMPLES_PASSED);
        
        // usually this should be available immediately, but be careful to handle the case if it isn't
        glGetQueryObjectuiv(myQueries[0], GL_QUERY_RESULT_AVAILABLE, &result);
        if(result == GL_TRUE)
            glGetQueryObjectuiv(myQueries[0], GL_QUERY_RESULT, &result);
        // do something based on the result
        // then when done...
        glDeleteQueries(10, myQueries); // free up space for more queries
      • So the way picking would seem to work would be to set the viewport so that it’s slightly larger than the cursor, then render bounding boxes (using glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE)) inside a loop of questions, then read back (and wait for) the results of the question. If the object is visible in the small FOV, then we can regard it as picked.
        • Setting up picking:
          	GLint viewport[4];
          	float ratio;
          
          	glSelectBuffer(BUFSIZE,selectBuf);
          
          	glGetIntegerv(GL_VIEWPORT,viewport);
          
          	glRenderMode(GL_SELECT);
          
          	glInitNames();
          
          	glMatrixMode(GL_PROJECTION);
          	glPushMatrix();
          	glLoadIdentity();
          
          	gluPickMatrix(cursorX,viewport[3]-cursorY,5,5,viewport);
          	ratio = (viewport[2]+0.0) / viewport[3];
          	gluPerspective(45,ratio,0.1,1000);
          	glMatrixMode(GL_MODELVIEW);
        • The source for gluPerspective() is here
      • Another way of doing picking – http://www.gpucomputing.net/sites/default/files/110606_picking_1.pdf