PDA

Click to See Complete Forum and Search --> : DirectX 9, should I upgrade to using it instead of 7?


Electroman
Jan 7th, 2003, 02:59 PM
I've been using DirectX 7 for my games i've made, this is mainly because DirectX8 was meant to have a bad rep for 2D programming and at the moment thats all i'm really doing. But DirectDraw is meant to be back in DirectX9 and I was wondering if theres lots of changes that I could benifit from if I start using DirectX9 instead of 7. I've still got to get round to downloading the SDK for 9 but hopefully I'll get round to it soon.

CornedBee
Jan 7th, 2003, 03:03 PM
I think DX 9 doesn't have real VB support anymore, only .Net. And DirectDraw isn't back. It's not any more or less here than in DX 8. But Direct3D has some changes that make it easier to do 2D with the 3D capabilities.

NoteMe
Jan 7th, 2003, 03:31 PM
Is DX9 out now???? I also heard rumors about DX9 having DDraw...but maybe it's wrong...

Sastraxi
Jan 7th, 2003, 03:54 PM
Does DX9 have hardware rotation for 2D sprites? The way this were handled in DX8 made it very hard to do rotation, however it's easy enough to get around. Having it built-in (and faster) would be a real plus.

CornedBee
Jan 7th, 2003, 04:06 PM
NoteMe: no mention of such a thing in the "What's new?" part.


What's New in DirectX Graphics

--------------------------------------------------------------------------------

This section describes Microsoft® DirectX® graphics features that are new in DirectX 9.0. See what's new in all of DirectX at What's New in DirectX 9.0.

Programming Guide
The programming guide has been reorganized into the following sections to help you find a topic.

Converting to DirectX 9.0 - This page contains hints for converting applications to DirectX 9.0. See Converting to DirectX 9.0.
Getting Started - Fundamental topics for getting started with Microsoft Direct3D®.
Added a new page about DirectX 9.0 style vertex declarations. See Vertex Declaration.

Fixed Function - Covers the functionality of the fixed function pipeline.
Textures section - Added automatic generation of mipmaps. See Automatic Generation of Mipmaps.

Programmable Pipeline - Many new features have been added to the shader models.
Vertex and pixel shaders are no longer referred to with handles; they are objects. There is also a new section detailing the decoupling of vertex shaders and vertex declarations. See Component Object Model (COM) interfaces IDirect3DVertexShader9 and IDirect3DPixelShader9.

Shaders and vertex stream declarations are no longer bound together at creation time. Vertex stream declarations are now expressed as an array of D3DVERTEXELEMENT9 elements. For more information, see Mapping Vertex Declarations and IDirect3DDevice9::SetFVF.

Version 2 vertex shaders (vs_2_0) adds a limited form of flow control (loop...endloop, if...else...endif, and subroutines). Other features include more registers, constant setting methods (IDirect3DDevice9::SetVertexShaderConstantB, IDirect3DDevice9::SetVertexShaderConstantF, and IDirect3DDevice9::SetVertexShaderConstantI), new macro-ops for power, cross product, sign, absolute value, and linear interpolation. See Vertex Shader 2_0.

Version 2 pixel shaders (ps_2_0) decoupled texture data and sampling by creating sampler registers in addition to the texture registers. Increased the instruction count and number of registers. Added float data types. Texture address and arithmetic instructions can now be intermixed. Eliminated all modifiers except negate. New macros and instructions include sincos (sine and cosine), normalization, cross product, power, linear interpolation, projected texture load, and biased level of detail (LOD) texture load. See Pixel Shader 2_0.

Software shaders have been implemented to facilitate shader development without hardware support. The following software versions have been added: vs_2_sw, vs_3_sw, ps_2_sw, ps_3_sw.

Extended shader versions take existing shader versions and extend their functionality if certain caps are set by the hardware. Extended functionality includes features like dynamic flow control, static flow control nesting, gradient instructions, and arbitrary swizzle. For more information, see Vertex Shader 2_0 Extended and Pixel Shader 2_0 Extended.

Version 3 shaders further enhance the functionality of the extended shader versions without requiring caps to be set. Vertex shaders also add new support for vertex texturing, and control over how often vertex shader registers can be set during render calls. For more information, see Vertex Shader 3_0 and Pixel Shader 3_0.

