View unanswered posts | View active topics It is currently Fri Apr 25, 2014 4:07 am



Reply to topic  [ 21 posts ] 
 Direct3D Screen Transitions 
Author Message

Joined: Thu Sep 23, 1999 7:01 am
Posts: 18
Location: Auburn, CA -- USA
Post Direct3D Screen Transitions
I have been thinking about rewriting my screen transitions that were for DirectDraw so that they are compatible with Direct3D. Couple of problems though ...

In DirectDraw, life was simple: get front buffer (what you are transitioning from), get back buffer (what you are transitioning to) - and make a copy of those surfaces. Then draw whatever type of transition you wanted to the back buffer (e.g. for a horizontal wipe the first frame might be 10% "transition to" graphic and 90% "transition from" graphic) and then flip so it is displayed. Repeat drawing until your transition is finished.

Direct3D is a little screwy. I can get access to the backbuffers again in D3D 9, but not the front buffer (well, except for an extremely slow GetFrontBufferData() call).

So, the only way I see to do a transition like before is to have the user store the screen they are going to "transition from" while it is still a back buffer and accessible. Then, they perform their flip (e.g. Present()). At that point they draw the screen they wish to transition to and perform the transition the same as before since you now have a copy of the front buffer in some system memory to work with.

Has anybody else found a better way of doing this? It seems awfully damn kludgy the way I have it, but I can't seem to figure out a better way.

- Chris


Sun Jun 08, 2003 9:11 pm
Profile WWW

Joined: Thu Sep 12, 2002 7:01 am
Posts: 10
Location: Clovis, CA
Post Direct3D Screen Transitions
Yeah, that does seem kinda messy. But at least you know it will work.

How important is it to you that GetFrontBufferData() is slow? You're not going to have to call it within a loop, right? ...just before the transition.

So, I guess you just have to decide if it's worth few more cycles in light of cleaner code.

Unless, of course someone knows of a faster way to copy that data.

I know I'm probably telling you what you already know, but sometimes hearing someone else's outlook on the same situation helps.


Sun Jun 08, 2003 11:35 pm
Profile WWW

Joined: Thu Sep 23, 1999 7:01 am
Posts: 18
Location: Auburn, CA -- USA
Post Direct3D Screen Transitions
Yeah, thanks Profugus. It always helps to hear somebody concur [img]images/smiles/icon_smile.gif[/img] - and, if nothing else, it helps to know that what I wrote really wasn't just gibberish.

I may end up using GetFrontBufferData() since I can make the code cleaner that way (although it will be a pain to convert the buffer back to the proper bit depth). It will also be easier to abstract it out so these things work with OpenGL as well.

I don't know though. I may decide to just expand the DirectDraw screen transition routines I currently have. Just depends on what everyone around here is writing for nowadays. Maybe I'll post a poll later.

===== Another Possibility ====

I suppose I could just write it to support generic buffer pointers and let the user worry about how to get pointers to those surfaces and proper data into there. The only trouble is dealing with the buffer swap ... one solution might be for the user to make a call to setup the src and dest buffers to use for the transition - then simply make a call each frame passing in the buffer to draw the current state of the transition on (e.g. back buffer) - then perform the flip/present themselves.

Hmmm ... that above solution has the added advantage of the user being able to transition *any* surface (e.g. the front face of a cube that represents a television in the world).

Any thoughts on this approach? I think I am leaning towards this way after mulling it over as I write it. It appears to be much cleaner, and lets the user decide how they want it and where they want it instead of deciding for them.

- Chris


Mon Jun 09, 2003 11:37 am
Profile WWW

Joined: Thu Sep 12, 2002 7:01 am
Posts: 10
Location: Clovis, CA
Post Direct3D Screen Transitions
I definately like this way much better. It's both elegant and flexible. Versatility whens again. This would even let you mix your transitions with other effects as you think of them later on down the road. A cross fade mixed with a fish bowl type effect could produce some very interesting spheres.


Mon Jun 09, 2003 10:49 pm
Profile WWW

Joined: Thu Sep 23, 1999 7:01 am
Posts: 18
Location: Auburn, CA -- USA
Post Direct3D Screen Transitions
Cool. Thanks for the feedback. Bouncing this stuff off of you has helped me clarify how it should behave.

Maybe I'll get 'em written soon and post a new library for everyone to use. [img]images/smiles/icon_cool.gif[/img]

- Chris


Mon Jun 09, 2003 10:55 pm
Profile WWW

Joined: Thu Sep 12, 2002 7:01 am
Posts: 10
Location: Clovis, CA
Post Direct3D Screen Transitions
Man, that would be ultra cool.

I've been considering uploading my Direct Draw Library for everyone. It's polymorphic so you can write code using generic bit depth routines. This way the user can change the screen mode while running your application and you can use the same code. But, for optimization reasons, you could always just use the bit depth specific functions. [img]images/smiles/icon_wink.gif[/img]

