Write your own Einstein@home screensaver |
Message boards : Cruncher's Corner : Write your own Einstein@home screensaver
| Author | Message |
|---|---|
|
A nice advantage of the "separate graphics" Apps is that the computation is completely independent of the graphics, which are now a separate program instead of a thread. Nothing that happens to the graphics (error, crash, etc.) could affect the computation, and the graphics code doesn't even have to be linked (in a technical sense) to the rest of the program.
All the values (%f) are floats. The sky position is given in rad. Future Apps will pass additional information:
The information contained in the XML may be extended in the future (e.g. on request) - that's why we chose XML. A lot of data you probably want to show is passed to the App from the BOINC Core Client in a file init_data.xml. You could use BOINC functions to read and parse it: Call boinc_parse_init_data_file() once at the beginning of your program, then boinc_get_init_data(/*APP_INIT_DATA*/ app_init_data) will get you a copy of the BOINC-internal APP_INIT_DATA structure in your variable app_init_data. The full definition of APP_INIT_DATA is in boinc/lib/app_ipc.h, it lists things like user- and teamname, total credit and RAC for host and user account etc., but also some technical stuff like the path to the project and slot directories on your disk. A GLUT-based OpenGL event-loop is provided by BOINC as boinc_graphics_loop(argc,argv). When using this it will take care of the command-line parsing (i.e. "--fullscreen" disticntion), termination in fullscreen mode etc. Some documentation can be found in the BOINC Wiki at http://boinc.berkeley.edu/trac/wiki/GraphicsApi . The current Einstein@home starsphere uses this loop, but mainly because it's the way things were done previously and it required only minimal changes to the code. For new implementations I'd rather drop GLUT, partly because it's incompatible with the "virtual root window"-concept of xscreensaver. I'd use SDL or some other portable library to manage windows and interaction for OpenGL graphics. You could use DirectX, too, but then your graphics program is limited to MS Windows. All the current S5R3 "separate graphics Apps" 4.25-4.27 come with an app_info.xml. To let your graphics program run with BOINC, place the program in the project directory and replace the einstein_S5R3_*_graphics_* entry in app_info.xml with your program filename (and restart the client). If all goes well, pressing "Show graphics" in the manager will fire up the graphics in a window, and the BOINC Screensaver will start it in fullscreen mode. I intend to publish the Einstein@home starsphere sourcecode as an example soon. Looking forward to hearing from you! BM | |
| ID: 80410 | | |
|
Now this sounds cool!! | |
| ID: 80415 | | |
I think a nice extension to the XML interface would be a filename & path to a file containing all the current toplist candidates, so basically the checkpointing file, but probably a copy of it that is refreshed less frequently to so that the graphics and checkpointing is decoupled and would not interfere with each other. One info contained in the APP_INIT_DATA is the slot directory the App is running in which contains the checkpoint file (*.cpt). You could make a copy of it for your own use periodically. I'd recommend to use boinc_copy() from the BOINC library for this (see boinc/lib/filesys.h), it will take care of platform dependencies (e.g. retry when the file is locked by the App or a virus scanner on Windows). You could keep the copy in the slot directory, it is cleaned up by the client once the task exits. Oh, and actually also the graphics program should be started from the slot, i.e. will have the slot directory with the checkpoint file as CWD. So using "./" for the files should be fine. We have one guy at the AEI Hannover who started working on passing the info (XML and APP_INIT_DATA) over the network, i.e. the "graphics program" is a server which the actual graphics program could connect to also from a remote machine. BM | |
| ID: 80418 | | |
you could interface E@H with other program, like Starry night or Stellarium, as was proposed in teh "Wish List" sub-forum several times, e.g. here. That's a pretty good point I didn't even think about before. Any volunteers? BM | |
| ID: 80421 | | |
|
This sounds really cool. Pity I suck at graphics programming ;-) but I'm curious what the cracks can do. Success to all of you who try! | |
| ID: 80423 | | |
I intend to publish the Einstein@home starsphere sourcecode as an example soon. Here it is: The sourcecode starsphere.zip and some libraries (JpegLib and freeglut) precompiled for an easier build on Windows: win_adds.zip. The Windows build should work with Visual Studio Pro 2003 and 2005; I don't think BOINC currently compiles with VS 2008 (though the files affected may not be needed for the graphics build). As for the Express editions I doubt that they will work with this setup, though someone might be able to publish a project file for this. Shouldn't be hard to collect the necessary information from the batch file. BM | |
| ID: 80444 | | |
|
More information on how to make and test screen saver graphics, can be read on Eric Myers' BOINC Developers' Notes - Graphics site. | |
| ID: 80452 | | |
More information on how to make and test screen saver graphics, can be read on Eric Myers' BOINC Developers' Notes - Graphics site. Oh, he updated it for v6? ____________ Please use "reply to this post" instead of "reply to this thread" . See Threads | |
| ID: 80463 | | |
Oh, he updated it for v6? The page was last updated in late January 2008. He lists an email address for corrections and improvement suggestions. It would appear he has every intention of keeping the page up to date. ____________ Cheers, Gary. | |
| ID: 80464 | | |
(void*)boinc_graphics_get_shmem("EinsteinHS") returns a pointer to a shared memory segment into which the main Einstein@home application writes a XML document describing its current status. Is it a null-terminated string? With the data being text, the length of individual fields can change, shifting off all the rest. There is a possible race condition: The science app updating the contents while the graphics app is halfway parsing it. For example, say the graphics app reads <cpu_time>, and then reads a 4-digit number. At this point, the science app updates the XML contents, and cpu_time ends up having a 5-digit number. If the graphics app continues reading at the byte offset it had left off, it would get /cpu_time> (note the lost open bracket). I don't know how you could do proper synchronization though... (hint: an "I'm currently updating" byte won't work) ____________ Please use "reply to this post" instead of "reply to this thread" . See Threads | |
| ID: 80465 | | |
(void*)boinc_graphics_get_shmem("EinsteinHS") returns a pointer to a shared memory segment into which the main Einstein@home application writes a XML document describing its current status. It is a null-terminated string. And yes, it's possible that the data or part of it is outdated. I wouldn't rely on the data for calculation, in particular not when the XML is malformed (one should really use an XML library for parsing, don't use the dirty hack of the example!), but for the graphics display it should be ok to throw a possible update away. An "I'm updating" byte would work if it's the first byte, wouldn't it? Filling the whole shmem with zeros before writing something in there should at least cause a XML parsing error when it has been incompletely written. Do you agree? BM | |
| ID: 80467 | | |
It is a null-terminated string. And yes, it's possible that the data or part of it is outdated. I wouldn't rely on the data for calculation, in particular not when the XML is malformed (one should really use an XML library for parsing, don't use the dirty hack of the example!), but for the graphics display it should be ok to throw a possible update away. Note BOINC uses dirty hacks instead of real XML parsers almost everywhere :( strstr(line, "<tag>") is not a valid substitute for an XML parser, is it? An "I'm updating" byte would work if it's the first byte, wouldn't it? If the science app sets the byte starts updating between the graphics app reading the byte and starting parsing. ie: graphics app reads byte and it's 0, science app sets byte to 1 and updates XML, graphics app starts parsing since the byte was 0. Re-reading the "is it updating" byte before parsing each tag may not work either due to compiler optimizations, it could notice you're just reading the same thing repeatedly and optimize out all but one read. Filling the whole shmem with zeros before writing something in there should at least cause a XML parsing error when it has been incompletely written. I don't think it can be done really safe without using proper locking facilities from the OS. In theory, the graphics app could remain preempted during both the zero-filling and the useful-writing... Of course some could call that a "worst case", but if it's possible, the race condition is there. Using a binary format with fixed-size fields wouldn't solve the race condition, but the consequence would be reduced to having half the data updated and half not at some point; the data would never become "unreadable" (as it is with invalid XML). ____________ Please use "reply to this post" instead of "reply to this thread" . See Threads | |
| ID: 80476 | | |
|
Hmm wait, a possible simple solution: add a checksum somewhere. If the checksum doesn't match, read the whole thing again. | |
| ID: 80477 | | |
Hmm wait, a possible simple solution: add a checksum somewhere. If the checksum doesn't match, read the whole thing again. Hi! So maybe it's a good idea to split the buffer into n slots of fixed length, update slots in a cyclic manner and include a checksum AND sequence number in the messages in the slots. Most of the time, even for n=2, at most one message will be corrupted because of a race condition. A special indicator (say first byte of the buffer) can indicate the front end of the cyclic buffer to make things easier. ____________ ![]() ![]() | |
| ID: 80482 | | |
So maybe it's a good idea to split the buffer into n slots of fixed length, update slots in a cyclic manner and include a checksum AND sequence number in the messages in the slots. I thought of that too. However, now I have found some interesting stuff about mutexes, which would give *proper* locking... Apparently, I'd just need to do a wrapper around pthreads or Windows API to use mutexes (just like BOINC currently wraps shared memory functionality). I'll try to write some code doing that, later; I'm currently busy on something else (coincidentally, writing a screensaver for another project!). ____________ Please use "reply to this post" instead of "reply to this thread" . See Threads | |
| ID: 80483 | | |
... Re-reading the "is it updating" byte before parsing each tag may not work either due to compiler optimizations, it could notice you're just reading the same thing repeatedly and optimize out all but one read. ... Well at least in C/C++ is keyword volatile. Directly from C/C++ reference:"The volatile keyword is an implementation-dependent modifier, used when declaring variables, which prevents the compiler from optimizing those variables. Volatile should be used with variables whose value can change in unexpected ways (i.e. through an interrupt), which could conflict with optimizations that the compiler might perform." Might be a solution fvor this way. But other ways can be more efficient or more stable than this one. | |
| ID: 80491 | | |
|
Mutexes are the proper way to do this. But they introduce some complexity that just for passing a bit of information just for the graphics looks like a bit of overkill to me. I'd rather wanted to keep things as simple as possible for the graphics hackers. It doesn't really matter to throw an update away or if one information gets passed and is displayed wrong for a fraction of a second. With the data curently communicated the worst thing that could actually happen is that some of the data is one update older than ome other part. With the data currently passed I don't see how that could do any harm worse than missing an update. | |
| ID: 80499 | | |
Mutexes are the proper way to do this. But they introduce some complexity that just for passing a bit of information just for the graphics looks like a bit of overkill to me. I'd rather wanted to keep things as simple as possible for the graphics hackers. It doesn't really matter to throw an update away or if one information gets passed and is displayed wrong for a fraction of a second. With the data curently communicated the worst thing that could actually happen is that some of the data is one update older than ome other part. With the data currently passed I don't see how that could do any harm worse than missing an update. My idea was giving the "graphics hackers" some code that would handle shared memory, mutexes, and even the XML parsing for them. Just give out the data. ____________ Please use "reply to this post" instead of "reply to this thread" . See Threads | |
| ID: 80504 | | |
|
I'm downloading an update to Xcode for the Mac so I can try compiling things. Boinc says to have Xcode 2.4 or higher. It seems like getting the starsphere programs compiled should be a good little project. Getting all the correct libs will probably take a little work though since I have never worked with the Boinc framework before. Should be interesting to try. | |
| ID: 80511 | | |
(How to get, compile and link the BOINC library is out of the scope of this description): Ah, well ... it seems alot of the gory bits is in that part. :-) That is, to establish & destroy a graphics context ( canvas ) for OpenGL to have a crack at rendering upon. This part is rather platform dependent, and I'd appreciate any pointers/hints/corrections/suggestions/criticism if available. My research seems to indicate: - find the BOINC 'graphics_2' or similarly named *.h and *.lib for the relevant platform. Wandering around here seems to be fruitful. - ditto for the glut stuff ( gl.h glu.h glut.h ) - grab the 32 bit lib for Windoze say, plus any other platform appropriate libs. - you'd want to declare/include/link the above in a sensible/traditional fashion to the *.c / *.h files enacting 'main' and the interface callbacks etc ..... as per Mr Myers. - sensibly name your product executable. Put it in the right directory ie. BOINC's. - edit the app_info.xml to inform your installation of that executable ( exit & restart Boinc ... ) [ That is I'd like to try the OpenGL + GLUT + BOINC_graphics_API approach ] I'd like to create a template for my own artistic efforts ( cough, cough .... ) and if successful let the basic code ( +/- platform variants ) on the loose for others to substitute their own . As usual I'll be hopelessly optimistic of success in my efforts .... :-) Cheers, Mike. ____________ "I have made this letter longer than usual, because I lack the time to make it short." - Blaise Pascal | |
| ID: 84755 | | |
|
Hi Mike,
| |
| ID: 84757 | | |
Hi Mike, You the man! I will indeed hold fire and eagerly await. This is terrific. :-) It is/was my stumbling block, and probably has averted others too. OpenGL seems to be, dare I say, fairly intuitive ( state machine etc .. ) and seems to require 'only' a modicum of skill to flip around with it. I've got the "OpenGL Programming Guide" 5th Ed by the board that designed it. I've been boring through that and have roughed out a 'solar system plan' with an 'orbiting viewpoint/platform' visualisation of it + elements linking to the current task state. I'll have to be careful not to overchug the graphics engine though .... :-) [ standard famous last words .... ] Again thanks. Cheers, Mike. ( edit ) and I'll go and find out what a doxygen is ... ( edit ) Ah. 'Source code documentation generator tool' - nice one. ____________ "I have made this letter longer than usual, because I lack the time to make it short." - Blaise Pascal | |
| ID: 84758 | | |
|
Finally our new framework for BOINC graphics is ready for release! This should make it much easier to build an own Einstein@home graphics application, as it encapsulates all the communication with BOINC or the science App. It still requires programming the actual graphics, though. | |
| ID: 94737 | | |
|
I have no clue of writing programs for anything dealing with computers. Besides, I don't have an artistic ability. Good luck to everyone that tries and, hopefully, succeeds. As for myself, I think I will wait to see what comes out of this good spirited contest and then choose from what is offered. | |
| ID: 94775 | | |
|
Hi | |
| ID: 94835 | | |
|
Hi Romain, | |
| ID: 94861 | | |
|
Update: I pushed a workaround (tested on Debian Lenny) into the framework repository. Please update your sources (via git or download) and try again. This workaround fixes the MinGW issue which was, by the way, not at all related to libxml2. Hopefully the MinGW project will fix their scripts accordingly... | |
| ID: 94870 | | |
|
Some notes as I go, which may be of interest to others. Maybe not. :-) | |
| ID: 94952 | | |
|
Funny, I'm developing under Suse Linux 11 as well, and I do get svn as an executable , not subversion. I've cvs and svn installed. | |
| ID: 94953 | | |
That's strange - even for Suse ;-) Interestingly Bikeman's installation doesn't expose that problem.
I intentionally used lex and yacc because they're the original "incarnations" of these tools. Of course they're usually replaced by flex and bison (also true for my system) but the distributions I know all put symlinks to lex and yacc in place (for backwards compatibility).
There is no preferred version as long as you use gcc 4.x. The reference in the build script only states what we use for the official build.
Yep, and a "./build.sh --distclean" cleans up everything again.
Sad but true. As all of the dependencies are downloaded automatically it may happen that sometimes they're simply not available :-/ But I think that's still better than relying on the user/developer to prep his/her system manually. In my experience sourceforge.net as well as the BOINC repository are the most unreliable sources...
Great! Please keep in mind that the build script came into existence to ease my local build process. Therefore there's much potential for improvements that make it more intelligent and robust. Of course I'm happy to accept your contributions (e.g. automake/autoconf) :-) Cheers, Oliver | |
| ID: 94954 | | |
That's the "download availability issue" once again. However, it never occurred that often when I built the screensavers the last couple of times...
That's an easy one: your system misses the libdirectfb-dev package (or similar on Suse, look which package contains directfb.h). I guess I have to revise the list of dependencies in the documentation as SDL requires a couple of development packages I obviously haven't yet mentioned. Best, Oliver | |
| ID: 94955 | | |
|
@ Oliver : Thank you, you've been very helpful. I'll look into all of that. :-) | |
| ID: 94968 | | |
|
Ok, got annoyed with the sound business. SUSE didn't have the required version for ESD ( >= 0.2.8 ), the sound driver. Nothing has been written for this distro that would satisfy the SDL build. Found the esd 0.2.8 package to compile with but my Suse isn't an accessible host/target for the script, written ~ 2004. which as far as I can tell eliminates all sound components. Then rebuild. Worked a treat for me, have done a --linux build with no problems. :-) :-) Oh, and the libdirectfb-dev came in just fine. Cheers, Mike. ( edit ) Of course this implies that one does not later do this : SDL_Init(SDL_INIT_AUDIO); and like sound functionality. ____________ "I have made this letter longer than usual, because I lack the time to make it short." - Blaise Pascal | |
| ID: 94982 | | |
|
Hi! | |
| ID: 94983 | | |
|
Here it is ... | |
| ID: 94984 | | |
|
Hi Mike and Bikeman!
Who uses Suse? Not me ;-) To be honest, Bernd and I discussed this a couple of months ago and I wanted to keep all of SDL's nice features in the framework because you just never know. There could be someone out there who comes up with a screensaver that makes use of audio (hopefully optional) or even a joystick. The build dependencies "only" affect potential developers after all because we use fully static builds...
Great!
As stated above, I'd like to keep this particular feature in "mainline" but we should certainly retain all "optional" patches in this thread. I think it would be even better to have some sort of a wiki for this kind of content (hm, will BOINC's upcoming Drupal CMS support that?)... If you are familiar with git you may of course clone our repository, make your personal changes and publish (e.g. at github) your repository - that's how distributed SCM works :-) Best, Oliver | |
| ID: 94985 | | |
|
Fair enough. I wasn't wanting to change the framework, I was just so pleased to localise my problem and get a successful build. :-) | |
| ID: 95003 | | |
|
Thinking out loud. :-) | |
| ID: 95039 | | |
|
This is fun! | |
| ID: 95357 | | |
This is fun! ...... Beautiful! I think it's precisely these sort of ideas that are being sought to include using the framework. Nice idea to 'paint' the pattern on, in real time, so to speak. I'm ( ambitiously ) working/designing a basic solar system model - to be inserted within the sphere's volume, while the sphere's radius size is pushed out to some large size. I think I'll keep the starfield but drop the constellation lines/connectors. Instead of rotating the sphere I'll shift the viewpoint ( which is equivalent really in OpenGL terms anyway ) - try some 'manoevring' using the keyboard, orbits etc. I'm also thinking of a decal-like pixellated picture/texture ( on the inner/distant celestial sphere in the background ) of that famous picture of Einstein poking this tongue out! :-) The resource coding assistance part of the framework will be invaluable for that. Cheers, Mike. ____________ "I have made this letter longer than usual, because I lack the time to make it short." - Blaise Pascal | |
| ID: 95359 | | |
. Wow!! That's far more complex than what I think I could do in a reasoable time span. I'm looking forward to see Albert Einstein's portrait in the screensaver, nice idea! CU Bikeman ____________ ![]() ![]() | |
| ID: 95374 | | |
|
OK, prototype seems to work under Linux: | |
| ID: 95453 | | |
|
Hi guys, <project_preferences> <graphics fps="25" quality="high" width="800" height="600"/> </project_preferences> Cheers, Oliver | |
| ID: 95473 | | |
Hi guys, Hmm... interesting. I'm testing on a remote desktop (vnc) and it would not work on "high" (graphics program just exits). I guess this is caused by a lack of feature support by the remote desktop server, but anyway, I wonder whether it might be useful to have an automativ fallback to lower settings if the gfx engine fails to init with high settings. CU Bikeman ____________ ![]() ![]() | |
| ID: 95487 | | |
That's interesting indeed and most likely caused by limited hardware support. Can you please have a look for warnings and error messages on STDERR (or its file redirects respectively)? Any hint? Does it work with "medium"? In fact, there already is minimum fallback support. The problem with an automatic fallback is that it's not always clear which feature request (size, depth, buffers, FSAA, etc.) caused the video mode request to fail. One would have to test all combinations separately, because SDL only allows you to set a video mode and test whether it worked afterwards - there's no such thing like an upfront capabilities check. Thanks, Oliver | |
| ID: 95495 | | |
Medium works, will check output this evening. CU Bikeman ____________ ![]() ![]() | |
| ID: 95507 | | |
I get this in stderr :
____________ ![]() ![]() | |
| ID: 95511 | | |
|
Now, I managed to compile the E@H screensaver under OS X "Leopard" with Xcode 3.1 , but only after setting the following environment variables:
All but the last line were borrowed from the science app build scripts, the last line avoided a strange build error I got in the install phase of the BOINC part of the build process. Anyway, works like a charm on my Core Duo Mac mini, except for "high" graphics mode again. This time the "screensaver" start up ok, but doesn't display most of the layers (only constellation and observatories), and is unresponsive to keyboard input. Go figure.. I have to do more debugging here, but at least up to "med" level eveything works pretty well on my mac mini now. CU Bikeman ____________ ![]() ![]() | |
| ID: 95560 | | |
|
Hi everyone, | |
| ID: 95561 | | |
|
Hi all! git clone git://git.aei.uni-hannover.de/shared/einsteinathome/graphicsframework.git then apply the patch using git apply starsphere_20090318.patch where starsphere_20090318.patch is the saved copy of the file downloaded above. You can ignore some warnings about whitespaces while performing the patch. Feedback is welcome, CU Bikeman ____________ ![]() ![]() | |
| ID: 95710 | | |
|
FYI, for all of you who make modifications/contributions to the official code base I suggest you publish your changes using public git repositories instead of supplying patches. It's much easier to track, try and integrate changes this way. That's what's so nice about distributed SCM in general and git in particular. | |
| ID: 95713 | | |
|
Hi Bikeman, ... but for those who want to have a look, here's a patch ... The link to your patch is broken (local URL)... Use a public repo ;-) Best, Oliver | |
| ID: 95715 | | |
Hi Bikeman, Uppps... cut and paste error. I've repaired the link for the time being, I'll set up a public git repo later. ____________ ![]() ![]() | |
| ID: 95716 | | |
Sweet! One minor thing: please omit the part of the patch that modifies build.sh, it's been obsolete since commit 38b320f9 (please update your repo). Update: please commit your changes in atomic, topic-based commits. This way people can then cherry-pick the changes they want and ignore others (e.g. the RA/DEC label change). Oliver | |
| ID: 95717 | | |
Done, but actually I liked the idea of specifying the exact revision/date of mingw (probably also boinc) to download in the build.sh, makes the build process much more reproducible and will avoid repetition of the problem where changes in the downloaded tools/libs will break the patches that are included in the starsphere repos. Just like it's done in the Einstein@Home build script for the apps wrt. LAL and BOINC. ____________ ![]() ![]() | |
| ID: 95718 | | |
Update: please commit your changes in atomic, topic-based commits. This way people can then cherry-pick the changes they want and ignore others (e.g. the RA/DEC label change). Yeah, unlike BOINC! :) ____________ Please use "reply to this post" instead of "reply to this thread" . See Threads | |
| ID: 95719 | | |
Done, but actually I liked the idea of specifying the exact revision/date of mingw (probably also boinc) to download in the build.sh, makes the build process much more reproducible and will avoid repetition of the problem where changes in the downloaded tools/libs will break the patches that are included in the starsphere repos. Just like it's done in the Einstein@Home build script for the apps wrt. LAL and BOINC. I agree with you as long as we're talking about projects that do have a working release/maintenance process :-) In general the GFX build script only uses fixed release tarballs or (even better) branches, hence only bug-fixes should be added to those branches which, in general, shouldn't break stuff. In case of BOINC and LAL the release processes have some considerable deficiencies which sometimes lead to problems unfortunately. However, using fixed date-based checkouts means that you don't get those bugfixes unless you monitor all 3rd party packages and update your build script on a regular basis. In addition to that, LAL is a very specific case and, as it isn't used by the GFX framework, we don't have to make provisions for correct/reproducible builds of it... WRT MinGW, the problems we've experienced over the past few weeks were either caused by internal issues of the MinGW project (using date tags wouldn't have prevented that) or by their preparations of the 1.0 xscripts release. As soon as that's done I'm going to use their release branch. By the way, the package versions of MinGW as such have been, in fact, constant all the time - we simply used fresh copies of the MinGW cross-compile harness (xscripts). Cheers, Oliver | |
| ID: 95720 | | |
|
Hi! | |
| ID: 95735 | | |
Just to be sure, what exactly did you do? Do you mean minimizing a given starsphere window or changing it from fullscreen to windowed mode? The latter action involves changing the mouse pointer's visibility setting (hide/show) but none of the actions mentioned above change its appearance... Strange... Update: I tried it myself using a Win XP Pro SP3 VM image, nothing unsusual though. However, I noticed that SDL seems to change/invert the mouse pointer's appearance as soon as one hovers the window's client area, but I don't see how this could be related to the issue you observed when minimizing the window. Oliver | |
| ID: 95751 | | |
The former. I've updated to SP3 now and will try again. EDIT: My modifications are now hosted here, as suggested by Oliver: http://wiki.github.com/Bikeman/eah_gfx_ext CU Bikeman ____________ ![]() ![]() | |
| ID: 95755 | | |
|
Hi folks! | |
| ID: 96965 | | |
Hi folks! Please explain me in what way this is related to "writing your own Einstein screensaver". ____________ Please use "reply to this post" instead of "reply to this thread" . See Threads | |
| ID: 96973 | | |
|
I'd also say that this is completely off-topic. To answer the question nevertheless, in the forum it's perfectly possible to post in cyrilic, see this message for example. | |
| ID: 96974 | | |
Hi folks! I explained it and gave some reasons for posting here, but I will try to be more simple: I“m affraid, there“s a bug error hidden in the code used for the profile webpage on E@H. Why? Well, in S@H I do not have this problem (the characters, fonts and links used for my profile in S@H are the same as for E@H: I just copied + pasted them). I thought maybe someone skilled on screensavers development and with a proficient level of encoding languages should be able to understand my issue. If the profile webpage, which can be edited with the simplest and basic elements by just common members, shows some bugs like these, I might wonder how complex it might be to write your own screensaver with E@H tools. Thank you. ____________ ![]() Madrid 2016: Yes, we can! | |
| ID: 97002 | | |
I'd also say that this is completely off-topic. To answer the question nevertheless, in the forum it's perfectly possible to post in cyrilic, see this message for example. Thank you very much! I will have a look and say hello to this russian member. My Russian is still basic, but better than screensavers encoding!! Cheers! ____________ ![]() Madrid 2016: Yes, we can! | |
| ID: 97003 | | |
|
I'm having another run at the screensaver. Again. :-) | |
| ID: 98401 | | |
|
Hi! | |
| ID: 98402 | | |
|
Yeah, whoops my brainfade. Saw StarsphereS5R3::StarsphereS5R3() : Starsphere(EinsteinS5R3Adapter::SharedMemoryIdentifier), m_EinsteinAdapter(&m_BoincAdapter) { m_CurrentTime = ""; } and thought "multiple inheritance". But that would be : class StarsphereS5R3 : public Starsphere, public m_EinsteinAdapter { // stuff } When I did C++ they told me never to multiply inherit. Course failure, voodoo, nasal daemons etc .... :-) So I never learnt it. Cheers, Mike. ____________ "I have made this letter longer than usual, because I lack the time to make it short." - Blaise Pascal | |
| ID: 98404 | | |
Yeah, whoops my brainfade. Saw This is a constructor initialiser list. Thus the Starsphere constructor is called, being the base/super-class of StarsphereS5R3. Plus the EinsteinS5R3RadioAdapter constructor too, as m_EinsteinAdapter is an EinsteinS5R3RadioAdapter. It's because you don't have direct access to the private data members of the base/superclass, or to the sub-object type represented by m_EinsteinAdapter. Cheers, Mike. ____________ "I have made this letter longer than usual, because I lack the time to make it short." - Blaise Pascal | |
| ID: 98467 | | |
|
Hi Mike, Yeah, whoops my brainfade. Saw That's right. This is how you conveniently instantiate member objects that are not kept on the stack - otherwise you could/would use the "new" operator to do that but then you'd need to "delete" them manually in the destructor. I wanted to avoid that because it just adds complexity (without guarded pointers) while it doesn't get you anything. I agree what you said about multiple inheritance, but sometime it just comes in handy when "unexpected needs" arise :-) Oliver PS: I'll comment on your previous questions soon! | |
| ID: 98489 | | |
Hi Mike, Neat. I agree what you said about multiple inheritance, but sometime it just comes in handy when "unexpected needs" arise :-) No hurry, you're doing the CUDA stuff no doubt!! Take your time ..... :-) I'm trying to belt Suse linux into submission regarding installing GCC. It's pretending not to find the standard libraries, maybe I'll try Debian as you developed on that. Cheers, Mike. ____________ "I have made this letter longer than usual, because I lack the time to make it short." - Blaise Pascal | |
| ID: 98491 | | |
I'm trying to belt Suse linux into submission regarding installing GCC. It's pretending not to find the standard libraries, maybe I'll try Debian as you developed on that. Go to software.opensuse.org, state your version and install what you need. I am using 10.3 and it works. I've compiled mplayer and other tools. Tullio ____________ | |
| ID: 98496 | | |
I'm trying to belt Suse linux into submission regarding installing GCC. It's pretending not to find the standard libraries, maybe I'll try Debian as you developed on that. Ah, well. I have Suse 11.1 so maybe I ought to slide back to 10.x ...... Cheers, Mike. ____________ "I have made this letter longer than usual, because I lack the time to make it short." - Blaise Pascal | |
| ID: 98497 | | |
|
Ok, here we go...
I would phrase it differently, but in principle this is correct!
Correct. The whole notion of a "GraphicsEngine" stems from the idea of different visualization "plugins" - Starsphere being only one of them, coming in two different styles (one each for S5 and ABP). At some point I want(ed) to implement the different engines as true plugins that are loaded dynamically during GFX startup. Which visulization engine/plugin gets used could be set by the user in the project specific preferences for example... In order to prepare for this I had to provide a common interface for all future implementations - that's what AbstractGraphicsEngine is all about.
Yep, it's one specific engine but in two different styles/flavors. One's used for S5Rx and one for ABP. Thus Starsphere contains the common parts of both flavors.
Nope, but we already discussed that :-) Both classes contain the respective application-specific parts. Don't be confused by the somehow outdated naming: S5 always refers to the hierarchical search and Radio/ERP/ABP refer to the radio pulsar search - the usual historical reasons ;-)
That's an instance of EinsteinS5R3Adapter and a member of StarsphereS5R3. This is the interface to the BOINC client and the shared memory segment used to pass real-time search information from the science application to the graphics application. As this information is different for S5 and ABP, there're two implementations of the abstract class BOINCClientAdapter.
Yes, both are implementations of AbstractGraphicsEngine (but forget about "being an m_EinsteinAdapter").
Correct!
Also correct. That's the reason why there's a framework. You don't have to care about anything in the "starsphere" folder (almost, see next topic), just create your own and use what's in "framework". Starsphere should only serve as an example of how to use the framework.
HewsonSphere should be abstract/virtual only if you have one or more children that specialize it. Otherwise it's a single concrete class implementing AbstractGraphicsEngine. Considering the Einstein[APP]Adapter classes: it's not inheritance, it's a composition. But I suppose that's clear by now, isn't it? So this is the only part of the "starsphere" directory that could be of interest to you. When you want to use the information provided by the science apps mentioned above, you need the Einstein[APP]Adapter classes. Background: the framework is meant to be useful for all BOINC projects, therefore it doesn't contain anything project-specific. Unfortunately this is not 100% true, however, because of the intended plugin concept that's not yet implemented. So for the time being GraphicsEngineFactory contains these tiny project-related bits :-/ A working plugin-concept would let the factory query all available plugins for their identifiers (engine/application) dynamically, so that this information would not have to be stored/maintained manually in its header as it is today (see below).
No, right now you need to specify both, an "engine" and an "application". Both are are needed to identify a specific graphics application (can be the same in your case). The "application" IDs are meant to differentiate between separate implementations of the graphics code for, say, SxRx and ABPx. I hope all this makes some sense to you. Let me know if you have more questions. BTW, are you aware of the available documentation (doxygen)? Best, Oliver | |
| ID: 98512 | | |
Ok, here we go... I see now. In true OO flavour. Very much like a Java interface.
Got that.
Ditto.
Yup.
Mind you, there are a couple or seven things I will pinch from the Starsphere area. Those star co-ordinate lists for one. But I'll chop and trim them into my own interface.
Yup, I'll keep it simplest pro-tem. Can always generalise later.
Got that. So this is the only part of the "starsphere" directory that could be of interest to you. When you want to use the information provided by the science apps mentioned above, you need the Einstein[APP]Adapter classes. So quite general. There may be all sorts of weird and wonderful science apps in the future. Weird and wonderful BOINC projects .... [ 'Hello factory! I'm a HewsonSphere and I work with the EinsteinS5R3 ....' ] We never did the factory paradigm either. But I can see the difference between concrete factory class objects producing object instances that are ultimately derived from virtual classes vs. an abstract factory class per se. ( I spent half a day up the wrong street on that one ). Phew! 'Virtual' really does mean "to be defined later in a class ultimately derived from this one". Let me guess - somewhere in the world someone has written a factory that creates other factories ....... :-)
Got that.
Blush .... :-) Well caught. I read it after I posted. Today's lesson is : Read The Fine Manual !! :-) Looking at the resource compiler ( orc.cpp ) - you want better filename checking? I'll make that a side project. Shame standard library C++ doesn't do regex. Mind you if the wrong filename is given it'll fall over pretty quick anyway. And you're likely to be invoking from a makefile, so if the filename is wrong you'd have rather bigger problems. Cheers, Mike. ( edit ) For that matter, I'll pinch your comment/documentation style too. It could be Doxygen'ed later! ____________ "I have made this letter longer than usual, because I lack the time to make it short." - Blaise Pascal | |
| ID: 98527 | | |
|
Thinking out loud. No need to answer. :-) | |
| ID: 98536 | | |
|
Hi Mike,
Just to clarify the terminology differences between Java and C++: Java uses the standard terms "interface" and "abstract class" while C++ (IMHO just being C with an OO add-on) does it differently. In C++ an abstract class is a class that contains at least one abstract method (declared as "pure virtual" (see below), not defined) that's to be defined in an implementing child in order to be instantiated - just like Java but with a different declaration. However, an interface is again just declared as a class but this time it contains only abtract methods. Be careful when you notice the keyword "virtual": virtual just means that this (declared and defined) method is allowed to be overwritten/substituted by a child class. However, if a virtual declaration ends with "= 0" then this method is an abtract method, or "pure virtual" in C++ terms. Have a look at XMLProcessorInterface.h and AbstractGraphicsEngine.h as an example.
Right, the focus was to embed safely any kind of resource (e.g. fonts, images) in the final executable. ORC's file name checking is, say, sufficient. It might indeed just lead to a build problem that's triggered immediately when there's an error in the Makefile.
Recommended :-) Best, Oliver | |
| ID: 98547 | | |
Just one comment required: you got it! Oliver | |
| ID: 98548 | | |
Just to clarify the terminology differences between Java and C++: Java uses the standard terms "interface" and "abstract class" while C++ (IMHO just being C with an OO add-on) does it differently. In Java everything is a class/object, but no multiple inheritance. In C++ maybe/maybe not. In C++ an abstract class is a class that contains at least one abstract method (declared as "pure virtual" (see below), not defined) that's to be defined in an implementing child in order to be instantiated - just like Java but with a different declaration. However, an interface is again just declared as a class but this time it contains only abtract methods. Thank you kindly. I stand corrected. Yes the C++/Java terminology difference is significant. Hey, I'm learning stuff! :-) Cheers, Mike. ____________ "I have made this letter longer than usual, because I lack the time to make it short." - Blaise Pascal | |
| ID: 98550 | | |
Nope, in Java an interface is an interface, not a class. Java provides an explicit entity (and a keyword) while C++ doesn't. Oliver | |
| ID: 98551 | | |
Be careful when you notice the keyword "virtual": virtual just means that this (declared and defined) method is allowed to be overwritten/substituted by a child class. However, if a virtual declaration ends with "= 0" then this method is an abtract method, or "pure virtual" in C++ terms. Have a look at XMLProcessorInterface.h and AbstractGraphicsEngine.h as an example. Also note that in Java, all methods are virtual, and you can't change that. In C++, you get to choose. ____________ Please use "reply to this post" instead of "reply to this thread" . See Threads | |
| ID: 98569 | | |
|
Thanks guys for the corrections! That is really very, very helpful. :-) :-) | |
| ID: 98581 | | |
|
One tiny query : in the ResourceCompiler class we have a virtual destructor. I assume this might indicate the possibility of allowing subclassing later on, in the sense of further development of the ResourceCompiler idea? And/or a good habit to get into generally? | |
| ID: 98620 | | |
One tiny query : in the ResourceCompiler class we have a virtual destructor. I assume this might indicate the possibility of allowing subclassing later on, in the sense of further development of the ResourceCompiler idea? And/or a good habit to get into generally? You are correct. If you have a class A with a virtual function foo() (and will be used in a polymorphic way), and a class B that inherits from it, and maybe adds more dynamically-allocated members, then there is a really bad problem here: http://pastebin.com/f47c0b06f As you say, there would be a memory leak because the destructor of the derived class wouldn't be called. The solution is making the dtor virtual. That way, destructing a B via an A* pointer would call the overridden dtor ~B. (note that ~A is also called, but that's because ~B implicitly calls ~A at the end, just like B constructor implicitly calls A constructor at the beginning). The C++ FAQ Lite (a great C++ resource, btw) says: Here's when you need to make your destructor virtual: ____________ Please use "reply to this post" instead of "reply to this thread" . See Threads | |
| ID: 98621 | | |
You are correct ..... if your class has any virtual functions. Thank you kindly again! :-) The sources I had made a lot of talk of cost ( time/space ), but that's not really relevant here. Better to be correct, of course. Implementation dependent anyway ( virtual tables et al ), and it's the wrong end of the process to be optimising also. What is the speed of a wrong design? : zero, when measured along the axis of interest ..... :-) Cheers, Mike. ____________ "I have made this letter longer than usual, because I lack the time to make it short." - Blaise Pascal | |
| ID: 98623 | | |
|
Some thoughts and excavations ( upon OpenGLĀ® Programming Guide: The Official Guide to Learning OpenGLĀ®, Versions 3.0 and 3.1, Seventh Edition ) if you'll suffer it. Me thinking out loud again. :-) void glTexImage2D(GLenum target, GLint level, GLint internalFormat, [ There is no shortage of other functions to pay attention to, like what do you do if you get to the edge of the texture but there's more polygon to go : do you repeat? etc ... ] For what I currently have in mind ( a picture of dear Albert's face overlaid upon a filled ellipse representing the Earth's orbit ) : target = GL_TEXTURE_2D. Believe it or not, there are 1D and 3D textures. level = 0. Indicates only a single resolution of the texture map will be used. internalFormat = GL_RGBA. Answers the question : which of the possible components of a texel ( RGBA, depth, luminance, or intensity ) will I be using when rendering occurs? A blizzard of options specifying how you want to use your texture. Alot regarding whether it's normalised ( to range [0,1], or range [-1,1] ) , fixed-point, floating-point ........ width & height. Apropos to the texture size. border = 0. No border. format = GL_RGBA. Answers the question : which of the possible components of a texel ( RGBA, depth, luminance, or intensity ) have I provided in my bit store? Again a snow storm of options, but I'm going to supply 3 colors and an alpha value ( per texel ). type = GL_UNSIGNED_BYTE. The ResourceCompiler will ultimately lead, as discussed earlier, to access to a const vector< unsigned char >. This and format says we'll be accessing red, green, blue and alpha values ( in that consecutive order ) each as 8-bit quantities ( 0 - 255 decimal ). texels = &yourBitStore. ( Pass the address of your bit store ). Note the const GLvoid so your store won't be altered and can contain any type of data. But a successful interpretation of this store depends on you correctly specifying it's implicit structure via the above parameters. Clearly it's possible to provide a particular bit store and use it in different ways with different calls. In effect there is some 'cast'-ing going on. Thus the parameters internalFormat and format. In my case I'll be providing exactly what I want used, GL_RGBA, no more and no less. NB - there are important OpenGL version differences with these two parameters. So here is the picture: ![]() This is a 24 bit colour-depth bitmap file, but is not yet Resource Compiler ready. I have to : - trim irrelevant stuff out like BMP File Header, Device Independent Bitmap Header, Color Palette. - keep the height and the width. - keep the bitmap! ( NB this has a varied offset into the file ) - add an alpha value for each pixel. Also I want to 'clamp' the darker pixels to black ( RGB = {0,0,0} ) and/or give them an alpha of 0 ( fully transparent ). Pixels brighter than 'dark' ( threshold yet to be decided ) should be unchanged RGB wise but given some constant alpha. ( Alpha is a blending value, and there are more than a few modes of blending ). Why? Well I want to paste Albert's features only, partially transparent over some underlying color ( of the filled ellipse ), and I don't want the dark background clearly indicating that I got it from a rectangular image. A non-zero alpha for the 'dark' pixels ( well texels now ) will give a ( fainter ) rectangle over the underlying polygon color, with Albert's face in the middle. I'm using the fact that the picture has great contrast between his head and the background, so the final result will effectively look like a 'cut-out' around his outer hairline and lower face. I've already painted out his shoulders, suit and tie. This roughly follows how it's done for the green/blue screen technique for movie CGI. Better watch the ellipse color though - do I want his eyes purple? :-) I'll have to experiment with different combinations of Albert in the foreground, transparency levels and some background colors. :-) To this end I'm writing a tool to suck up a *.bmp file, do those changes as above and spit out a binary file to be specified in a *.orc file. I figure that texturing of objects in the 3D viewpoint will be quite a useful skill to manage. For instance I'd like to have an Earth which actually shows continents, or a Sun with sunspots. Time will tell .... :-) The closer one can present the data to the engine in the form of it's ultimate use ( as efficiently as desired ) then the less runtime fiddling. No doubt OpenGL could be arm-wrestled to provide a whole chain of texture/image alteration on the fly. Rather avoid that. Cheers, Mike. ( edit ) GLenum, GLint, GLsizei, GLvoid .... are typedefs that map/correspond to more 'basic' types on a per OpenGL implementation/library basis. These are reasonably defined. But use these rather than explicit C++ types wherever possible to retain portability. As we are effectively cross-compiling to lots of system target types with the E@H supplied screensaver graphics framework, this is quite important. ( edit ) And BMP is an older & simpler ( uncompressed ) format, likely to be readily available for conversion from some other image format into it, by even basic image software. I worked with the above image purely within M$ Paint, starting with a jpeg. ____________ "I have made this letter longer than usual, because I lack the time to make it short." - Blaise Pascal | |
| ID: 98627 | | |
|
Hi Mike, | |
| ID: 98778 | | |
I'd like to comment on your intended image resource handling. Comment away! Many hands make the blinkin' light work .... ;-) IMHO it's much easier to simply add your favourite images "as is" using ORC, so don't strip them down to the bare naked pixel data. Hmmmm ..... for some reason I've evidently acquired the idea that I have to stuff everything into the one executable with maximal efficiency. Not so. Ah, that makes life easier. :-) I honestly can't say why that assumption snuck in! I'm solving the wrong problem. No kidding, my first programming experience ever was assembler on an 8088. The old habit of crawling on hands 'n knees. Just can't get away from the bit twiddling, shaving them bytes 'n cycles. 'Spelunker' anyone? :-) The reason for this is that SDL provides methods to import a variety of image data which can then be turned into an OpenGL texture! This way you (almost) don't have to care about the individual image file formats. Neat, so for my plans I'll still need a format with per pixel alpha's. Can do ( reaches for PhotoShop ..... ) and I can set the eyeball/pupils to no-blend. I think I'd focussed on the bit about OpenGL per se not loading image files, but if SDL_Image is written to do so then one can easily go that route. The first step is to create a SDL_Surface from a Resource. You'll find an example in the framework's WindowManager::setWindowIcon() that's being called in starsphere's main(). Thank you so much for taking the time ! And thanks for those links. :-) Edit: BTW, I like your idea and I'm very curious to see a first picture of how Einstein looks like! Well, I originally thought of using the photo where he pokes his tongue out. But I thought I'd stay more conservative for a first attempt. :-) Since I seem to be doing a spot of trailblazing here, I'll keep the commentary up. Might be useful to others, and ought be entertaining for y'all to watch. :-) [ Certainly helps me. ] Cheers, Mike. ( edit ) Here's an interesting challenge. Easy to shade the Earth, right? Just specify a light source at .... the Sun! Get a nice shadow effect on the dark side. Be nice to have a 3D effect for the Sun though, so it doesn't just look like a flat circle. Texture helps, yes. However it would look a tad odd having a light source off the ecliptic and causing the Sun to cast a shadow on the orbit ellipse! Not to mention the Earth having two shadows from two sources. Maybe wrap a texture around the sphere object that will be the Sun, then apply 'limb darkening'. This is a real astronomical effect where the outer area of the Sun's disc appears darker than the middle of the face. Depth of photosphere etc. Try a mask of sorts b/w the Sun and the viewpoint/camera? Needs work .... ____________ "I have made this letter longer than usual, because I lack the time to make it short." - Blaise Pascal | |
| ID: 98780 | | |
|
Here's my first try at massaging the framework ( sorry, only a Linux executable today ) : | |
| ID: 98856 | | |
Here's my first try at massaging the framework ( sorry, only a Linux executable today ) You are using Einstein screensaver framework code as a base, which is GPL. So if you release an executable, you have to release the corresponding code. ____________ Please use "reply to this post" instead of "reply to this thread" . See Threads | |
| ID: 98872 | | |
Here's my first try at massaging the framework ( sorry, only a Linux executable today ) Whoops .. thanks for that. :-) Here it is. Very much a work in progress, lacks full commenting etc. However some main points are: - you have to fiddle with the build script alot. Slot in yourprojectname for starsphere where mentioned mutatis mutandis. Here is the build script that I use, BUT as I've had to massage it for my Linux system, it's very specific. - you need to fiddle with the makefiles alot ( I now see Oliver's earlier point about automake et al .... ). Only the Linux makefile is valid, yet. - my SolarSystem class directly derives from AbstractGraphicsEngine ( so no starsphere and subsequent variants ), thus trimmed the relevant files and other entries. Mind you, I've pinched the Starsphere interface/code and re-named to suit, but deleted some aspects ( additional observatories, constellations ). - you have to fiddle with the GraphicsEngineFactory class. Insert an enumeration constant for your variant and have the code able to select that. - a small change to main.cpp too. - the underlying Starmap data structure is a fudge/kludge around the fact that you can't have array style initialisation of the std::vector class ( which I'd prefer to use ). Otherwise you'd have to load the vector from an array ( do-able, but it double handles stuff ), or not bother encapsulating at all ( retaining the original C style array and extern ). Cheers, Mike. ( edit ) Here is the source of the star data from which I derived the Starmap entries. I included in the Starmap class, but have not yet utilised, the star names. ( edit ) Might extract some commonalities and make Starmap a base class ...... ____________ "I have made this letter longer than usual, because I lack the time to make it short." - Blaise Pascal | |
| ID: 98882 | | |
Message boards :
Cruncher's Corner :
Write your own Einstein@home screensaver