Thursday, May 28, 2009

Using opengl, glut, and cg with Visual Studio

These pages describe the process (the first one is out of date, but the changes to directory structure are minor):

OpenGL and GLUT
Cg

In case those pages go away, it boils down to this:

GLUT

  • Get GLUT for Win32

  • Copy...


    • glut32.dll to %WinDir%\System

    • glut32.lib to $(VSDir)\VC\lib

    • glut.h to $(VSDir)\include\GL


  • ...where $(VSDir) is something like C:\Program Files\Microsoft Visual Studio 9.0\VC


Cg


Visual Studio

  • Make a new Win32 Console Application project: File->New Project->Visual C++->Win32->Win32 Console Application

    • In the "Application Settings" page of the wizard, make sure Application type is Console Application and Empty project (under Additional options) is checked.

  • Go to Project->(project name) Settings


    • Set Configuration to All Configurations

    • Expand Configuration Properties

    • In C/C++->General, add $(CG_INC_PATH) to Additional Include Directories

    • In Linker->General, add $(CG_LIB_PATH) to Additional Library Directories

    • In Linker->Input, add opengl32.lib glu32.lib glut32.lib cg.lib cgGL.lib to Additional Dependencies


Friday, May 22, 2009

Changing vertex processing inside glBegin()/glEnd()

It appears you CAN NOT change shaders in the middle of a glBegin()/glEnd() block. That is, the following code will not switch between vert_main and vert_shadow:

glBegin(GL_TRIANGLE_STRIP); {
for (int v = 0; v < 4; v ++) { cgGLBindProgram(vert_main); glVertex3fv(VERTS[FACES[f][v]].xyz); cgGLBindProgram(vert_shadow); glVertex3fv(VERTS[FACES[f][v]].xyz); } } glEnd();


Looks like I *should* have seen this in the documentation: "Only a subset of GL commands can be used between glBegin and glEnd."

OS X as guest under Linux?

Here I will chronicle some attempts to run OS X as a guest OS on Linux.

My preference would be to use Sun's VirtualBox, since it looks pretty slick and is free. First, looks like I'll need an iso. Not sure if this requires special changes to the iso, or if a straight rip from a legit disk will work. I'm going to look for an iso online for now.

Ubuntu on Mac hardware info
https://help.ubuntu.com/community/MacBookAir1-1/Intrepid?action=show&redirect=Macbook_Air

Qemu
An interesting other note: someone on Ubuntu forums claims to have it working with Qemu, although there is no proof or additional info:

"I have a running OS X on Qemulator (Qemu+KQemu)

qemu -M pc -hda /home/juancarlospaco/OSX -soundhw ac97 -m 1024 -cdrom /home/juancarlospaco/10.5.5/10.5.5.iso -net nic,vlan=0 -net user,vlan=0,hostname=OSX -boot d"

stay tuned...