• Announcements

    • khawk

      Download the Game Design and Indie Game Marketing Freebook   07/19/17

      GameDev.net and CRC Press have teamed up to bring a free ebook of content curated from top titles published by CRC Press. The freebook, Practices of Game Design & Indie Game Marketing, includes chapters from The Art of Game Design: A Book of Lenses, A Practical Guide to Indie Game Marketing, and An Architectural Approach to Level Design. The GameDev.net FreeBook is relevant to game designers, developers, and those interested in learning more about the challenges in game development. We know game development can be a tough discipline and business, so we picked several chapters from CRC Press titles that we thought would be of interest to you, the GameDev.net audience, in your journey to design, develop, and market your next game. The free ebook is available through CRC Press by clicking here. The Curated Books The Art of Game Design: A Book of Lenses, Second Edition, by Jesse Schell Presents 100+ sets of questions, or different lenses, for viewing a game’s design, encompassing diverse fields such as psychology, architecture, music, film, software engineering, theme park design, mathematics, anthropology, and more. Written by one of the world's top game designers, this book describes the deepest and most fundamental principles of game design, demonstrating how tactics used in board, card, and athletic games also work in video games. It provides practical instruction on creating world-class games that will be played again and again. View it here. A Practical Guide to Indie Game Marketing, by Joel Dreskin Marketing is an essential but too frequently overlooked or minimized component of the release plan for indie games. A Practical Guide to Indie Game Marketing provides you with the tools needed to build visibility and sell your indie games. With special focus on those developers with small budgets and limited staff and resources, this book is packed with tangible recommendations and techniques that you can put to use immediately. As a seasoned professional of the indie game arena, author Joel Dreskin gives you insight into practical, real-world experiences of marketing numerous successful games and also provides stories of the failures. View it here. An Architectural Approach to Level Design This is one of the first books to integrate architectural and spatial design theory with the field of level design. The book presents architectural techniques and theories for level designers to use in their own work. It connects architecture and level design in different ways that address the practical elements of how designers construct space and the experiential elements of how and why humans interact with this space. Throughout the text, readers learn skills for spatial layout, evoking emotion through gamespaces, and creating better levels through architectural theory. View it here. Learn more and download the ebook by clicking here. Did you know? GameDev.net and CRC Press also recently teamed up to bring GDNet+ Members up to a 20% discount on all CRC Press books. Learn more about this and other benefits here.


  • Content count

  • Joined

  • Last visited

Community Reputation

100 Neutral

