Ok guys,
I was able to modify the testgl.c program to use alpha on the SDL_OPENGLBLIT
bitmap. SetAlpha didnt seem to work, but I checked out the source to the
console and noticed they did a fillrect with the rectangle set to NULL;
So I did something like
SDL_FillRect(screen, NULL, 0x88000000);
and it seemed to do the trick.
HOWEVER, Im not using alpha in my game. I was just curious. Now the real
problem is that the HUD I’m using takes up about 75% of the screen space
space. Even with clipping and moving everything out of the loop and with
alpha shutoff so all there is the call to SDL_UpdateRects.
But it was too slow. WAY TOO SLOW. So…umm Obviously UpdateRects was the
culprit. Can I prevent using this? Yes, it seems I can. If I use glScizzor
and glUpdate I can define a hard end-all do-all clipping solution to the
OpenGL viewport. Simply put people, you draw the bitmap once and then update
the gl view as usual, and the glScizzor thing will only draw the OpenGL in
the specific clip rectangle you defined.
What about portability and stuff? Well I tested it on a Voodoo3 and TNT2 on
windows 2000 and it worked ok. If I overwrited the window, it automatically
redrawed (windows SAVEBITS or something, perhaps?). But I had my friend test
it on Linux and the bitmap didnt redraw when the window was overwritten.
This is obvious, I only drew the “skin” once. Using UpdateRects every frame
was just way toooo slow. The way I do it now is perfectly fast.
Now I assume this wouldnt be a problem in full-screen, but is there some
kind of Paint event to SDL? Is there any mechanism I can do this now
cross-platform compatibility? Do I need to resort to #ifdefs, and if
possible can someone give me an example? Basically, I just need to know when
the window needs to be repainted so I can redraw the “skin” (bitmap). I
checked the docs, but didnt see anything. Maybe there is something
undocumented somewhere?
Thanks,
Later,
Matt