Where to start with screeensaver developing for XBMC?
#1
Question 
Hi everybody,
I'm new in this forum and also developing for xbmc.

I would like to develop a screen-saver, something easy, something like the slide show of images.

Could someone tell me how can I start? which documents do I have to read? which examples should I review? If there is a template to develop. Huh

Any help or comment will be welcome.

thanks in advance. Nod
Reply
#2
actually the builtins are horrid examples. atm we have very few screensavers - the rsxs based ones for linux only from the looks of it.
Reply
#3
Thanks, but there is a mail list or something where I can ask from the first beginning how to start to program/develop a new screensaver, addon, or any other module for xbmc
Reply
#4
I'm also interested in developing a new slideshow.
Reply
#5
unfortunately it's to a large extent monkey see, monkey do (i.e. you have to read it from sources). the interface is given in xbmc/addons/ScreenSaver.h/cpp and xbmc/addons/include/xbmc_scr*.h

the rsxs ones are the only example as i said, see xbmc/screensavers/rsxs-0.9/src/euphoria/euphoria.cc for instance.

finally you have the add-on definition bits, see addons/screensaver.rsxs.euphoria/addon.xml
Reply
#6
@eyes
I have the same question. Did you ever come across any good resources?
Reply
#7
Same question, where to start?
I want just simple text screensaver with quotes loaded from forismatic.com API.
Reply
#8
spiff Wrote:unfortunately it's to a large extent monkey see, monkey do (i.e. you have to read it from sources). the interface is given in xbmc/addons/ScreenSaver.h/cpp and xbmc/addons/include/xbmc_scr*.h

the rsxs ones are the only example as i said, see xbmc/screensavers/rsxs-0.9/src/euphoria/euphoria.cc for instance.l

I've been going down this path with some progress, but it's slow. My short-term objective is to produce a minimal screensaver with source and documentation that we can all use as a starting point. At the moment, I have code compiling, loading, and running but it doesn't do anything yet except clear the screen to a solid color.

As a test case, I'm using the small classic gears example from the OpenGL docs.

My current problem is that I don't know what OpenGL state I'm allowed to mess with and what I need to save/restore so I don't mess up XBMC. If I run the gears init() function without changes, then when my screensaver stops I'm left with a black screen. XBMC is functional and responds to the keyboard, but it can't draw its GUI. Any quick answers about how to leave things in a state that XBMC needs would be appreciated.
Reply
#9
Can you give a link to the code you're trying to port?
Reply
#10
bobo1on1 Wrote:Can you give a link to the code you're trying to port?

The code is gears.c here: http://www.opengl.org/resources/code/sam...demos.html

Since I've made further progress, let me go into some more detail--

In Start(), I'm doing this:
Code:
glPushAttrib(GL_ALL_ATTRIB_BITS);
init(); // copied from gears.c; calls gear(...) also from gears.c
This sets some OpenGL state and builds the display lists for the three gear objects.

In Render():
Code:
updateAngle(); // my own small function to make the gears rotate

glMatrixMode(GL_PROJECTION);
glPushMatrix();
glLoadIdentity();
glFrustum( ... );
glMatrixMode(GL_MODELVIEW);
glPushMatrix();
glLoadIdentity();
glTranslatef(0.0, 0.0, -40.0);

draw(); // from gears.c, but glutSwapBuffers() changed to glFlush()

glMatrixMode(GL_PROJECTION);
glPopMatrix();
glMatrixMode(GL_MODELVIEW);
glPopMatrix();
And in Stop():
Code:
glPopAttrib();

This actually works (yay!), but leaves some nagging questions:

If I don't include the glPushAttrib() and glPopAttrib() calls, then when the screensaver is stopped, XBMC shows only black screens. It responds to keyboard & mouse, so isn't hung, but its ability to show anything is messed up.

But doing glPushAttrib() in Start() and glPopAttrib() in Stop() seems risky. Assume XBMC someday does:
Code:
glPushAttrib( ... );
pScreensaver->Start();
glPopAttrib();
Then things can get weird. In other words, I'm not guaranteed that
Code:
Start();
while (...) Render();
Stop();
isn't interleaved with XBMC's own calls to change OpenGL state, push/pop attributes, etc.

On the other hand, pushing all the attributes, setting them the way I need them, drawing my screen, and popping all the attributes every time that Render() is called would be nice to avoid if it isn't necessary. In fact, I think that popping all the attributes would release by display lists, and setting those up really should only have to happen once.

But if the rule is that the OpenGL state upon each entry to Render() is arbitrary and must always be set up completely each time, then that would be good to know and document.

A similar but less intrusive questions comes with the projection and modelview matrices. Even if my screensaver is running, I notice that XBMC changes these matrices between calling Start() and calling Render(). At the very least whatever it's doing seems unnecessary since the screensaver occupies the entire screen.

Any input appreciated.
Reply
#11
could you post the actual files you've got a working version from so we can have a look? I'd like to have a go at getting something better working too...

have you managed to get it installing as an add-on too?
Reply
#12
Ah, any reason why Xbmc can't launch system installed screen savers? I presume this is a legacy area as the Xbox lacked screen savers?

Building and porting screen savers for xbmc is a little excessive when there are plenty of working screensavers out there.

Anyway to replicate the behaviour in python and xbmc.service? Say have a python service in the background that detects inactivity after a user configurable time and runs a user specified (or windows registered) screensaver? That would open up possibilities.
Reply
#13
I will be donating once this functionality is added.
Reply
#14
I'm sure its now possible via a plugin with this commit.
https://github.com/xbmc/xbmc/commit/c163...7d055620b3

We listen for the broadcast and start or kill the screensaver as necessary. Ideally xbmc screensaver should be set to blank to keep cpu usage to a minimum. I'm gona see how far I get with this to get electricsheep working.
Reply
#15
Dito to this request, I wanted to find some info on creating a screen-saver for XBMC.

I wanted to see if I could knock up something which did the same as this one by Tristan Schmelcher for Ubuntu.

http://randomtristan.blogspot.co.uk/2012...lasma.html
https://github.com/TristanSchmelcher/plasmacleaner

It just mimicks the simple tool found on some Plasma TV's designed to remove image-retention.
It's just a black screen with a 1/3 horizonal white bar which very slowly scrolls over the screen so should be pretty simple to do if I can get a hook into the basics of creating a saver.
Reply

Logout Mark Read Team Forum Stats Members Help
Where to start with screeensaver developing for XBMC?0