soledad penadés
repeat 4[fd 100 rt 90]

Archive for the ‘opengl’ Category

20060503 The making of "tube"/xplsv

tube screenshot

Getting the right music, and the right inspiration

Some years ago, in the almost already forgotten summer of 2003, trace sent me a test of a song he was making. If I remember properly, it was called B04.IT, and featured the characteristic samples one can get using fuzzion's 4k synth. Actually, it reminded me a lot to the music of "insert coin", by fuzzion & threepixels. I think trace did the song for using it in another intro, but it was forgotten.

And some months later he passed me again the song but it was B05.IT then and it had more stuff - almost finished! It had passed through sml's and wizard's ears too. This time I really liked the song and thought that I wanted to do something with it, although I didn't know yet what exactly. So I just converted it to mp3, copied it to the ipod and let it appear whenever the random mode decided. One day while I was in a Circle Line train, entering Moorgate station, the song was playing and I had something like a vision, when I saw the platforms along with the signs, the sensation of movement that fitted with the song and its somehow agressive feeling… and I decided that I would do something related with the tube!

Then almost a whole year was spent developing something to be able to do the demo, as I switched to mac, and also wanted to do demos in a more decent/cleaner way that I was doing until that moment. And finally as I got the tickets for Breakpoint06, I decided that I definitely would do the tube demo for BP06, as I knew that it would rock big time to see it on the bigscreen.

At the beginning I thought of alternating 3d scenes with the 2d animations that I was going to put in there, but since I didn't manage to get a decent port to opengl of neonv2's graphics engine, I just set apart that idea and concentrated on getting the best animations I could get.

How to record in the tube (without looking suspicious)

That part was really funny. I borrowed trace's camera, which is way more discreet than mine, and the 1GB memory stick he got for his PSP, and just headed towards the tube on a nice sunday evening.

Why I chose sunday and not any other day of the week as it would have been more representative of the real stress of the daily commuting it's relatively simple: when there's so many people you would have seen only the first row of people and maybe think that I was taking pictures in a protest march. So that's why it just shows half empty trains and stations.

With that camera it was relatively easy to take pictures as it is quite small and doesn't do any noise when switching it on (in contrast to mine!). So most of the time I just walked as if I was going to take a train, with the camera in my hand - and recording it all!

I also wanted to be discreet not because of the passengers, but because of some news I had heard about people being arrested and their camera confiscated just when they were shooting pictures in tube stations. Just in case they were evil terrorists and were getting information of how the station was. For destroying it according to the plans. You know!

The worst of all was when recording the final part, which is actually how the Central Line trains enter Bank from Liverpool Street. I had to redo that one like three times because it didn't got recorded properly. Either bad angle, not looking good enough (the train stopping at the entering and somehow destroying the speed sensation, etc). So I had to change to the opposite direction and turn back to Liverpool Street again, and cross the fingers so nobody in the control room could notice a girl dressed with a blue electric jacket entering three times the station, and taking the train of the opposite platform three times too.

Imagine if they had asked me:

- What are you doing?
- oh just recording some movies for breakpoint 06 demo compo
- a compo!! it doesn't sound right! it sounds violent
- errrrr….

