Thursday, March 16, 2006

Friday, March 10, 2006

Team Foundation Server

So Dave Bost gave a presentation on Team Server last night. It was pretty interesting; it was the first time I had really seen a Team System presentation that didn't focus on the different clients. He made it clear that he didn't want to discuss licensing, so I didn't ask the question that really was blazing through my head: why the heck do I and the thirty people in my company give a rip? Team System is for big people.

Anyway, Dave is the new developer evangelist for Indiana. It used to be Chris Mayo, but I guess he's moved on the other things. Dave, are you going to the Continuous Integration conference? Maybe I'll see you there!

There was also a semi-organizational meeting for a C# special interest group. I think that might be interesting, and we'll probably pull out the computers for the next one. A guy from the Advanced Visualization Lab was there too; their work might be relevant to some of the new 3D ultrasound machines that we're examining at Prosolv. Should be very interesting!

Wednesday, March 08, 2006

Volume texture DDS files

I had reason to try to create a Direct3D volume texture this week. This article gave instructions on how to do it, but I think it must have been out of date, because running the code they gave did not result in a DDS file that was loadable by the texture viewer. (I messed around with modifying the article, but then I had to register on the site, and blah blah blah) So I studied the header that was generated by the texture viewer, and eventually wrote this code:


#include <ddraw.h>
#include <fstream>
#include <D3d8types.h>

int main( int argc, char * argv[] ) {
if( !argv[1] || !strstr( argv[1], ".dds" ) ) {
fprintf( stderr, "Usage: noise output.dds\n" );
return 1;
}

DDSURFACEDESC2 desc;
memset( &desc, 0, sizeof(desc) );
desc.dwFlags = 0x00801007;
desc.dwSize = 124;

desc.dwDepth = 64;
desc.dwWidth = 128;
desc.dwHeight = 128;
desc.dwBackBufferCount = 64;
desc.ddsCaps.dwCaps = 0x00001002;
desc.ddsCaps.dwCaps2 = 0x00200000;
desc.dwFVF = 32;
desc.ddpfPixelFormat.dwSize = 0x20;
desc.ddpfPixelFormat.dwFlags = 0x41;
desc.ddpfPixelFormat.dwRGBBitCount = 0x20;

desc.ddpfPixelFormat.dwLuminanceBitCount = 0x20;
desc.ddpfPixelFormat.dwBumpBitCount = 0x20;
desc.ddpfPixelFormat.
dwPrivateFormatBitCount = 0x20;

desc.ddpfPixelFormat.dwRBitMask = 0x00ff0000;
desc.ddpfPixelFormat.dwGBitMask = 0x0000ff00;
desc.ddpfPixelFormat.dwBBitMask = 0x000000ff;
desc.ddpfPixelFormat.
dwRGBAlphaBitMask = 0xff000000;

unsigned int cnt =
desc.dwWidth*desc.dwHeight*desc.dwDepth*4;
unsigned char * buf = new unsigned char[ cnt ];
while( cnt-- ) {
buf[cnt] = rand()>>7;
}

std::ofstream ofst( argv[1] );
ofst << "DDS ";
ofst.write( (const char *)&desc, 124 );
ofst.write( (const char *)buf,
desc.dwWidth*desc.dwHeight*desc.dwDepth*4 );

return 0;
}


To be a really useful sample, I need to replace the flag values with constants...I need to figure out what they are, first, though!