Author Topic: 4k libs and linux  (Read 3775 times)

0 Members and 1 Guest are viewing this topic.

Offline steeni

  • ZX 81
  • *
  • Posts: 2
  • Karma: 0
    • View Profile
4k libs and linux
« on: March 27, 2012 »
Hi everyone,

I'm new here and and have no experience of demos. I'm exited about 4k and now I'm planning to implement something small on my spare time as a hobby.

I have understood that no particular libraries can be assumed to be found in the machine that is running the demo. Everything should be in the 4k executable, Am I right? If I'm writing a project that uses OpenGL can I statically link it into executable and still get it all fit into 4k? I'm going to work in linux environment and don't have a clue of what to use for audio. Any suggestions, pointers and tutorials for 4k demo in linux environment are greatly appreciated.

Thanks, steeni

Offline Raizor

  • Founder Member
  • Pentium
  • ********
  • Posts: 1154
  • Karma: 175
    • View Profile
Re: 4k libs and linux
« Reply #1 on: March 27, 2012 »
Hi Steeni,

I've no experience with demo coding on Linux, but this Pouet thread seems to have some info that might be useful for you.
raizor

Challenge Trophies Won:

Offline hellfire

  • Sponsor
  • Pentium
  • *******
  • Posts: 1294
  • Karma: 466
    • View Profile
    • my stuff
Re: 4k libs and linux
« Reply #2 on: March 28, 2012 »
I have understood that no particular libraries can be assumed to be found in the machine that is running the demo.
Everything should be in the 4k executable, Am I right?
It's very convinient for the user if your intro runs straight out of the box without the need to install additional packages.
This way you have to do everything on your own, though.
For example creating your window with x11 calls instead of a simple "SDL_SetVideoMode" - which requires noticably more size.

Quote
If I'm writing a project that uses OpenGL can I statically link it into executable and still get it all fit into 4k?
OpenGL is a shared lib and most of the functionality is inside the driver anyway, so there's not much to include into the binary.

Quote
I'm going to work in linux environment and don't have a clue of what to use for audio.
I had admittedly quite a lot of "what the fuck?!" moments when porting my windows sound stuff over to linux.
At the end I was quite happy with alsa, though.
You can simply register a callback function using "snd_async_add_pcm_handler". The kernel then calls your function whenever more audio data is needed.
So you usually won't even need a thread - or even a buffer.
« Last Edit: March 28, 2012 by hellfire »
Challenge Trophies Won:

Offline steeni

  • ZX 81
  • *
  • Posts: 2
  • Karma: 0
    • View Profile
Re: 4k libs and linux
« Reply #3 on: March 30, 2012 »
Thanks for all the tips. I found some useful info. Most important lesson for me was to understand how long journey I have to go before I can think of writing any sort of demo. By reading some pouet topics I found out that some people use SDL (and some takes it also quite religiously). I see the point in using SDL but for now I'm going to do everything as low level as I can. Somehow high level apis would take the fun(and the whole point) out of it (IMHO).

BTW, I don't care about the window. I just want to output to the display. So I did some googling about running opengl without X. It's possible but in the end X is easier. Doing it without X requires some other libs anyway.. I also found this useful http://www.pouet.net/topic.php?which=7014&page=1

At this point I do not have a project yet. I just wanted to narrow down the technologies I want to use. I think I will use alsa for sound (the way hellfire suggested) and OpenGL as directly as I can (without any helper libs like GLUT or SDL). Thanks again for your insight. I will get back here when I get something pulled together and/or have more questions :)


BR, steeni