Skip to content
Jan 24 10

How To: Dual Monitors in Ubuntu with Nvidia

by Dan

I noticed that a lot of people are getting “cannot parse xorg.conf” message when they try to set up dual monitors with Nvidia settings manager in ubuntu. Here is the solution.

On the command line:

sudo nvidia-xconfig

You should see it tell you that it overrode your xorg.conf. If you get warnings don’t worry, it’s likely just indicating that there was a previous problem. Then on the command line again, type this:

sudo nvidia-settings

Now setup your dual monitor or triple monitor configuration as you want (with Twin View and the correct orientation). Then hit save configuration at the bottom and you should see that you get no error.

Reboot and enjoy.

Jan 24 10

Change Default Grub Settings In Ubuntu

by Dan

I was surprised to see how wrong the entries on the Internet were about changing the default OS that grub boots into. Here are the correct instructions for how to do this (it has been tested on ubuntu 9.10).

sudo gedit /etc/default/grub

Then change the GRUB_DEFAULT=0 line to the number that you want to boot. i.e. if you are trying to boot into the 5 entry in the grub bootloader, put 5. You can also change the number of second grub will wait before booting using GRUB_TIMEOUT.

Then you need to update grub:

sudo update-grub

If you see something like this, congrats! You did it!

Generating grub.cfg ...
Found linux image: /boot/vmlinuz-2.6.31-17-generic
Found initrd image: /boot/initrd.img-2.6.31-17-generic
Found linux image: /boot/vmlinuz-2.6.31-14-generic
Found initrd image: /boot/initrd.img-2.6.31-14-generic
Found memtest86+ image: /boot/memtest86+.bin
Found Windows 7 (loader) on /dev/sda1
done

Reboot to see the changes.

Jan 16 10

New Material

by Dan

Recently switched around my courses and I plan to post a game as my final project from my interactive computer graphics class. For now here is my first screenshots from my first open gl programs. Pretty straightforward stuff but I thought it’d be worth while to post for posterity.


My First OpenGL Program (assignment)


My First Original OpenGL Program (not sure what the lines are supposed to be)

Jan 16 10

Compiling OpenGL on Mac OS X or Linux

by Dan

Most linux distributions make it easy to compile programs using OpenGL. Other systems, however, aren’t so easy. Here are instructions on how to get it running in both platforms.

Ubuntu / Linux

  1. Make sure you install the opengl-mesa packages for opengl development. On ubuntu you can get them all with the following invocation:
    sudo apt-get install freeglut3-dev
  2. You should include the following #includes in your code referencing opengl:
    #  include <GL/gl.h>
    #  include <GL/glu.h>
    #  include <GL/glut.h>
  3. You should also have the following gcc cmdline flags in your makefile:
    gcc -o simple simple.c -lGL -lglut -lGLU

Mac OS X (tested on Snow Leopard)

  1. For this to work you will have to install gcc and Xcode, which should install all the required opengl/glut libraries. You can get it here.
  2. Now, you’ll have to alter all the #includes in your files to conform to the proper location. Change all your opengl #includes to the following:
    #  include <OpenGL/gl.h>
    #  include <OpenGL/glu.h>
    #  include <GLUT/glut.h>
  3. Additionally your gcc command line will need to contain the following flags to link, along with any others you might have:
    gcc -o simple simple.c -framework Carbon -framework OpenGL -framework GLUT

Cross Platform Compatibility

If you want your code to run on both, you need to get the Makefile and code to load the proper libraries depending on your system.

In all your OpenGL .c files, add the following header instead of your linux/mac includes:

#ifdef __APPLE__
#  include <OpenGL/gl.h>
#  include <OpenGL/glu.h>
#  include <GLUT/glut.h>
#else
#  include <GL/gl.h>
#  include <GL/glu.h>
#  include <GL/glut.h>
#endif

Then in your makefile, add the following before your build targets:

#default cmdline flags
LDFLAGS	= -lGL -lglut -lGLU
# Mac OS alternate cmdline link options
ifeq "$(OSTYPE)" "Darwin"
	LDFLAGS	= -framework Carbon -framework OpenGL -framework GLUT
endif
Jan 7 10

Series Renamer

by Dan

I have been trying to gain access to an amazing application I recently came across. It’s know as Series Renamer and is a windows app that makes renaming and organizing your TV video files amazingly easy. If you are in the process of ripping your DVD collection then this makes the hassle of renaming all of those files as simple as selecting the correct show and episode.

I have contacted the project owner about helping out. It’ll be the first public open source project I’ve ever participated in.

Series Renamer Site