As we left off the last installment, we were just about capable to open up a window, and draw some basic things in it by giving coordinate lists to the command renderPrimitive. The programs we built suffered under a couple of very infringing and ugly restraints when we wrote them - for one, they weren’t really very modularized. The code would have been much clearer had we farmed out important subtasks on other modules. For another, we never even considered the fact that some manipulations would not necessarily be good to do on the entire picture.
To deal with the first problem, let’s break apart our program a little bit, forming several more or less independent code files linked together to form a whole.
First off, HelloWorld.hs - containing a very generic program skeleton. We will use our module Bindings to setup everything else we might need, and tie them to the callbacks.
Since the content rate of haskell-related posts is going up, the feed of this blog will get added to Planet Haskell. Hi, Planet!
After having failed following the googled tutorial in HOpenGL programming, I thought I’d write down the steps I actually can get to work in a tutorial-like fashion. It may be a good idea to read this in parallell to the tutorial linked, since Panitz actually brings a lot of good explanations, even though his syntax isn’t up to speed with the latest HOpenGL at all points.
First of all, we’ll want to load the OpenGL libraries, throw up a window, and generally get to grips with what needs to be done to get a program running at all.
main = do
(progname, _) <- getArgsAndInitialize
createWindow "Hello World"
mainLoop
This code throws up a window, with a given title. Nothing more happens, though. This is the skeleton that we’ll be building on to. Save it to HelloWorld.hs and compile it by running
ghc -package GLUT HelloWorld.hs -o HelloWorld
I haven’t really been updating much here - and especially not the category Weekly Report. Slowly, it’s time to get around to it.
Now, there is a specific reason updates have been slow: I’ve been travelling. A lot. With very varying internet access and even more varying energy to spare for writing. It all started with two weeks of vacation in Sweden - spending time with my lovely fiancee, meeting old friends, and generally relaxing. She proposed (of sorts), and we’re getting married next summer. After the vacation, I went to Leeds, to the Triangulated Categories workshop, and then back home to Jena - only to go off again within just over a week, for the First Copenhagen Topology Conference, tightly followed by a master’s class in Morse theory lead by Ralph Cohen, and a simultaneous workshop on Morse theory and string topology.
So, we’re back at the point where I’m hesitating whether what I tried to work out even made sense or not. So I’ll do a write up of all the things I feel certain about asserting, and ask my loyal readership to hunt my errors for me.
Don’t laugh. This is less embarrassing for me than asking my advisor point blank.
We say that a (graded) commutative ring R has depth k if we can find a sequence of elements
with
not a zero-divisor, each
not a zero-divisor in the quotient
and
a ring without non-zero divisors. This definition, of course, being the first obvious point where I may have screwed up.
Now, we know (from looking it up in Atiyah-MacDonald), that for SR the localisation of R in a multiplicatively closed subset S, S(R/I)=SR/SI, that injections carry over to injections, and that the annihilator over SR of an element is the localisation of the annihilator of the element.