August 26th, 2008
I just published the immediate mode user interface (IMGUI) toolkit that we are using in our latest OpenGL SDK examples.
The purpose of the SDK examples is to show how to implement certain techniques using OpenGL. We did not want to spend too much time writing UI code, and we did not want the UI code to end up occupying more space than the code dedicated to the technique we are trying to showcase. IMGUI allowed us to accomplish these goals in an elegant way.
Here’s a simple example with two widgets:
ui.begin();
ui.beginGroup(nv::GroupFlags_GrowDownFromLeft);
static bool showButton = false;
ui.doCheckButton(none, "Show exit button", &showButton);
if (showButton) {
if (ui.doButton(none, "Quit")) exit(0);
}
ui.endGroup();
ui.end();
And this is what the result looks like:

One of the nice things is that, since the UI is being rendered in immediate mode, it’s very easy to create/modify widgets dynamically. For example, this is what happens when the check box is activated:

You can get the whole source code at the nvidia-widgets google project, and feel free to drop by the Molly Rocket IMGUI forums to share your feedback!
Posted in General | No Comments »
August 25th, 2008
My better half has been accepted to UC Davis, and we’ll be moving there in the next few days. We are pretty excited; I think Davis will be a better place to raise our son. It’s also closer to the Sierra, so I’ll have the chance to spend more time in the backcountry.
Posted in General | 1 Comment »
July 30th, 2008
Google Code is pretty awesome. I just noticed that they added support for code reviews and code annotations. Sweet!
Posted in General | No Comments »
March 1st, 2008
I had to switch the blog to the standard template, because apparently our server received some attacks due to my custom php code. OMG I hate that white background. I’ll hopefully switch to black soon…
Posted in General | 1 Comment »
March 1st, 2008
Intel and AMD have both released programming documentation for their hardware:
http://intellinuxgraphics.org/documentation.html
http://ati.amd.com/developer/open_gpu_documentation.html
The documentation from Intel is extremely detailed. The 965 chipset may suck performance-wise, but it has some interesting features. On one side it seems that it was designed with DX10 in mind; it supports geometry shaders, but on the other it does not support BC4-5 texture formats. Instead of these DX10-required formats it has a weird block compression format that encodes 8×4 texels in a single block.
Another interesting feature is that it support different modes of operation. Instructions can operate on AOS or SOA data structures, the former is generally used for vertex and geometry shaders, and the latter in fragment shaders. In AOS mode you can have one or two 4-element vectors processed in parallel, while in SOA mode you can have 8 or 16 scalars. What I don’t understand is why the maximum SIMD width is different in these two modes.
It isn’t clear to me either why AOS is the preferred mode for vertex processing. Are vertex shaders more divergent than fragment shaders? Is there any advantage in transposing the vertex attributes after vertex processing?
Posted in General | No Comments »
December 4th, 2007
I’d like to remap my keyboard so that I’m forced to use both hands to type shortcuts like Ctrl+Letter and Alt+Letter. That means the left side of the keyboard should only work with the right modifiers, and the right side should only work with the left modifiers. Ideally I should get a beep whenever I try to use the wrong combination. Does anybody know of how to achieve that?
Posted in General | 4 Comments »
November 16th, 2007
I’ve been fighting against the noise of my PC without any success. I’m supposed to have a super silent CPU fan, a silent power supply, and a sonata case that’s supposed to be pretty good too. It doesn’t matter, it still makes an awful lot of noise. So, I finally gave up, and bought these bose headphones with noise cancellation. Best purchase ever! They are pretty expensive, but I got them on ebay in mint condition for a 70% of the original price, and you can easily find them cheaper if you look for it. The only issue is that now I don’t hear the baby cry at night…
Posted in General | 7 Comments »
October 31st, 2007
This evening there was a magnitude 5.6 earthquake. I’ve never felt something like that before, the noise was tremendous, the ground shacked, and the entire house trembled. Nachito looked at me as if asking: “Dad, what’s happening?”. I was paralyzed, and had no idea what was going on. I thought it was a plane crashing nearby, but when the shacking diminished I realized it was just an earthquake. I finally reacted, and grabbed Nachito. In a few seconds the noise was gone too, and everything was back to normal.
Apparently earthquakes like that happen very often around here, but I was shocked! The experience made me realize that I had no clue about what to do in that situation. I’ve heard people talk about “survival kits” and “evacuation plans”, and I thought: WTF? but the danger of an earthquake never felt so real before!
Posted in General | 1 Comment »
October 24th, 2007
NVIDIA has launched its yearly developer survey. Filling it out is very useful for the Developer Tools, and Developer Technology groups to decide how to prioritize their tasks. So, I’d like to encourage you to do it, specially if you think that the new Texture Tools are useful, and you would like to see more open source tools like that. If you agree with me, please spend a couple of minutes, and send us your feedback!
Posted in General | 2 Comments »
September 28th, 2007
According to the doctor I have an inflammation of the pleura. I’ve been having mild pain for the last two weeks, sometimes it becomes moderate and feels like a sharp nail crossing my lungs under my ribs. Apparently the cause is a viral infection that I got from Nachito. It’s amazing how easy it’s to get sick when you have a child.
Posted in General | 3 Comments »
September 22nd, 2007
Here’s finally portable function to detect whether the debugger is present that works on all the platforms that I care about:
bool isDebuggerPresent()
{
bool result = false;
#if NV_OS_WIN32
HINSTANCE kern_lib = LoadLibraryEx( "kernel32.dll", NULL, 0 );
if( kern_lib ) {
FARPROC lIsDebuggerPresent = GetProcAddress( kern_lib, "IsDebuggerPresent" );
if( lIsDebuggerPresent && lIsDebuggerPresent() ) {
result = true;
}
FreeLibrary( kern_lib );
}
#elif NV_OS_DARWIN
int mib[4];
struct kinfo_proc info;
size_t size;
mib[0] = CTL_KERN;
mib[1] = KERN_PROC;
mib[2] = KERN_PROC_PID;
mib[3] = getpid();
size = sizeof(info);
info.kp_proc.p_flag = 0;
sysctl(mib,4,&info,&size,NULL,0);
result = ((info.kp_proc.p_flag & P_TRACED) == P_TRACED);
#elif NV_OS_LINUX
// if ppid != sid, some process spawned our app, probably a debugger.
//result = getsid(getpid()) != getppid();
char s[256];
snprintf(s, 256, "/proc/%d/cmdline", getppid());
FILE * fp = fopen(s, "r");
if (fp != NULL) {
fread(s, 256, 1, fp);
fclose(fp);
result = (0 == strncmp(s, "gdb", 3));
}
#endif
return result;
}
Checking the sid of the pid against the ppid, as I used to do, does not work in many cases. For example, it fails when running the app from a file manager such as konqueror. The better solution that I came up with is actually borrowed from Qt. It does not work with any debugger, but I just use gdb, so I don’t care. If you use a different debugger, just replace “gdb” by the corresponding command.
I use this function in the debug versions of my apps to break into the debugger when you hit an assertion, instead of throwing an exception, writing a stack trace, and exiting gracefully.
Posted in General | 3 Comments »
August 26th, 2007
Posted in General | 3 Comments »