Archive for the ‘graphics’ Category

Three-dimensional computer graphics architecture

Monday, February 6th, 2006

This is a pretty good survey paper:

Mitra, T. and Chiueh, T., “Three-Dimensional Computer Graphics Architecture”, Current Science, vol. 78, no. 2, pp. 838-846, 2000, http://www.iisc.ernet.in/currsci/apr102000/surveys2.pdf. (local copy)

Read the first two sections for an overview of the graphics pipeline with several details that we omitted in class (but most of which we will cover in detail later). Continue on if you’re interested in graphics hardware.

PyOpenGL

Saturday, February 4th, 2006

For an example of OpenGL bindings in another language, check out hello.py. This is a Python version of Example 1-2 from the OpenGL Programming Guide. Compare this to the C version you’re using for your homework — the language may be different, but OpenGL is the same.

OpenGL Bindings

Saturday, February 4th, 2006

Things have come a long way since the last time I went looking for OpenGL bindings. While scripting languages have always tended to have them (e.g., Perl, Python, Ruby, Lua, Io, even PHP — yikes!), bindings for “industrial-strength” languages have always seemed to lag behind.

Instead of the panoply of Java bindings that held sway in the early years, sanity finally seems to have taken hold in the form of semi-official JOGL project. Heck, they even have a JSR.

Over in the proprietary, closed-source, Windows-only, Microsoft-owned world of C# (can you tell I’m biased? And don’t tell me about CsGL (old and busted)

  • Tao (new hotness)
  • C# OpenGL Framework (commercial, but there is a “Basic” edition)
  • SharpGL
  • Roll your own
  • As with all things Lisp-y, OpenGL support is pretty fragmented. Whether there is an OpenGL binding, how well it works, and whether you get get any help if it doesn’t is largely dependent on which Lisp you’re using. You may be better off with Scheme, where the Sgl library for PLT Scheme appears to be officially supported.

    When it comes to getting all this set up, though, as I said earlier, you’re on your own.

    Win32 GLUT setup help

    Saturday, February 4th, 2006

    If we went too fast in lab Friday night, or if you’re finding that the instructions in the README file included with the Win32 GLUT distribution are insufficient, you may also want to check out these resources:

    If you’re not planning to do your programming in C or C++ or on Windows, that’s perfectly fine, but note two things:

    1. When you submit assignments, you need to document any build dependencies (i.e., libraries that you rely on)
    2. When it comes to getting your environment up and running, you’re on your own.

    RenderMan-compatible Renderers

    Sunday, May 29th, 2005

    PLY Format

    Monday, May 9th, 2005

    If you haven’t started writing the code to read object files, I recommend PLY format. I hadn’t noticed it, but the page I linked to already includes code to read PLY files. The PLY page at Georgia Tech also has code to convert OBJ files to PLY format.

    Static models

    Saturday, April 30th, 2005

    To help you get started on Assignment 5, click here for a C version of the cup object. If you want to try other models, you can download the Perl script.

    The Reshape Callback

    Wednesday, February 16th, 2005

    Ok, so I had to go back and re-read the documentation to get this working.

    The default reshape callback (the one you get if you don’t call glutReshapeFunc()) calls glViewport(0, 0, w, h) and doesn’t change the coordinate system. The default coordinate system (which won’t change unless you call gluOrtho2D()) has its origin in thelower left corner of the window.

    Unfortunately, the coordinate system used for the mouse position has its origin in the upper left corner. That means that if you don’t have a reshape callback, or if you call gluOrtho2d(0, w, 0, h);, you’ll end up with mouse coordinates that are the opposite of drawing coordinates. To fix that, you need to do one of two things:

    1. Subtract the mouse y-coordinate from the height of the window
    2. Change your drawing coordinate system to match the mouse coordinate system

    Luckily, option (2) also allows us to resize the window without stretching the drawing or moving it all over the screen. Use the following reshape callback:

    void reshape(int w, int h)
    {
        glViewport(0, 0, w, h);
        glMatrixMode(GL_PROJECTION);
        glLoadIdentity();
        gluOrtho2D(0, w, h, 0);
    }

    Don’t forget to register the callback in main() with glutReshapeFunc(reshape).

    Here’s what the function does:

    glViewport(0, 0, w, h);

    Specifies that the viewport rectangle should occupy the entire window. The default reshape callback does the same thing.

    glMatrixMode(GL_PROJECTION);

    We’re about to specify 2D Orthographic projection. The default matrix mode is GL_MODELVIEW, so we need to switch.

    glLoadIdentity();

    Clear any existing projection matrix

    gluOrtho2D(0, w, h, 0);

    Specify the left, right, bottom, and top clipping planes. Note that the bottom clipping plane is h, not 0.

    OpenGL and GLUT in Visual Studio .NET

    Wednesday, February 9th, 2005

    Donn Clark has found a tutorial with screenshots for building applications with OpenGL and GLUT in Visual Studio.NET. The tutorial says that it works with both the 2002 and 2003 versions, and if I recall correctly, the steps in older versions of Visual Studio (i.e. non-.NET) are largely the same.

    OpenGL Tutorial Site

    Sunday, February 6th, 2005

    Ok, this is really impressive: NeHe Productions has 48(!) OpenGL tutorials, including instructions for getting OpenGL up and running on Solaris and MacOS X. When you get there, note that if you scroll down to “Resources” in the left-hand column, you can download all the tutorials as a single file.