Re: DirectAccess to Video Memory [was: Hello, new member reporting]
Pierre Phaneuf <pphaneuf <at> gmail.com>
2009-02-02 18:37:51 GMT
On Sun, Feb 1, 2009 at 8:46 PM, Antonio Marcos <amcmr2003 <at> yahoo.com.br> wrote:
> Hmpf.. there goes my optimizing-l33t-hacking-drives down the drain.. but they will be back with
torches, Pierre, be warned!
Yeah, it's a bit disappointing for the bit-twiddling aspects that
we're losing, but there's a whole new art of making the fixed set of
APIs (well, less fixed now that there are more and more shaders kind
of programmability) of OpenGL do the wacky things we want to do as
fast as possible.
> wait a sec.. will I need to actually talk to openGL myself? or this will be taken care of by SDL?
No, in SDL 1.3, the new API has a "renderer" that talks OpenGL behind the scene.
>> how the depth-of-field effect in Crysis is done.
> Awesome! Got any videos of this in action, so I can check it out? It sounds like the player would feel stoned
or something :) (sorry if this offends the programmers in any way haha, and it does seems to be at least a
couple of ways, lol)
There's got to be some stuff on Youtube, I guess? There's a similar
effect in Call of Duty 4, when you bring up a weapon for more accurate
firing, it simulates the effect of your eyes focusing on the sights,
but I think it's faked with a bit of blurring, instead of being more
optically correct, as in Crysis (that game really needs a powerful
system, no need to say!).
>> But if you SDL_LockSurface even *once* per frame,
>> everything will
>> probably go down the toilet. So direct access to video
>> memory (as per
>> the subject) is the *last* thing you want, really.
> ookaay.. got it :( back to DosBox then... :(
Well, if it's any comfort, with PCI Express, the "toilet" is much
faster than it used to be. But if you want to use the hardware
properly and kick real ass, you'll have to keep to the new SDL_Texture
API (rather than the old SDL_Surface API). You can still lock textures
with the new API, but there's a flag when creating the texture to say
whether it is "static" or "streamable", and you can only lock the
latter (this is so SDL knows when it's free to optimize the heck out
of stuff, so presumably, operations done with "static" textures have
better chances of being in the fast path).