Thread: [GD-Windows] .NET main loop
Brought to you by:
vexxed72
From: tweety <mi...@sy...> - 2004-02-18 02:14:25
|
Sorry if this is OT, and if it is, please redirect (IIS joke :) ) to the appropiate list. I'm writing a managed dx9 app and, coming from the c++ world (and seeing the sdk samples), my main loop is: MainForm form=new MainForm(); engine.Init(form); while(form.Created) { engine.Update(); engine.Render(); Application.DoEvents(); } engine.Dispose(); But I read in some blog that DoEvents is bad because it allocates ~200bytes per call (kinda a lot), forcing the form class into gen1 garbage collection. Now I'm asking you: what's the best way to do it? ---------------------------------- Peace and love, Tweety mi...@sy... - twe...@us... YahooID: tweety_04_01 |
From: Jacobo R. <ffe...@ty...> - 2004-02-18 07:27:49
|
You have an alternative method to do the main loop. You can insert a=20 delegate that executes in the idle time of the form. Here are an example=20 but it's write on C# (I use C++ managed too, but with opengl instead dx) http://xplsv.com/blogs/devdiary/ To find the section quickly: CTRL + F and search for "static void main" Jacobo Rodr=EDguez Villar Proyectos en desarrollo: http://www.typhoonlabs.com tweety wrote: > Sorry if this is OT, and if it is, please redirect (IIS joke :) ) to=20 > the appropiate list. > =20 > I'm writing a managed dx9 app and, coming from the c++ world (and=20 > seeing the sdk samples), my main loop is: > =20 > MainForm form=3Dnew MainForm(); > engine.Init(form); > while(form.Created) > { > engine.Update(); > engine.Render(); > Application.DoEvents(); > } > engine.Dispose(); > =20 > But I read in some blog that DoEvents is bad because it allocates=20 > ~200bytes per call (kinda a lot), forcing the form class into gen1=20 > garbage collection. > Now I'm asking you: what's the best way to do it? > =20 > ---------------------------------- > Peace and love, > Tweety > mi...@sy... <mailto:mi...@sy...> -=20 > twe...@us...=20 > <mailto:twe...@us...> > YahooID: tweety_04_01 |
From: tweety <mi...@sy...> - 2004-02-19 02:21:39
|
Thanks. I've been looking for the idle event for some time now :) ---------------------------------- Peace and love, Tweety mi...@sy... - twe...@us... YahooID: tweety_04_01 =20 -----Original Message----- From: gam...@li... [mailto:gam...@li...] On Behalf Of Jacobo Rodriguez Sent: February 18, 2004 2:23 AM To: gam...@li... Subject: Re: [GD-Windows] .NET main loop You have an alternative method to do the main loop. You can insert a delegate that executes in the idle time of the form. Here are an example = but it's write on C# (I use C++ managed too, but with opengl instead dx) http://xplsv.com/blogs/devdiary/ To find the section quickly: CTRL + F and search for "static void main" Jacobo Rodr=EDguez Villar Proyectos en desarrollo: http://www.typhoonlabs.com tweety wrote: > Sorry if this is OT, and if it is, please redirect (IIS joke :) ) to=20 > the appropiate list. > =20 > I'm writing a managed dx9 app and, coming from the c++ world (and=20 > seeing the sdk samples), my main loop is: > =20 > MainForm form=3Dnew MainForm(); > engine.Init(form); > while(form.Created) > { > engine.Update(); > engine.Render(); > Application.DoEvents(); > } > engine.Dispose(); > =20 > But I read in some blog that DoEvents is bad because it allocates=20 > ~200bytes per call (kinda a lot), forcing the form class into gen1=20 > garbage collection. > Now I'm asking you: what's the best way to do it? > =20 > ---------------------------------- > Peace and love, > Tweety > mi...@sy... <mailto:mi...@sy...> -=20 > twe...@us... > <mailto:twe...@us...> > YahooID: tweety_04_01 ------------------------------------------------------- SF.Net is sponsored by: Speed Start Your Linux Apps Now. Build and deploy apps & Web services for Linux with a free DVD software kit from IBM. Click Now! http://ads.osdn.com/?ad_id=1356&alloc_id438&op=3Dick _______________________________________________ Gamedevlists-windows mailing list Gam...@li... https://lists.sourceforge.net/lists/listinfo/gamedevlists-windows Archives: http://sourceforge.net/mailarchive/forum.php?forum_idU5 |
From: Jon W. <hp...@mi...> - 2004-03-03 02:27:04
|
We're porting an OpenGL renderer to Direct3D 8.0. The documentation in concordance with the device caps for a GeForce2 claim that you can configure up to 8 texture stage states, but you can only bind two textures. We have a specific texturing set-up that in OpenGL looks like this: Texture0 \ LERP \ Texture1 / MODULATE -> done Diffuse / This uses 2 texture environments on OpenGL, but it appears that DirectX 8 for fixed-function hardware cannot route two textures to one texture stage state. Thus, we want to use three stage states, in the following configuration: Texture0 \ SELECT1 \ LERP \ Texture1 / MODULATE -> done Diffuse / We can get the first two stages to work fine, but as soon as we turn on the third stage, the operations from the first two stages disappear, and we get solid-white diffuse lit geometry. Note that we get that, even if we choose SELECTARG1 for the operation for the third stage state (i e stage state index 2). We are disabling the stage state with index 3, just to make sure that we've gotten nothing wrong. However, no matter what we do, we can't make this work. We've tried both debug and release DirectX 9.0b runtime (can't downgrade on the development machines to try with 8.0 proper). Right now, we're feeling pretty glum. Any ideas? Cheers, / h+ |
From: Daniel V. <vo...@ep...> - 2004-03-03 10:07:27
|
Jon, you're best off contacting NVIDIA devrel about the issue as there are only a handful 3 stage setups that work on GeForce 1/2 class hardware. Tom's blog <http://tomsdxfaq.blogspot.com/> has a little blurb on the issue. -- Daniel, Epic Games Inc. > -----Original Message----- > From: gam...@li... > [mailto:gam...@li...] On > Behalf Of Jon Watte > Sent: Tuesday, March 02, 2004 9:19 PM > To: gam...@li... > Subject: [GD-Windows] Direct3D 8.0 texture stage states > > > We're porting an OpenGL renderer to Direct3D 8.0. > > The documentation in concordance with the device caps for a > GeForce2 claim > that you can configure up to 8 texture stage states, but you > can only bind > two textures. We have a specific texturing set-up that in > OpenGL looks like > this: > > Texture0 \ > LERP \ > Texture1 / MODULATE -> done > Diffuse / > > This uses 2 texture environments on OpenGL, but it appears > that DirectX 8 > for fixed-function hardware cannot route two textures to one > texture stage > state. Thus, we want to use three stage states, in the following > configuration: > > Texture0 \ > SELECT1 \ > LERP \ > Texture1 / MODULATE -> done > Diffuse / > > We can get the first two stages to work fine, but as soon as > we turn on the > third stage, the operations from the first two stages > disappear, and we get > solid-white diffuse lit geometry. Note that we get that, even > if we choose > SELECTARG1 for the operation for the third stage state (i e > stage state > index 2). > > We are disabling the stage state with index 3, just to make > sure that we've > gotten nothing wrong. However, no matter what we do, we can't > make this > work. We've tried both debug and release DirectX 9.0b runtime (can't > downgrade on the development machines to try with 8.0 proper). > > Right now, we're feeling pretty glum. Any ideas? > > Cheers, > > / h+ > > > > ------------------------------------------------------- > SF.Net is sponsored by: Speed Start Your Linux Apps Now. > Build and deploy apps & Web services for Linux with > a free DVD software kit from IBM. Click Now! > http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click > _______________________________________________ > Gamedevlists-windows mailing list > Gam...@li... > https://lists.sourceforge.net/lists/listinfo/gamedevlists-windows > Archives: > http://sourceforge.net/mailarchive/forum.php?forum_id=555 > |
From: Jon W. <hp...@mi...> - 2004-03-03 17:24:09
|
Thanks all. The surprising thing is that what I'm doing is almost exactly the same thing as mentioned in the examples: add a modulate(current,diffuse) as the third stage. The other surprising thing is that this works fine on OpenGL (and, in fact, you can enable a large number of general combiners on a GF2 in OpenGL). We're using very current drivers (but we're targeting back to version 28.xx, 'cause that's what Dell shipped for one whole YEAR). Multi-passing really isn't much of an option for us. We're already REALLY tied for CPU, as we assumed hardware transform a long time ago, but the mass market still is stuck in the SuperSavage and i845 era. We also have a physics/networking system which requires a fixed update rate, leaving precious little CPU for graphics on min-spec hardware. If there were something like LockArraysEXT() to magically re-use transformed data for multi-passing, maybe it could be made to work, but something like ProcessVertices() doesn't let use re-use the card-specific set-up (texture interpolation values, etc). Perhaps it gets confused by the LERP triadic in the second stage (which uses TEXTURE|REPLICATE_ALPHA for ARG0). Or perhaps I'm not setting alpha in all three stages (but I think I am). I'll investigate some more, and ask our NVIDIA person. Thanks for the pointers, everyone! Cheers, / h+ -----Original Message----- From: gam...@li... [mailto:gam...@li...]On Behalf Of Daniel Vogel Sent: Wednesday, March 03, 2004 2:02 AM To: gam...@li... Subject: RE: [GD-Windows] Direct3D 8.0 texture stage states Jon, you're best off contacting NVIDIA devrel about the issue as there are only a handful 3 stage setups that work on GeForce 1/2 class hardware. Tom's blog <http://tomsdxfaq.blogspot.com/> has a little blurb on the issue. -- Daniel, Epic Games Inc. > -----Original Message----- > From: gam...@li... > [mailto:gam...@li...] On > Behalf Of Jon Watte > Sent: Tuesday, March 02, 2004 9:19 PM > To: gam...@li... > Subject: [GD-Windows] Direct3D 8.0 texture stage states > > > We're porting an OpenGL renderer to Direct3D 8.0. > > The documentation in concordance with the device caps for a > GeForce2 claim > that you can configure up to 8 texture stage states, but you > can only bind > two textures. We have a specific texturing set-up that in > OpenGL looks like > this: > > Texture0 \ > LERP \ > Texture1 / MODULATE -> done > Diffuse / > > This uses 2 texture environments on OpenGL, but it appears > that DirectX 8 > for fixed-function hardware cannot route two textures to one > texture stage > state. Thus, we want to use three stage states, in the following > configuration: > > Texture0 \ > SELECT1 \ > LERP \ > Texture1 / MODULATE -> done > Diffuse / > > We can get the first two stages to work fine, but as soon as > we turn on the > third stage, the operations from the first two stages > disappear, and we get > solid-white diffuse lit geometry. Note that we get that, even > if we choose > SELECTARG1 for the operation for the third stage state (i e > stage state > index 2). > > We are disabling the stage state with index 3, just to make > sure that we've > gotten nothing wrong. However, no matter what we do, we can't > make this > work. We've tried both debug and release DirectX 9.0b runtime (can't > downgrade on the development machines to try with 8.0 proper). > > Right now, we're feeling pretty glum. Any ideas? > > Cheers, > > / h+ > > > > ------------------------------------------------------- > SF.Net is sponsored by: Speed Start Your Linux Apps Now. > Build and deploy apps & Web services for Linux with > a free DVD software kit from IBM. Click Now! > http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click > _______________________________________________ > Gamedevlists-windows mailing list > Gam...@li... > https://lists.sourceforge.net/lists/listinfo/gamedevlists-windows > Archives: > http://sourceforge.net/mailarchive/forum.php?forum_id=555 > ------------------------------------------------------- SF.Net is sponsored by: Speed Start Your Linux Apps Now. Build and deploy apps & Web services for Linux with a free DVD software kit from IBM. Click Now! http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click _______________________________________________ Gamedevlists-windows mailing list Gam...@li... https://lists.sourceforge.net/lists/listinfo/gamedevlists-windows Archives: http://sourceforge.net/mailarchive/forum.php?forum_id=555 |