Advanced Topics - Lots of new tools and techniques.
Adaptive tessellation can be applied to high-order primitives including N-patches, rectangle patches, and triangle patches based on the depth value of the control vertex in eye space. See Adaptive Tessellation.
Asynchronous notifications - There are a number of interesting asynchronous queries that could be made on driver status. This new functionality uses new interfaces to add asynchronous query capability. See Asynchronous Notification and IDirect3DQuery9.
Direct3D extensions (D3DX) - Added new functionality to the D3DX library to support new features, things like mesh functions, antialiased line drawing, pixel and vertex shaders, effects, math, and texturing functions. See Other Direct3D Extentions (D3DX).
Displacement mapping - Added support for displacement maps using several single-channel signed formats. See Displacement Mapping.
Gamma correction - Applications can indicate whether a texture is gamma 2.2 corrected (sRGB) or not so that the pipeline can perform gamma-correct blending. See Gamma.
Line drawing - A new interface was added for drawing antialiased lines. See Direct3D Extentions (D3DX) Line Drawing or ID3DXLine.
Multielement textures - This features allows applications to write out multiple elements of a texture simultaneously from a pixel shader. See Multielement Texture.
Multiple render targets - Support for a single render target has been extended to support multiple render targets. See Multiple Render Target.
Multihead - Multihead video cards use a common frame buffer and independent digital-to-analog converters (DACs) to offer more usable multiple-monitor support. See Multihead.
Surface locking behavior - A new locking flag, D3DLOCK_DONOTWAIT, allows an application to gain back CPU cycles if the driver cannot lock the surface immediately. See D3DLOCK.
Scissor test - The pipeline supports a scissor test, implemented with IDirect3DDevice9::SetScissorRect, IDirect3DDevice9::GetScissorRect, and a new render state, D3DRS_SCISSORTESTENABLE.
Tessellation - Tessellator support has been extended to adaptively tessellate and look up per-vertex displacement values from a displacement map. See Tessellation.
Two-sided stencil support - New support is available for adding shadows due to occluding geometry using shadow volumes. See Two-Sided Stencil.
Tutorials, Samples, Tools, and Tips - All the samples and other helpful tips and tools are gathered here. See Tutorials, Samples, Tools, and Tips.
Reference
Many new pages have been added to the reference section including:

Effects - ID3DXEffectCompiler, ID3DXBaseEffect, ID3DXEffect, ID3DXFragmentLinker, and ID3DXInclude. ID3DXSkinMesh was renamed ID3DXSkinInfo.
Effects framework. A new interface, ID3DXEffectCompiler, allows the user to compile an effect from a function or from a vertex shader. The function can be written using the High-Level Shader Language.

High-Level Language Reference - A high-level shader language exists for creating effects from vertex shaders. This gives developers the ability to create effects from a C-like language. For more information, see High-Level Shader Language.
Shader Debugger - An extension to Microsoft Visual Studio® exists to support debugging some types of vertex shaders. For more information, see Shader Debugger.
Other Features
Other new features include the following:

Dirty Regions. IDirect3DDevice9::Present now supports a dirty region by means of the fourth parameter, a pointer to a region.
2-D Support. Added support for a color-converting blit between most types of D3DPOOL_DEFAULT surfaces while using IDirect3DDevice9::StretchRect, and a color fill operation for D3DPOOL_DEFAULT surfaces while using IDirect3DDevice9::ColorFill.
Microsoft Windows® Graphics Device Interface (GDI) Interoperability. Two new methods have been added to get access to device contexts: IDirect3DSurface9::GetDC and IDirect3DSurface9::ReleaseDC.
DrawIndexedPrimitive. IDirect3DDevice9::DrawIndexedPrimitive has been changed to allow batching multiple primitives in the same index buffer without requiring multiple calls to IDirect3DDevice9::SetIndices.
Texgen Mode. The new texgen mode is to support the OpenGL-style sphere map texgen. Requires a new render state: D3DVTXPCAPS_TEXGEN_SPHEREMAP. See D3DVTXPCAPS.
ProcessVertices Behavior Change. This change enables multipass vertex processing and software pre-tessellation shaders. It enables IDirect3DDevice9::ProcessVertices to bypass the clipper and hence not compute the screen coordinates.
Mesh Copy and Update Methods. ID3DXBaseMesh::CloneMesh is used to reformat and change the vertex data layout. For example, use it to to add space for normals, texture coordinates, colors, weights, etc. that were not present before. ID3DXBaseMesh::UpdateSemantics provides a method for updating the vertex declaration with different semantic information, without changing the layout of the vertex buffer. For example, use it to re-label a 3-D texture coordinate as a binormal or tangent, or vice versa.
32-Bit Texture Formats. Two new 32-bit texture formats were added: D3DFMT_A8B8G8R8, D3DFMT_X8B8G8R8. See D3DFORMAT.
Multisampling. A new multisampling control was added to give users control over performance versus quality. See SetDialogBoxMode, SetSampler, GetSamplerState, and D3DSAMPLERSTATE
CreateImageSurface. Removed as a result of adding D3DPOOL_SCRATCH.
Enumeration. IDirect3D9::EnumAdapterModes now takes a D3DFORMAT to support an expanding set of display modes.
Sample Framework. The sample framework now includes a dialog box for supporting user selection of processing type, device type, etc. The sample framework has improved the enumeration of device caps also. See Sample Framework.
Windowed Back Buffers. They can now be of a different format than the display. Added display modes with 10 bits per color channel. Added direct support for multihead adapters.
CopyRects. This has been replaced by IDirect3DDevice9::UpdateSurface.
State Blocks. These are no longer referred to with handles. They are now objects. See IDirect3DStateBlock9.


Sas: haven't looked that much into it, but since DDraw hasn't changed since DX7 I don't think so.

NoteMe
Jan 7th, 2003, 05:05 PM
Thanks CornedBee, if I have half an houre, maybe I will read it all...:)

Sastraxi
Jan 7th, 2003, 08:03 PM
It's not DirectDraw, it's Direct3D (using 3D for 2D).

NoteMe
Jan 8th, 2003, 12:05 AM
Just like DX8 then....Only that this one is for .NET...:(

Machaira
Jan 8th, 2003, 06:52 AM
Uhh, it is DirectDraw - check here - http://msdn.microsoft.com/library/default.asp?url=/library/en-us/directx9_m/directx/ref/ns/microsoft.directx.directdraw.asp

NoteMe
Jan 8th, 2003, 09:04 AM
Yes that was a nice page...(but the link didn't work)...but I belive you...:) I love DDraw....

CornedBee
Jan 8th, 2003, 09:06 AM
Yes and no. This is the DirectDraw class of Managed DirectX, which represents DirectDraw in .Net. But it is not really part of DX9, it only reflects the capabilites of the DX7 DirectDraw into .Net.

There is no IDirectDraw9 interface.

NoteMe
Jan 8th, 2003, 09:07 AM
...hehhe...now it worked...and yes...that looks like DirectDraw...:D

NoteMe
Jan 8th, 2003, 09:08 AM
Originally posted by CornedBee
Yes and no. This is the DirectDraw class of Managed DirectX, which represents DirectDraw in .Net. But it is not really part of DX9, it only reflects the capabilites of the DX7 DirectDraw into .Net.

There is no IDirectDraw9 interface.


I'm so confused:confused: ...can't we just wait and see what we can do with it...:D

CornedBee
Jan 8th, 2003, 09:38 AM
You can do everything with it that you could do with DirectDraw in DX7. No more, no less.

Electroman
Jan 8th, 2003, 04:29 PM
So do I guess that I'll still really be using DirectX7 for DirectDraw but things like D3DSprites i'll be able to use DirectX9, if theres any point? I mean like making if my users will need DirectX9 instead of just DirectX7 when there could be no diffeance if I'm just use 2D.
Oh well, I guess DirectX7 is for me, I also love DirectDraw:D

petrus
Feb 22nd, 2003, 06:53 PM
Originally posted by NoteMe
Just like DX8 then....Only that this one is for .NET...:(

It's not just for .NET, to C++ too! :D
I really hate DDraw... why use DDraw when you can use untransformed vertices in DirectGraphics?

Zaei
Feb 23rd, 2003, 01:36 AM
Originally posted by petrus
It's not just for .NET, to C++ too! :D
I really hate DDraw... why use DDraw when you can use untransformed vertices in DirectGraphics?
There are often times when untransformed vertices will be much slower then a direct pixel for pixel blit. For instance, a wallpaper type background, in DDraw would simply be a pixel for pixel copy, untransformed vertices would still have to to texel to pixel mapping, writing to the z buffer, etc. An obvious waste of time. And you would still be off by .5 pixels =). And thats not even mentioning the creation of the vertex buffer to hold the vertices, the insertion, etc, etc.

Z.

NoteMe
Feb 23rd, 2003, 04:18 AM
Yes I am in with Z there...DDraw is good for what it is built for....;)

petrus
Feb 23rd, 2003, 06:44 AM
Rotation? Alpha blend? Tint?

CornedBee
Feb 23rd, 2003, 07:02 AM
Who does that with wallpapers?

Also, how do I overcome texture size limits when using D3D for 2d?

petrus
Feb 23rd, 2003, 07:05 AM
Originally posted by CornedBee
Who does that with wallpapers?

Also, how do I overcome texture size limits when using D3D for 2d?

Put the texture on two triangles, and scale them.

CornedBee
Feb 23rd, 2003, 07:10 AM
Sure. Scale a 256x256 texture to a 800x600 screen :rolleyes:

petrus
Feb 23rd, 2003, 07:12 AM
Originally posted by CornedBee
Sure. Scale a 256x256 texture to a 800x600 screen :rolleyes:

I meant; scale the triangles.
It's very easy, make two triangles that form a rectangle that's filling the screen, and then apply a texture.

NoteMe
Feb 23rd, 2003, 08:16 AM
So why go to the trouble of making the triangles in the first place. When you can just Blt it to the screen with DDraw...:rolleyes:

CornedBee
Feb 23rd, 2003, 08:56 AM
But many video cards don't allow me to apply a texture larger than 256x256 to any triangles, so if I scale those two triangles the texture will be stretched and will look ugly. How do I avoid that?

petrus
Feb 23rd, 2003, 01:03 PM
Originally posted by CornedBee
But many video cards don't allow me to apply a texture larger than 256x256 to any triangles, so if I scale those two triangles the texture will be stretched and will look ugly. How do I avoid that?

You can plot pixels in Direct 3D too...
But, is there any rotation and alpha blend in Direct Draw?

NoteMe
Feb 23rd, 2003, 01:39 PM
I don't know about alfa blend, but you don't use it in a 2D arcade game anyway. But you can rotate it. That is for sure...;)