I also arrived until the ultramodern Canary Wharf station (where some movie was shot, if I'm not wrong) and took lots of pictures there, but they didn't fit at all in the demo. Apart from the "severe delays" pictures, everything else got discarded as it wasn't dynamic enough. It was so empty on a Sunday!! One can't appreciate any movement sensation if there's no reference point, like people, etc. Oh and it was so damn cold in Canary Wharf! I had to put my hat on while taking pictures of the outside…

Most of the moving images are from Victoria and Westminster stations. I missed lots of footage video as I thought that I was recording but actually I hadn't pressed properly the button. So novice!

Locations - for the map/tube addicts

Tube locations
So finally my travel consisted in:

  • Victoria - Westminster (with the District line)
  • Westminster - Canary Wharf (Jubilee Line)
  • Canary Wharf - London Bridge (Jubilee Line)
  • London Bridge - Bank (Northern Line)
  • Bank - Liverpool Street, and Liverpool Street - Bank, three times (Central Line)
  • Bank - Oxford Circus (Central Line)
  • Oxford Circus - Victoria (Victoria Line)

and not it didn't cost me much money since I just went out the tube itself in Canary Wharf for taking pictures of the skyscrappers :)

Coding horror

Then we have the nightmare the day before the party. I had let until the last moment the step of doing a final test in my pc. (I developed it in mac as I said). Horror happens and it happens more specifically the night before, when tired and almost aslept you get to test your demo in trace's laptop and then discover that everything turns white. ARGH!!!!!!!!! It wasn't even a black screen, it was all completely white. I just said ok … I'm going to release it in the wild compo, I don't care if they don't accept mac entries in the demo compo, I want to sleep. And I absolutely did.

I suppose a real coder would have stayed all night trying to find out which was the bug but as I'm not a real coder I just let the pillow give me some advice. Of course, the next morning I hadn't thought of any solution for the bug yet. I even didn't find anything until for some reason I ran the demo in fullscreen in my mac and WTF!!! it was WHITE!! What was happening there?

Well it was actually quite stupid. I did some very basic filters, reading from the current framebuffer and manipulating the data. But just some filters used one code I saw in one page which said: glRead(GL_FRONT);

I simply had sticked it in my code without noticing any performance difference, so I just let it be there. Buuuuuut that was a very bad and irresponsible idea! Depending on the graphic drivers, the FRONT buffer had something - or not. In my old pc it didn't make a difference, but in trace's it made everything go white. And I don't know why, I hadn't tested the faulty filters in full screen in my mac. Maybe in fullscreen the opengl gets like a different context or something like that (I don't have any clue, I must recognize), and that's why it showed different results when running in a window or in fullscreen.

I proceeded to remove that code from every place where it appeared and voila! it was working perfectly fullscreen on mac! Then Corsario/tlotb offered to help me to compile a win32 version - and hence release the demo in the demo compo.

Forget libc

I used visual studio 6 in my old pc. It worked pretty well - apart from thousands of warnings from the STL, of course. But Corsario had Visual Studio 2003 and Visual Studio 2005. He said it should be ok. Of course, it wasn't. There was some kind of funky incompatibility with the headers that my project included and what MSVS2003 decided that was ok. Basicly they had deprecated (and removed) libc!

But Corsario managed to identify which of the libraries introduced the libc dependency and replaced it with a compatible and appropiate (for VS) header. And oh it worked quite well! :)

The remaining was simply a question of putting the nice layers that trace gave me in a more or less meaningful order, and syncronize things a bit. Also, trace convinced wizard to do another pattern for the song so it could get a bit more polished. So we had another star in our team!! :D
As you see, it's very easy to do a demo! You should do one too!

20060403 I know what killed the demoscene

Yes, I do! Really!
You know what?

MSN Messenger and other instant messaging applications + bored people = scene is dead.

I'm following iq's wise philosophy lately and I'm not connecting to MSN at all these days. Just checking the e-mail each 2 hours or more (if I remember to do so), and using my time more efficiently, without being annoyed by people which ignore the BUSY status, etc.

Also there's just approximately 11 days left to Breakpoint! Suddenly, good fortune came back to my life and I managed to compile my code in windows and run the demo I'm preparing for the party. Looks like it's going to bring loads of fun.

And now… back to xcode in a quiet, non-interrupted environment ;-)

20060212 Tripping down the memory lane

It's quite amazing how one can forget all the basics by working with abstractions. More specificly… I had been creating a series of auxiliary classes for using them in my demos, so I didn't have to think of gluLookAt's and similar, and concentrate instead in specifying cameras in human terms, like, look to that point, etc.

The problem arises when I look at what did exactly each class and how it interacts with OpenGL - I just can realise how much I have forgotten about everything. Did OpenGL setup a default projection matrix? Which values did it have? Did I need to push that projection matrix and load an identity one? And what about the modelview matrix? Why can't I do a decent particle billboarding even looking at three tutorials and finally even copying the same code that works?

I am trying to avoid the kind of particles which appeared on vslpx [mov video], i.e., not properly oriented. But no matter what I do in regards to the projection or modelview matrix, the supposedly billboarded particles always appear like if they had a mind of their own, putting their front face wherever they decide to, and obviously not being perpendicular to the camera's Look vector, and I feel a bit lost >_<

Luckily it is raining so it might be time for taking advantage of the bad weather and stay home while guessing how my not-engine worked ;)

20060207 Blue Tuesday final version

