My Final OpenGL Project: ChessGL3d
- March 6th, 2010
- Write comment
I recently discovered after some needless frustration, that you need to declare display lists that contain model drawing information in all windows in which you wish to draw the model. For example, if I say:
glutSetWindow(main_window);
initDisplayLists();
...
void main_display()
{
drawDisplayList();
}
It will work just fine. But if I try to do the same in a display function of the sub window it won’t draw. You need to call whatever init() function you create your models / display lists in AFTER setting the window. For example
glutSetWindow(main_window);
// do stuff
glutSetWindow(sub_window);
initDisplayLists();
...
void sub_display()
{
drawDisplayList();
}
Hope that helps someone out there!
So I came across a problem with WPF and context menus. Whenever I added a context menu to a right click on a window or panel it would simple not open. The only time that a context menu would appear is when I right clicked on a button or label that was a child of the panel I added it to. I searched everywhere online for a solution and couldn’t find one. Finally, I figured it out myself. For some strange reason, a context menu will not appear if you to not manually set a background color for a component or child component. So to fix the problem, simple set a background color for which components you want the top level context menu to appear.
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.
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.
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.
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
sudo apt-get install freeglut3-dev
# include <GL/gl.h> # include <GL/glu.h> # include <GL/glut.h>
gcc -o simple simple.c -lGL -lglut -lGLU
Mac OS X (tested on Snow Leopard)
# include <OpenGL/gl.h> # include <OpenGL/glu.h> # include <GLUT/glut.h>
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
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.