petrus
Feb 23rd, 2003, 01:40 PM
Originally posted by NoteMe
I don't know about alfa blend, but you don't use it in a 2D arcade game anyway. But you can rotate it. That is for sure...;)

Don't use alpha blend? How do you make shadows then?:confused:

CornedBee
Feb 23rd, 2003, 04:49 PM
Shadows in 2d arcade?

And why would I use alpha blend or rotation for my background image?


And how do I plot pixels in D3D?

petrus
Feb 23rd, 2003, 04:54 PM
What background are you talking about?
Ploting pixels is just easy, lock the backbuffer and take that lockedrect, and you access the backbuffer as an array with all pixels.

CornedBee
Feb 23rd, 2003, 05:05 PM
How can I lock in D3D?
Those are serious questions btw, I really want to know.

Zaei
Feb 23rd, 2003, 05:14 PM
Originally posted by petrus
What background are you talking about?
Ploting pixels is just easy, lock the backbuffer and take that lockedrect, and you access the backbuffer as an array with all pixels.
Which, of course, is slow.

You seem to be missing the point. DirectGraphics may be nice, it may give you access to hardware alphablending and rotation, but in other situations, it falls apart (CornedBee has pointed out one).

Z.

petrus
Feb 23rd, 2003, 07:21 PM
Originally posted by CornedBee
How can I lock in D3D?
Those are serious questions btw, I really want to know.

VisualBasic or C++?

NoteMe
Feb 23rd, 2003, 07:24 PM
And as CornedBee said why would you use Alfa blend in a 2D arcade game...how many 2D arcade games have shadows?

petrus
Feb 23rd, 2003, 07:26 PM
Originally posted by NoteMe
And as CornedBee said why would you use Alfa blend in a 2D arcade game...how many 2D arcade games have shadows?

And, you can make cool effects with alpha blend, such as smoke or cool HUD's.

Zaei
Feb 23rd, 2003, 07:28 PM
The various LockRect() functions.

Z.