Blue Tuesday

We have finished this demonstration a year and some months late but… who cares? Now featuring Mac Os X version (as well as the win32 one), as well as a new scene and lots of improvements here and there. Grab Blue Tuesday final version!

If you just can't see it, try the video version :) (Quicktime file, H264 compression, 400×300 pixels) - although nothing compares with the 1024×768 pixels size of the realtime version. Should you have a decent opengl card, go for the first one…

I hope you have a very great and blue tuesday :)

20051122 Salsa Scener X: Empezar en la escena programando

Me ha llegado un mail hace un rato de un (por ahora) anónimo scener que quiere empezar a hacer alguna demo (cómo motiva eso de los tatuajes), pero no sabe si empezar con C/C++ o ActionScript, y además tiene un portátil no muy potente.

Y como creo que es una buena ocasión para dar un par de consejos útiles y que no se pierdan en el éter de los foros de escena.org, he decidido hacer a este mail el protagonista de esta semana ;)

Lo primero, no hace falta un ordenador con demasiada capacidad de proceso para empezar a hacer algo. Al fin y al cabo, la demoscene se trata de explotar al máximo los recursos de la máquina, ¿no? Yo estuve mucho tiempo haciendo pruebecillas con opengl en un pequeño pentium II a 350Mhz, con una tarjeta gráfica de 4 megas (una ati no recuerdo qué modelo). Por supuesto, iban lentas de narices, pero puedes ir aprendiendo conceptos con ello. De hecho, hasta hicimos un pequeño juego de asteroides (que presentamos a una práctica voluntaria de la universidad, todo sea dicho) y también un paseo por una escena 3D que mostraba objetos generados por revolución. Todo esto funcionaba en aquel bicho, así que empezar, se puede empezar, con opengl o directX (aunque yo de directX no tengo mucha idea, lo siento).

Otra posibilidad sería darle al rollo oldskool. Por "antiguo" que sea tu portátil, seguro que puedes hacer cosas con tinyptc. Tinyptc es una librería que permite acceder a un buffer en memoria de manera directa. ¿Para qué? Pues para emular el funcionamiento de las antiguas demos de msdos que (a grandes rasgos) para pintar los píxeles escribían directamente en memoria de video. Esto no se puede realizar directamente con windows (te daría un error de QuéEstasHaciendoChaval!!!), así que la librería hace de intermediario entre windows y tus demos. De esta manera, puedes aplicar muchos tutoriales de antaño, de una forma mucho más sencilla que con opengl/directx.

La pena es que sea un portátil, ya que un ordenador de sobremesa suele poderse actualizar cambiando la tarjeta gráfica por una mejor -siempre que la placa base sea más o menos decentilla-. Yo misma actualicé el mío, poniéndole una geforce 440 baratilla, como comenté por aquí, y los resultados no eran nada despreciables, consiguiendo ejecutar muchas demos bastante recientes.

Sobre actionscript, es incluso peor que intentar programar directX o opengl, ya que no se compila, sino que se interpreta cada vez. Así que no se ejecuta directamente sobre la máquina, sino sobre el player de flash. Lo bueno que tiene, es que es mucho más manejable que C. No tienes errores de punteros, ni tienes que reservar memoria. Al ser amigable puedes ir haciendo tus pinitos en gráficos, especialmente con la última versión de flash, la 8, que tiene cosas maravillosas como un putpixel, y cosas así, que no estaban en capítulos anteriores y paraban mucho si querías hacer algo decente. Sobre esto trace ha hablado alguna vez en su blog, ya que está bastante interesado en flash, incluso está tratando de hacer un engine 3D en flash.

También está la posibilidad de utilizar Macromedia Director, que tiene un acceso mejor a la tarjeta gráfica de que dispongas, y permite que lo que se dibuje, se acelere por hardware si la tarjeta así lo permite. También permite jugar bastante con blendings y demás, según tengo entendido, así que se le pueden sacar bastantes resultados.

Finalmente, si como dices el portátil es poco potente, no sé si lo habrás visto, pero hay un par de dvd's de demos descargables, titulados demo or die. Más información en el blog de trace, otra vez.

Si alguien tiene cualquier idea, sugerencia o aportación, no tiene más que ponerla por aquí.

Hale, a pasarlo bien aprendiendo :)