About fox2

  • Rank
  1. I'm creating a graphical foundation for a primarily 2D application (porting some basic GDI+ code as well). I want the ability to use all of the D3D features that are out of reach if I use Direct2D alone. So an example might be: 1. Draw geometry with D2D 2. Draw 3D geometry with D3D 3. Blur the buffer with a D3D Effect (there is a gaussian blur effect file in the DirectX "PostProcess" sample) 4. Draw some text with DirectWrite My preference is to create SlimDX code that is equivalent to the native code in Microsoft's example: http://msdn.microsoft.com/en-us/library/dd371004(VS.85).aspx I'd be wary of any alternative approaches because that would likely mean a significantly larger memory footprint. I'm a bit on the bleeding edge but I think a SlimDX code example in this spirit would be beneficial to a wide audience... especially when Windows 7 starts to pick up.
  2. Thanks for your response. I've tried removing the GetBuffer call with the Resource class and then I end up with memory issues down the road. As a newbie to DirectX I've been able to extend SlimDX D3D examples just fine... and SlimDX D2D samples just fine. I just can't get D3D and D2D interop (w/SlimDX) working... so frustrating. I'm willing to offer up a bounty on it...is anyone willing to put together an example for me? I'm good for $35 (paypal).
  3. The error I get when trying to use GetBuffer with *any* class is that method "FromPointerReflectionThunk" does not exist. And after searching the code base the method is no where to be found. I guess it's meant to be a placeholder? I'm trying to write SlimDX code that would be equivalent to the Direct2D / Direct3D interop example that Microsoft has posted: http://msdn.microsoft.com/en-us/library/dd371004(VS.85).aspx Here's my C# code: //References using SlimDX.Direct2D; using D3D10 = SlimDX.Direct3D10; using DXGI = SlimDX.DXGI; //Declarations DXGI.SwapChain m_swapChain; D3D10.Device m_device; D3D10.RenderTargetView m_renderTarget; SlimDX.Direct2D.Factory m_direct2DFactory; SlimDX.DirectWrite.Factory m_directWriteFactory; RenderTarget m_windowRenderTarget; //Execution code //Setup Direct3D DXGI.SwapChainDescription swapChainDescription = new SlimDX.DXGI.SwapChainDescription(); DXGI.ModeDescription modeDescription = new DXGI.ModeDescription(); DXGI.SampleDescription sampleDescription = new DXGI.SampleDescription(); modeDescription.Format = DXGI.Format.R8G8B8A8_UNorm; modeDescription.RefreshRate = new Rational(60, 1); modeDescription.Scaling = DXGI.DisplayModeScaling.Unspecified; modeDescription.ScanlineOrdering = DXGI.DisplayModeScanlineOrdering.Unspecified; modeDescription.Width = this.ClientRectangle.Width; modeDescription.Height = this.ClientRectangle.Height; sampleDescription.Count = 1; sampleDescription.Quality = 0; swapChainDescription.ModeDescription = modeDescription; swapChainDescription.SampleDescription = sampleDescription; swapChainDescription.BufferCount = 1; swapChainDescription.Flags = DXGI.SwapChainFlags.None; swapChainDescription.IsWindowed = true; swapChainDescription.OutputHandle = this.Handle; swapChainDescription.SwapEffect = DXGI.SwapEffect.Discard; swapChainDescription.Usage = DXGI.Usage.RenderTargetOutput; D3D10.Device.CreateWithSwapChain(null, D3D10.DriverType.Hardware, D3D10.DeviceCreationFlags.Debug | D3D10.DeviceCreationFlags.BgraSupport, swapChainDescription, out m_device, out m_swapChain); D3D10.Texture2DDescription t2d = new D3D10.Texture2DDescription(); t2d.ArraySize = 1; t2d.BindFlags = SlimDX.Direct3D10.BindFlags.DepthStencil; t2d.CpuAccessFlags = SlimDX.Direct3D10.CpuAccessFlags.None; t2d.Format = SlimDX.DXGI.Format.D16_UNorm; t2d.Height = this.ClientRectangle.Height; t2d.Width = this.ClientRectangle.Width; t2d.MipLevels = 1; t2d.SampleDescription = new SlimDX.DXGI.SampleDescription(1, 0); t2d.Usage = SlimDX.Direct3D10.ResourceUsage.Default; D3D10.Texture2D m_depthStencil = new D3D10.Texture2D(m_device, t2d); //m_resource = new D3D10.RenderTargetView(m_device, m_depthStencil); D3D10.RenderTargetViewDescription renderDesc = new SlimDX.Direct3D10.RenderTargetViewDescription(); renderDesc.Format = SlimDX.DXGI.Format.R8G8B8A8_UNorm; renderDesc.Dimension = SlimDX.Direct3D10.RenderTargetViewDimension.Texture2D; renderDesc.MipSlice = 0; D3D10.Resource m_resource = m_swapChain.GetBuffer<D3D10.Resource>(0); D3D10.RenderTargetView m_renderTargetView = new SlimDX.Direct3D10.RenderTargetView(m_device, m_resource, renderDesc); D3D10.DepthStencilViewDescription depthViewDesc = new SlimDX.Direct3D10.DepthStencilViewDescription(); depthViewDesc.Format = SlimDX.DXGI.Format.D16_UNorm; depthViewDesc.Dimension = SlimDX.Direct3D10.DepthStencilViewDimension.Texture2D; depthViewDesc.MipSlice = 0; D3D10.DepthStencilView m_depthStencilView = new SlimDX.Direct3D10.DepthStencilView(m_device, m_depthStencil, depthViewDesc); m_device.OutputMerger.SetTargets(m_depthStencilView); D3D10.Viewport m_viewArea = new D3D10.Viewport(); m_viewArea.X = 0; m_viewArea.Y = 0; m_viewArea.Width = this.ClientRectangle.Width; m_viewArea.Height = this.ClientRectangle.Height; m_viewArea.MinZ = 0.0f; m_viewArea.MaxZ = 1.0f; m_device.Rasterizer.SetViewports(m_viewArea); DXGI.Surface m_surface = m_swapChain.GetBuffer<DXGI.Surface>(0); RenderTargetProperties rp = new RenderTargetProperties(); rp.HorizontalDpi = 96; rp.VerticalDpi = 96; rp.MinimumFeatureLevel = FeatureLevel.Default; rp.PixelFormat = new PixelFormat(){ AlphaMode = AlphaMode.Premultiplied, Format = SlimDX.DXGI.Format.R8G8B8A8_UNorm }; rp.Type = RenderTargetType.Default; rp.Usage = RenderTargetUsage.None; m_windowRenderTarget = RenderTarget.FromDXGI(m_direct2DFactory, m_surface, rp); [Edited by - jpetrie on July 23, 2009 4:02:02 PM]
  4. SlimDX is great but there are some parts of the library that are not complete. In particular there seems to be a problem with pointer handling and pointer type conversion. The particular SlimDX code in question is in the GetBuffer method of the SwapChain (D3D10): generic< class T > where T : ComObject, ref class T SwapChain::GetBuffer( int index ) { IUnknown* unknown = 0; GUID guid = Utilities::GetNativeGuidForType( T::typeid ); RECORD_DXGI( InternalPointer->GetBuffer( index, guid, reinterpret_cast<void**>( &unknown ) ) ); if( Result::Last.IsFailure ) return T(); BindingFlags flags = BindingFlags::Static | BindingFlags::InvokeMethod | BindingFlags::NonPublic; array<Object^>^ args = gcnew array<Object^>( 1 ); args[ 0 ] = IntPtr( unknown ); // Trying to invoke "FromPointer" directly will choose the IntPtr overload since it's more // cumbersome to pass a native pointer as an argument here. The IntPtr overload is intended // to be the user-pointer overload, however, which isn't what we want; thus the thunk. T result = safe_cast<T>( T::typeid->InvokeMember( "FromPointerReflectionThunk", flags, nullptr, nullptr, args, CultureInfo::InvariantCulture ) ); return result; } I need to call GetBuffer with the Surface class as well as the Resource class. Are there any SlimDX experts that have time to help? Why isn't this code base something used often by the SlimDX community?
  5. DieterVW: Thanks for the reply! Given your input I suspect my hardware (570M laptop nvidia) does not support BGRA. When I try to create a simple D3D10 device using (SlimDX value) B8G8R8A8_UNorm I get an exception. So interop will be limited to newer graphics hardware, even if it supports DirectX10+? Do you have a general sense of BGRA adoption (% of machines, % of new machines)? Promit: I'm a new SlimDX junkie. Please bring forth the goodness. I've scoured the Web and I can't find anyone who's actually using SlimDX for interop.
  6. My needs are primarily 2D (hooray for D2D and DWrite!) but I've run into a scenario (and probably future scenarios) where I need use the 3D pipeline (pixel shaders and effects). Does anyone have a SlimDX example for interop? I run into parameter problems using the fromDXGI method... I did notice the CREATE_DEVICE enumeration is missing a value for D3D10_CREATE_DEVICE_BGRA_SUPPORT. From the DirectX code: typedef enum D3D10_CREATE_DEVICE_FLAG { D3D10_CREATE_DEVICE_SINGLETHREADED = 0x1, D3D10_CREATE_DEVICE_DEBUG = 0x2, D3D10_CREATE_DEVICE_SWITCH_TO_REF = 0x4, D3D10_CREATE_DEVICE_PREVENT_INTERNAL_THREADING_OPTIMIZATIONS = 0x8, D3D10_CREATE_DEVICE_ALLOW_NULL_FROM_MAP = 0x10, D3D10_CREATE_DEVICE_BGRA_SUPPORT = 0x20 } D3D10_CREATE_DEVICE_FLAG; 1) Is this flag value critical? Do I need to modify and build SlimDX to get interop working or is there a work-around I can use with the March release binaries? Yeah you guessed it--I'm lazy. 2) I liked the simple begin-draw, end-draw box. Now I have a swap chain (yeah I'm not a 3d guy) and some other luggage. What's the overhead with using interop? I want to say the answer is almost none--because behind the scenes Direct2D has to have all of the D3D stuff loaded right? Anyone with deep understanding have usage guidelines with regards to interop? Why oh why can't I have power and simplicity? :)