I'll tell you what, man. If you write those transitions and post them here for everyone, then I'll post my libraries as well (Direct Draw, Direct Input, Direct Sound/Music, Common Functions, and a Win API wrapper). The Direct Draw library is over 3,500 lines of code by itself. [img]images/smiles/icon_cool.gif[/img] Sound cool?


Tue Jun 10, 2003 10:24 am
Profile WWW

Joined: Thu Sep 23, 1999 7:01 am
Posts: 18
Location: Auburn, CA -- USA
Post Direct3D Screen Transitions
Free libraries are always good. Here is a link to the latest one I posted (late last year).

Profiler Post

Most of the other stuff I have posted has become antiquated for what people are now focusing on, and I haven't had much time in the last couple of years to stay on top of creating new stuff.

Maybe I'll put up a page with all of the old stuff on it - at least the old stuff that I can find.

My goal with the Xtreme Archive Community (when I had it up) was for people on this board to write code/libraries/games and share them. Sadly, only a few people got any real use out of it - and even fewer actually posted any library/routine stuff, it was mostly just used for games. So, I took it down when I upgraded my system since it wasn't worth the hassle of getting back up and running for the use it was getting. Who knows though, maybe at some point in the future enough people on this board will do something to make it worth bringing it back online. [img]images/smiles/icon_smile.gif[/img]

- Chris


Tue Jun 10, 2003 10:38 am
Profile WWW

Joined: Thu Sep 12, 2002 7:01 am
Posts: 10
Location: Clovis, CA
Post Direct3D Screen Transitions
Thanx bud, that'll help a lot. I was going to write a profiler of my own, but never got around to it.

PS. Check out this thread, I put a link to some of my source code. [img]images/smiles/icon_wink.gif[/img]

Free Source Code!


Wed Jun 11, 2003 9:05 pm
Profile WWW

Joined: Wed Sep 29, 1999 7:01 am
Posts: 59
Location: North Shore City, Auckland, New Zealand
Post Direct3D Screen Transitions
that's right, when i stuck this game on download.com and bit's xtreme archive site was hosting the file, the site was flooded with hits. it was about the most use that the xtreme archive site got [img]images/smiles/icon_wink.gif[/img] bought my own web space after that [img]images/smiles/icon_smile.gif[/img]

[ June 11, 2003: Message edited by: Omen ]</p>


Wed Jun 11, 2003 9:23 pm
Profile WWW

Joined: Thu Sep 23, 1999 7:01 am
Posts: 18
Location: Auburn, CA -- USA
Post Direct3D Screen Transitions
Yup, Omen's game was about the only thing generating traffic - other than when people used it for screenshots of their works in progress. Too bad too. I had hoped people would write and share what they had done with the other members of this board. But, so few people have even finished a game it is easy to understand why that didn't happen.

Thanks for the code Profugus. I will grab it and take a peek when I have a chance. This is what I hope to see a lot more of on the board. There is a lot of knowledge here, but people need to start sharing what they have in bite sized pieces that others might be interested in.

- Chris


Wed Jun 11, 2003 10:16 pm
Profile WWW

Joined: Thu Sep 23, 1999 7:01 am
Posts: 18
Location: Auburn, CA -- USA
Post Direct3D Screen Transitions
Okay ... I threw a website together with some of my old code on it. I will be adding to it as I sort through my old stuff and re-organize it for release. And, of course, as I write new stuff.

The link should be on my signature ... we'll see if this works.

- Chris


Thu Jun 19, 2003 1:18 pm
Profile WWW

Joined: Sat Apr 21, 2001 7:01 am
Posts: 53
Location: Lexington, MA, USA
Post Direct3D Screen Transitions
I have a pretty good windowing class that I use in all of my projects. I've simplified it down so that all you have to do to create a window is call the Register() function and then the Create() function. No messy Windows (OS) crap, no message handler. If you want to handle certain messages yourself (e.g. WM_CHAR for input), then you can pass a function pointer to that handler and your function will be called in addition for all messages received. If you forgot to call Destroy() or Unregister(), the destructor does that automatically. If anyone is interested I can post the code.


Thu Jun 19, 2003 2:45 pm
Profile ICQ

Joined: Thu Sep 12, 2002 7:01 am
Posts: 10
Location: Clovis, CA
Post Direct3D Screen Transitions
Ok guys, I'm all for open source. What do you think we should do:
post our code on our own sites and post it here when it's updated,
post all of our code at the same place (if so, how do we get it there and where?),
or something else?

I've got a ton of code that I'd be willing to share. And all free to distribute, change, bastardize, or whatever. Though, most of it is DOS based. I've only been programming in Windows for about a year (ever since I first appear at this forum).

BTW- Bit, that DigDug style game was really cool. It's too bad my pong game didn't run on some of your systems. You guys would have loved the palette manipulation in that game. I can sit and just zone out on those effects forever. Sometimes, I forgot that I was even programming in the first place.


