I was getting tired of waiting for shell service to come back to sourceforget so I searched for blogs talking about it, maybe they knew something I didn't- instead I found this entry http://icolor2.blogspot.com/2007/02/sourceforge-downtime.html which pointed me to google project hosting.
Almost immediately I created my own project http://code.google.com/p/binarymillenium/ and started uploading code. Initially I thought there was no support for screenshots but I then realized screenshots could be uploaded to svn and linked to from the wiki, although it automatically creates image for 'jpg' extensions but not 'JPG'.
I'm ready to quit sourceforge entirely, and leave all its frustrating user interface problems behind. It's one of those facets of the internet where big sites start up and then become sort of fossilized in whatever web technology was the state of the art or popular at the time, and then a new generation will rise up and replace them with superior web stuff- google web toolkit is the current new thing.
2007-02-23
2007-02-21
Render-to-texture feedback with OSG
This actually doesn't use any of the screen capture code from the last post ( I'm still working out how to best use that) - it just does a good old fashioned glReadPixels to current the current opengl screen.
OSG Feedback from binarymillenium on Vimeo.
OSG Feedback from binarymillenium on Vimeo.
2007-02-19
Screen Capture with wxWindows
For reasons that will become clear when I post some more software and video, I need to have a general method of capturing any part of the screen and using it as a texture in custom applications.
Google searches for 'screen capture' 'capture screen' or 'screen grab' turn up a lot of other peoples shareware screen grab stuff, and lots of mailing lists where screen captures are provided of one thing or another but it's hardly ever about the code that did the work. How to find some usable code to do what I needed? The answer turned out to be sourceforge, where I found sseditor:
wxWin32ScreenShot.cpp
I was hoping there would have been a platform independent method where you just ask the video card to give you all the pixels, but it turns out to be windowing platform specific. This instance used Windows and wxWindows. I compiled wxWindows 2.8.0 for Cygwin and saw that the examples work. I then copied the screengrab code out of sseditor and put it in a wxWindows sample called 'drawing'. That worked after a little tweaking.
I then took the code and put it into a custom OSG application. There were lots of problems, and I was worried the wxWindows libraries or just using wxWindows in OSG at all was causing instability. I then ran into a problem where calling 'CreateCompatibleBitmap' failed after exactly 153 calls, but it turned out I needed to call DeleteObject on the HBITMAP before calling CreateCompatible repeatedly, I was using up graphics memory and not freeing it.
Also, I had to call wxInitialize() and wxUninitialize() at the beginning and end of my program.
My other problem was that I didn't know how to translate between the wxBitmap format of wxWindows and the texture format of the osg::Image. The first way I made it work was by writing the bitmap to disk using a wxWindows function then loading that bmp to a texturing in OSG- this worked but was hard on the disk drive for high rate screen capturing, but writing to a ramdisk can fix that.
But the seeming right way to do it:
The flip code seems really wierd, but it was necessary.
Anyway, after all that I felt pretty proud of myself for hacking a working screencap together over a couple of days, not knowing anything about windowing toolkits before that (I've always known enough about them to try and avoid them like the plague, there's no uglier code than window gui widget code).
The only libraries needed for wxWindows are -lwx_base-2.8 and -lwx_msw_core-2.8, though there will be warnings about other wx libs getting auto imported.
Google searches for 'screen capture' 'capture screen' or 'screen grab' turn up a lot of other peoples shareware screen grab stuff, and lots of mailing lists where screen captures are provided of one thing or another but it's hardly ever about the code that did the work. How to find some usable code to do what I needed? The answer turned out to be sourceforge, where I found sseditor:
wxWin32ScreenShot.cpp
I was hoping there would have been a platform independent method where you just ask the video card to give you all the pixels, but it turns out to be windowing platform specific. This instance used Windows and wxWindows. I compiled wxWindows 2.8.0 for Cygwin and saw that the examples work. I then copied the screengrab code out of sseditor and put it in a wxWindows sample called 'drawing'. That worked after a little tweaking.
I then took the code and put it into a custom OSG application. There were lots of problems, and I was worried the wxWindows libraries or just using wxWindows in OSG at all was causing instability. I then ran into a problem where calling 'CreateCompatibleBitmap' failed after exactly 153 calls, but it turned out I needed to call DeleteObject on the HBITMAP before calling CreateCompatible repeatedly, I was using up graphics memory and not freeing it.
Also, I had to call wxInitialize() and wxUninitialize() at the beginning and end of my program.
void wxScreenCapture(wxDC& dc)
{
int sizeX = 0;
int sizeY = 0;
sizeX = tex_width; //GetSystemMetrics(SM_CXSCREEN);
sizeY = tex_height; //GetSystemMetrics(SM_CYSCREEN);
compat_counter++;
bmp->SetHeight(sizeY);
bmp->SetWidth(sizeX);
HDC mainWinDC = GetDC(GetDesktopWindow());
HDC memDC = CreateCompatibleDC(mainWinDC);
if (bitmap != NULL) DeleteObject(bitmap);
bitmap = CreateCompatibleBitmap(mainWinDC,tex_width,tex_height);
if (bitmap == NULL) {
std::cerr << "CreateCompatibleBitmap failed at " <<
compat_counter << ", " <<
mainWinDC << " " << tex_width << " " <<
tex_height << std::endl;
exit(1);
return;
}
HGDIOBJ hOld = SelectObject(memDC,bitmap);
BitBlt(memDC, 0, 0,sizeX,sizeY, mainWinDC, 20, 20, SRCCOPY);
SelectObject(memDC, hOld);
DeleteDC(memDC);
ReleaseDC(GetDesktopWindow(), mainWinDC);
bmp->SetHBITMAP((WXHBITMAP)bitmap);
if (bmp->Ok() ) {
//dc.DrawText( _T("BMP ok"), 30, 20 );
} else {
//dc.DrawText( _T("BMP not ok"), 30, 20 );
std::cerr << "bmp not ok" << std::endl;
return;
}
if (savewximage) {
bmp->SaveFile( wxT("/cygdrive/b/text.bmp"), wxBITMAP_TYPE_BMP);
}
My other problem was that I didn't know how to translate between the wxBitmap format of wxWindows and the texture format of the osg::Image. The first way I made it work was by writing the bitmap to disk using a wxWindows function then loading that bmp to a texturing in OSG- this worked but was hard on the disk drive for high rate screen capturing, but writing to a ramdisk can fix that.
But the seeming right way to do it:
/// get image from desktop in wxBitmap format,
// convert it to osg::Image format
wxAlphaPixelData rawbmp(*bmp, wxPoint(0,0),
wxSize(tex_width, tex_height));
wxAlphaPixelData::Iterator p(rawbmp);
image->allocateImage(tex_width, tex_height,
1, GL_RGBA, GL_FLOAT);
/// image is an osg::Image
float* img_data = (float*)image->data();
for (unsigned i = 0; (i < tex_height); i++) {
for (unsigned j = 0; (j < tex_width); j++) {
int ind = i*tex_width + j;
bool flip = ((i > tex_height/4-1) && (i < 3*tex_height/4)
&& (j > tex_width/4-1) && (j < 3*tex_width/4));
img_data[ind*4] = flip ? 1.0 - p.Red()/255.0 : p.Red()/255.0;
img_data[ind*4+1] = flip ? 1.0 - p.Green()/255.0 : p.Green()/255.0;
img_data[ind*4+2] = flip ? 1.0 - p.Blue()/255.0 : p.Blue()/255.0;
img_data[ind*4+3] = 1.0;
p.MoveTo(rawbmp, j, tex_height-1-i);
}
}
The flip code seems really wierd, but it was necessary.
Anyway, after all that I felt pretty proud of myself for hacking a working screencap together over a couple of days, not knowing anything about windowing toolkits before that (I've always known enough about them to try and avoid them like the plague, there's no uglier code than window gui widget code).
The only libraries needed for wxWindows are -lwx_base-2.8 and -lwx_msw_core-2.8, though there will be warnings about other wx libs getting auto imported.
2007-01-24
VJ Night
There might have been about 20 people there to watch the show. Around 8 VJ Scobot started out with his opening set, which was mostly fast edits between a few dozen clips. Some of the clips were recognizable, like from Bad Boys or Team America, others from anime sources, and some footage from marginal productions of decades ago. Something from early incarnations of 'The Rocketeer'? Scobot later explained that his software allows keying of clips to keys (and presumably effects and transitions also?).
After 20-30 minutes of that the music wound down and Scobot introduced DJ Deeb, the guest VJ Spyscience, and what VJ Night is all about. An interview with Spyscience followed, video taped by one from the 911 crew (though it's not clear whether the interview will ever be put on the internet or anywhere else, it's just for the archive). Spyscience used some software I forget the name of, which is also clip oriented but drag and drop along with an external USB device with sliders and knobs is used. Most of the clips where provided with the software, one he had made himself. His computer locked up a few of times and Scobot had to take control of the video for a while during rebooting.
After that a Q&A sessions followed, and the event was over by about 10.
Overall the event was interesting, though even as Scobot admitted the traditional role of VJ work is to make a side-show, not to be shown in a theater to an audience focused directly on it. I thought the format works but that VJ sets should be a little shorter, since they can get repetitious. Another nice thing might be to have continuous split-screen, one view showing the VJ output and the other focusing on the VJ and what they're doing, although the layout of the space allows the audience to effectively look over the shoulder of the working VJ.
I found my personal preference is for visuals that are the opposite of recognizable clips from tv or movies, but purely abstract instead. I'd like to see someone do a set with more live-generated visuals (rather than live-editing-plus-effects on a lot of clips).
After 20-30 minutes of that the music wound down and Scobot introduced DJ Deeb, the guest VJ Spyscience, and what VJ Night is all about. An interview with Spyscience followed, video taped by one from the 911 crew (though it's not clear whether the interview will ever be put on the internet or anywhere else, it's just for the archive). Spyscience used some software I forget the name of, which is also clip oriented but drag and drop along with an external USB device with sliders and knobs is used. Most of the clips where provided with the software, one he had made himself. His computer locked up a few of times and Scobot had to take control of the video for a while during rebooting.
After that a Q&A sessions followed, and the event was over by about 10.
Overall the event was interesting, though even as Scobot admitted the traditional role of VJ work is to make a side-show, not to be shown in a theater to an audience focused directly on it. I thought the format works but that VJ sets should be a little shorter, since they can get repetitious. Another nice thing might be to have continuous split-screen, one view showing the VJ output and the other focusing on the VJ and what they're doing, although the layout of the space allows the audience to effectively look over the shoulder of the working VJ.
I found my personal preference is for visuals that are the opposite of recognizable clips from tv or movies, but purely abstract instead. I'd like to see someone do a set with more live-generated visuals (rather than live-editing-plus-effects on a lot of clips).
2007-01-10
Gephex
I created a couple of custom gephex modules (for 0.4.3):
Average
Find the average color or brightness of a framebuffer. (maybe add HSV next)
Slow motion
Play back snippets of framebuffer input in slow motion. The music is from ccmixter, William Berry's Time To Take Out The Trash.
The source code (GPLed of course) and windows dlls are provided in those zip files.
More custom effects are on the way.
New video showing off basic gephex effects:
...but none of those I just created. Maybe next time.
Subscribe to:
Posts (Atom)