6

I have been doing some light OpenGL programming for a couple of months and now I want to write a screensaver using the xscreensaver library.

I saw How to develop linux screen saver before asking this but I think that particular question is not specific enough.

What I have done already-

  1. I downloaded the xscreensaver source and read README.hacking. I am fooling around with the code for greynetic.c(one of the screensavers jwz suggested for understanding xscreensaver in the readme) in the source's hacks directory.

  2. I read this webpage - http://www.dis.uniroma1.it/~liberato/screensaver/simplesquares.html (from one of the answers of the linked question). And I downloaded the simplesquares.c code and I'm trying to run it.

What my problem is-

  1. I don't understand how I should go about compiling and executing any changes I make to any of the screensavers.
  2. Compiling the previously mentioned simplesquares.c with gcc and running the executable shows no output at all. Am I doing something wrong?

Note: You have to add -lX11 to the gcc command in order to link the X11 library when compiling simplesquares.c Otherwise it will return undefined reference errors.

Edit:

On compiling the screensaver greynetic.c, it returns a few errors, some of which i have reproduced here:

greynetic.c:(.text+0x4f): undefined reference to `XGetWindowAttributes'
greynetic.c:(.text+0xa6): undefined reference to `get_boolean_resource'
greynetic.c:(.text+0xd9): undefined reference to `get_pixel_resource'
greynetic.c:(.text+0x112): undefined reference to `get_pixel_resource'
greynetic.c:(.text+0x13e): undefined reference to `get_integer_resource'
greynetic.c:(.text+0x185): undefined reference to `XCreateGC'
greynetic.c:(.text+0x1dd): undefined reference to `XCreatePixmapFromBitmapData'

This is probably a linking error.

Community
  • 1
  • 1
Chaitanya Nettem
  • 1,209
  • 2
  • 23
  • 45
  • 2
    I see that a couple of people have voted to have this question closed as 'not a real question'. The reason I think this is so is: The initial question is quite broad and its difficult to know *what* to answer. On the other hand, your bonus question seems more specific. Maybe you should give more details there. Looks like having it solved essentially answers your original question as well (i.e. how to get started), because it shows you how to compile an xscreensaver module and have it run correctly. – ArjunShankar Jul 27 '12 at 11:47
  • @ArjunShankar - Yes, the bonus question basically summarizes what i want. I changed the structure of the question and I hope the question is clearer. – Chaitanya Nettem Jul 27 '12 at 12:20
  • Did you look into the source code of some screensavers from your distribution??? – Basile Starynkevitch Jul 27 '12 at 17:05
  • I did in fact do that. As I mentioned in the question, the problem is to compile and run it. As far as i can tell, the screensavers are usually not invoked by the user. – Chaitanya Nettem Jul 27 '12 at 18:19
  • 1
    You can run your screensaver, each screensaver is executable, for example, after you compile you can just run `blaster` and a small 640x480 window will popup with the screensaver running in it – Jon Lin Jul 27 '12 at 18:25
  • 1
    Also, make sure you have done this, otherwise your stuff won't compile at all: **"Finally, edit the Makefile to add a rule for your program. Just cut-and-paste one of the existing rules."** – Jon Lin Jul 27 '12 at 18:27

0 Answers0