Sat Jun 21, 2003 12:32 am
Profile WWW

Joined: Thu Sep 23, 1999 7:01 am
Posts: 18
Location: Auburn, CA -- USA
Post Direct3D Screen Transitions
Hmmm ... I dunno. I have thought about bringing the Archive community back - as long as it was getting use this may be reasonable. I would have to look into seeing what it would take to get it up and running on my system again, or look into having it hosted elsewhere.

Then again, it may be easiest for everyone to just create their own code archives and we could just have a page that points to that area.

Maybe somebody could hack something into the UBB code to include a "Code Archive" button along with the profile information and send eMail buttons. That would be fairly cool, everyone would have access, and it would be easy to remember.

Thoughts?

- Chris


Sat Jun 21, 2003 11:17 am
Profile WWW

Joined: Thu Sep 12, 2002 7:01 am
Posts: 10
Location: Clovis, CA
Post Direct3D Screen Transitions
<blockquote><font size="1" face="Verdana, Helvetica, sans-serif">quote:</font><hr>Originally posted by bit:
<strong>[...]
Maybe somebody could hack something into the UBB code to include a "Code Archive" button along with the profile information and send eMail buttons. That would be fairly cool, everyone would have access, and it would be easy to remember.

Thoughts?

- Chris
</strong><hr></blockquote>

Hmmm, that's a real good idea. I'm going to E-mail Andre' and see if he can put one on for us.
He's an awfully nice guy, so he might take the time out of his busy schedule for his fellow nerds.


Sat Jun 21, 2003 11:27 am
Profile WWW

Joined: Thu Sep 23, 1999 7:01 am
Posts: 18
Location: Auburn, CA -- USA
Post Direct3D Screen Transitions
Sounds good to me. If he doesn't or can't make the change, then we'll see what else we can come up with. There should be something simple that can be done. Whatever method, the important thing is making it so the newer users are able to locate it ... not just the guys who have been around and know where to go already.

BTW, I dunno if you use emacs, but I updated the site with a package to create/use templates in emacs for keeping code clean and consistent. It is pretty cool and extendable to whatever language you write code in.

- Chris


Sat Jun 21, 2003 11:56 pm
Profile WWW

Joined: Tue Sep 12, 2000 7:01 am
Posts: 11
Location: England
Post Direct3D Screen Transitions
Omen could add it into his FAQ, which I assume is coming on nicely now Supernova has left... [img]images/smiles/icon_biggrin.gif[/img]

Seriously, this is a great idea and I would be willing to contribute.

[ June 21, 2003: Message edited by: Ben ]</p>


Sun Jun 22, 2003 2:21 am
Profile WWW

Joined: Wed Sep 29, 1999 7:01 am
Posts: 59
Location: North Shore City, Auckland, New Zealand
Post Direct3D Screen Transitions
nova ran off with the faq, that's y he left, wanted 2 marry it [img]images/smiles/icon_smile.gif[/img]


Sun Jun 22, 2003 8:14 pm
Profile WWW

Joined: Thu Sep 23, 1999 7:01 am
Posts: 18
Location: Auburn, CA -- USA
Post Direct3D Screen Transitions
At least we didn't start in on the "faq/fag" play on words again. That would have made Omen's comment that much more interesting. [img]images/smiles/icon_smile.gif[/img]

- Chris


Sun Jun 22, 2003 9:54 pm
Profile WWW

Joined: Thu Sep 12, 2002 7:01 am
Posts: 10
Location: Clovis, CA
Post Direct3D Screen Transitions
Well, I got a response from Andre'. It's a no-go. He seemed a bit stressed out or something.

I don't know it the FAQ is really a good place for it anyways. It doesn't really seem like just a question & answer thing. Sometimes people just want to share/show off their code.

Maybe we could post of new thread with the link to a site where they can download...or a site with links to all of our personal download sites. I'd be willing to upkeep the link site, but my web host isn't really good for downloads.
Any thoughts?


Tue Jun 24, 2003 8:51 pm
Profile WWW

Joined: Thu Sep 23, 1999 7:01 am
Posts: 18
Location: Auburn, CA -- USA
Post Direct3D Screen Transitions
I don't think anyone was serious about the FAQ ... it is more of a standing joke around here.

Like I said, I can think about maybe bringing back the archive community. Other than that, our best bet is to just maintain our own sites for the time being.

The main problem no matter the approach (our own site or a central site) is letting the newbies know where to go. Too bad this board sucks feature-wise. I have seen other boards that allow for "announcements" or "sticky" posts - so that they stay at the top of the thread list. This would be best so people can always call up the link location(s).

If I do decide to bring back the archive community it will probably be on a hosted server somewhere instead of at my house. Then, people can go ahead and upload some of their games again. That is probably a few months out though.

- Chris


Tue Jun 24, 2003 11:37 pm
Profile WWW
Display posts from previous:  Sort by  
Reply to topic   [ 21 posts ] 

Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by STSoftware.