Thursday, August 26, 2010

compiling opengl-redbook examples on Lucid guest

[UPDATE]

Rats! Turns out that any video setting or reboot gets confused with the nvidia driver present -- even though it isn't set, it doesn't play nice with the virtualbox driver... convinces it there is no 3D present and runs it in software (dirt slow). I eventually uninstalled it... maybe it's freeglut, but not sure. Needs more research. Later.

------------

I'm starting a class this fall in computer graphics and I thought I'd experiment with trying to compile some of the examples in the redbook. I have to wait for our class copies of VisualStudio (our course is taught targeting Windows), but I wanted to try some things, so I decided to use my Lucid Lynx Ubuntu 10.04 instance to compile examples.

First off, VirtualBox rocks. You have to hand it to the team because their 3D acceleration is strictly super-awesome... it lets me run full compiz settings while running on a i7 920 GTX 260 equipped Windows 7 host. It's fast! Like pretty close to native fast. So fast that I simply use ubuntu in VM mode instead of dual-booting. (Actually, I pretty much like everything about Windows 7 too, except maybe the filesystem changes, but there are more tools available for Linux, so it helps to have the best of both worlds.) Make sure 3D acceleration is enabled in your vm before you start; I also used the max setting of 128 MB VRAM. Anyway, back to the story...

Once in the guest OS, I downloaded the samples via apt-get, installed the usual libs... in this case the ones suggested here. Like the poster I tried the shipped makefile at first and got:

$ make
make: *** No rule to make target `$@.o', needed by `hello'. Stop.


Ug. I suspect some dialect of gnu make doesn't like that variable name or syntax, but gave up trying to understand it too much (yeah, lazy) and switched to the suggested longhand:

$ g++ hello.c -lGL -lGLU -lglut -o hello

Success! Then I ran it:

$ ./hello
OpenGL Warning: XGetVisualInfo returned 0 visuals for 0x24c10a0

Segmentation fault


Ug. Not what I wanted. Did some poking around and found that "nVidia and ATI "driver" installs on linux *replace* -lGL and -lGLU default Mesa installations with their own." So on a lark I tried

$ sudo apt-get install nvidia-glx-185-dev

And it worked like a charm!!


That's kind of obvious (because the VirtualBox 3D is supposed to be as clean a passthru as possible) but also kind of amazing (because the ubuntu guest is setup to use the virtualbox driver, not the nvidia 185 driver for ubuntu) -- it just worked... at least for this sample! :)

Enjoy!

Saturday, August 7, 2010

DRM should live in the document, not the device

I started taking a closer look at Kindle. A new semester is starting up and I noticed that several of the optional textbooks for the course are available on Amazon in Kindle format, so I was interested in seeing what the format could do.

Here's what I found:

  • If you are writing academic papers you can't cite Kindle versions very well. My suggestion to the Kindle development team is to expose "Locations" as standard URIs instead of the current proprietary bookmarks that only work on Kindle. URIs would be sharable and documentable and thus fit better with existing citation standards for electronic sources.

  • If you are using Kindle for PC, and you have a programming book with source code samples, you can't copy/paste the samples from the app to your editor. It's very ironic that you have to retype in code snippets when you're reading an ebook on your pc.

  • If you have a book and a friend asks you about it, a very common social case is to say "oh, here, you can borrow it, I'm not reading it right now" -- you can't do this with the Kindle because the DRM is in the device, not the document. I have to loan my entire library (and the Kindle too) in order to satisfy this use case. For this reason, I'm beginning to think that DRM (document rights management) should live in the doc, and merely enforce uniqueness and have nothing to do with "rights" or licenses per se.
I know the suits will be shocked at this idea: "but but, we were going to get all this money from individual sales forced on the customers!" -- no, I don't think you would. I think people will simply shrug and say "sorry, can't loan you the book, but you can buy your own" and then people will either say "ok", or "never mind".

However as books move to this new medium, I realize that the concept of a "library" simply doesn't work with DRM in the device. You can't loan licenses in the current model. Of course, the publishers again want to water at the trough of infinite profits -- but I think the reality will be far worse -- libraries will simply dry up and there will be little in electronic initiative to replace them.

Open formats may fill a little of the gap, but right now this is limited to academic papers and a handful of independent authors... it's hardly enough to keep libraries working... furthermore, open formats don't really encourage a library (except maybe digitally speaking) because you can just make copies of them.

If DRM lived in the doc, I could buy it, I could share it, but I couldn't copy it. If my friend had it, I wouldn't have it. This satisfies the "scarcity" requirement of the publishing industry (without scarcity, there is no value for books or any media).

But somewhere along the way, DRM became about "licenses" tied to devices. So I can't share, I can't own, but everyone can buy their own copies. Of course, the consumer market says "hey, well in that case, I don't use that book all the time, it's not worth the same price" -- and publishers are again shocked that consumers don't want to pay for ebooks at only 20% off.

Even the OReilly subscription model is hard to stomach at $300-400/yr for access to their entire library. I've paid a huge amount, but at the end of the year, I own nothing. It's really hard to see any value in that arrangement unless I'm constantly using 10 books every day, and even then... I can't share them with any colleagues. Then again, at $50-$100 per computer graphics book and factoring that such technology books are obsolete within a couple years on average -- after a certain point, subscriptions do look "cheaper"... but it's still pretty expensive from my perspective.


I ended up buying physical copies.