Should I begin with DX 9??

Started by
12 comments, last by ProgX 21 years, 4 months ago
hi, i''m new in game programming. I''ve got my first experiences on DirectX 7 and I have already books for DirectX 7. Should I now go on to DirectX 9? What are the differents between DX8 and DX9? Is it easier to understand? Can anybody recommend me some tutorials or books (if some released)? Thanks in advanced --- The three most dangerous things in the world are a programmer with a soldering iron, a hardware type with a program patch and a user with an idea
---The three most dangerous things in the world are a programmer with a soldering iron, a hardware type with a program patch and a user with an idea
Advertisement
i would personally recommend staying with dx7 unless you need the new features. dx8 made 2d a bitch to do because of the directdraw-otomy unless you were a bit of a 3d guru

(medical procedure involving the removal of one''s direct draw interfaces )

im still using dx7 and plan to stay with it until its so out of date that noone will talk to me , in which case i will buy a new pc, learn the latest version and be socially acceptable again

so yeah. and you need books indeed. the directx sdk is sadly lacking in *useful* documentation. unfortunately, being a dx7 diehard, i dont know titles of books
die or be died...i think
dx7 has no shaders
dx8 has first generation shaders
dx8.1 has slightly better shaders
dx9 has cool shaders
die or be died...i think
Yes I prefer the subdivision between DirectDraw and Diretc3D!
But isn''t DX9 faster than DX7?
And can I easily convert my DX 7 programs to DX9?

---
The three most dangerous things in the world are a programmer with a soldering iron, a hardware type with a program patch and a user with an idea
---The three most dangerous things in the world are a programmer with a soldering iron, a hardware type with a program patch and a user with an idea
if you use C#, it might be easier because you won''t have to do as much because of the managed interface.
My answer to your question, yes.

I don''t care if people take this as flame bait or not, don''t even bother with Direct Draw. If you''re looking for simplicity in 2d go to http://www.libsdl.org/ Otherwise just learn how to do 2d using a 3d API

um im not sure about speed - if u have dx8.1 installed, try running dxdiag.exe. that version does dx7 3d test and dx8 3d test - the dx8 one is nearly always slower, but i suppose it depends on your hardware

its slower on our school machines with intel 81820 graphics controllers, anyway :D
die or be died...i think
I recomend doing 2D in direct3D 8 or 9. It's really not hard at all, and you can do some really cool stuff like hardware alpha blending and rotation. Plus you can do really easy line/triangle/square drawing and even fast pixel plotting with DrawPrimitive()

Edit: The tutorials on this sort of thing can be pretty confusing, so maybe this will help get you started.


          //Init - Startup Direct3Dint InitDirect3D (int screenWidth, int screenHeight, D3DCOLOR colourFormat, HWND g_hWnd){	     D3DPRESENTPARAMETERS d3dPresent;     D3DCAPS8 d3dCaps;     	//Make Direct3D object	if(FAILED(d3d = Direct3DCreate8(D3D_SDK_VERSION)))	{		return false;	}	//Setup present parameters	ZeroMemory(&d3dPresent,sizeof(d3dPresent));	d3dPresent.SwapEffect = D3DSWAPEFFECT_FLIP;	d3dPresent.hDeviceWindow = g_hWnd;		                d3dPresent.Windowed = false;	d3dPresent.BackBufferWidth = screenWidth;	d3dPresent.BackBufferHeight = screenHeight;	d3dPresent.BackBufferFormat = colourFormat;	}	//Create rendering device	if(FAILED(d3d->CreateDevice(D3DADAPTER_DEFAULT,D3DDEVTYPE_HAL, 		                        g_hWnd,								D3DCREATE_SOFTWARE_VERTEXPROCESSING,								&d3dPresent,								&d3dDevice)))	{		return false;	}		//Setup render states	d3dDevice->SetRenderState(D3DRS_LIGHTING, FALSE);    d3dDevice->SetRenderState(D3DRS_ALPHABLENDENABLE, TRUE);    d3dDevice->SetRenderState(D3DRS_SRCBLEND, D3DBLEND_SRCALPHA);    d3dDevice->SetRenderState(D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA);	d3dDevice->SetTextureStageState(0, D3DTSS_ALPHAOP, D3DTOP_MODULATE);		//Set vertex shader	d3dDevice->SetVertexShader( D3DFVF_TLVERTEX );	//Success	return true;}//Load texture from file with D3DX//Supported formats: BMP, PPM, DDS, JPG, PNG, TGA, DIBIDirect3DTexture8 *LoadTexture(char *fileName){    IDirect3DTexture8 *d3dTexture;	D3DXIMAGE_INFO SrcInfo;			//Optional	//Use a magenta colourkey    D3DCOLOR colorkey = 0xFFFF00FF;    // Load image from file    if (FAILED(D3DXCreateTextureFromFileEx (d3dDevice, fileName, 0, 0, 1, 0,           D3DFMT_A8R8G8B8, D3DPOOL_MANAGED, D3DX_FILTER_NONE, D3DX_DEFAULT,           colorkey, &SrcInfo, NULL, &d3dTexture)))	{		return NULL;	}	//Return the newly made texture    return d3dTexture;}//Regular blitvoid Blit (IDirect3DTexture8 *texture, RECT *rDest, D3DCOLOR vertexColour,					  float fRotate){	TLVERTEX vertices[4];	//Setup vertices	vertices[0].colour = vertexColour;	vertices[0].x = rDest->left;	vertices[0].y = rDest->top;	vertices[0].z = 0.0f;	vertices[0].rhw = 1.0f;	vertices[0].u = 0.0f;	vertices[0].v = 0.0f;	vertices[1].colour = vertexColour;	vertices[1].x = rDest->right;	vertices[1].y = rDest->top;	vertices[1].z = 0.0f;	vertices[1].rhw = 1.0f;	vertices[1].u = 1.0f;	vertices[1].v = 0.0f;	vertices[2].colour = vertexColour;	vertices[2].x = rDest->right;	vertices[2].y = rDest->bottom;	vertices[2].z = 0.0f;	vertices[2].rhw = 1.0f;	vertices[2].u = 1.0f;	vertices[2].v = 1.0f;	vertices[3].colour = vertexColour;	vertices[3].x = rDest->left;	vertices[3].y = rDest->bottom;	vertices[3].z = 0.0f;	vertices[3].rhw = 1.0f;	vertices[3].u = 0.0f;	vertices[3].v = 1.0f;	//Handle rotation	if (fRotate != 0)	{		float fCenterX, fCenterY;		//Find center of destination rectangle		fCenterX = rDest->left + (rDest->right - rDest->left - 1) / 2;		fCenterY = rDest->top + (rDest->bottom - rDest->top - 1) / 2;		//Rotate vertex 0 - Top left		vertices[0].x = fCenterX + (rDest->left - fCenterX) * sin(fRotate) +			            (rDest->top - fCenterY) * cos(fRotate);		vertices[0].y = fCenterY + (rDest->top - fCenterY) * sin(fRotate) -		                (rDest->left - fCenterX) * cos(fRotate);				//Rotate vertex 1 - Top right		vertices[1].x = fCenterX + (rDest->right - fCenterX) * sin(fRotate) +			            (rDest->top - fCenterY) * cos(fRotate);		vertices[1].y = fCenterY + (rDest->top - fCenterY) * sin(fRotate) -			            (rDest->right - fCenterX) * cos(fRotate);		//Rotate vertex 2 - Bottom right		vertices[2].x = fCenterX + (rDest->right - fCenterX) * sin(fRotate) +			            (rDest->bottom - fCenterY) * cos(fRotate);		vertices[2].y = fCenterY + (rDest->bottom - fCenterY) * sin(fRotate) -			            (rDest->right - fCenterX) * cos(fRotate);		//Rotate vertex 3 - Bottom left		vertices[3].x = fCenterX + (rDest->left - fCenterX) * sin(fRotate) +			            (rDest->bottom - fCenterY) * cos(fRotate);		vertices[3].y = fCenterY + (rDest->bottom - fCenterY) * sin(fRotate) -			            (rDest->left - fCenterX) * cos(fRotate);	}	//Set texture	d3dDevice->SetTexture (0, texture);	//Draw image	d3dDevice->DrawPrimitiveUP (D3DPT_TRIANGLEFAN, 2, vertices, sizeof(TLVERTEX));}      


The rotation kind of sucks, but I dont use it that often. You could probably improve it with matrices or something.

[edited by - glassJAw on December 23, 2002 9:08:01 PM]
sh**.... the people i learnt off were leading me down the garden path then

i had about 10* that much setup code..

ok. my opinion has now officially changed to "use dx8/dx9"

die or be died...i think
Thanks! I didn''t know DX9 was out yet! Only 13 hours left!

Hibiki
Wheres the any key?
www.geocities.com/dragongames123/home.html

INSERT MY OVER-SIZED EXTRAVOGENT PIC HERE:
HibikiWheres the any key?www.geocities.com/dragongames123/home.htmlINSERT MY OVER-SIZED EXTRAVOGENT PIC HERE:

This topic is closed to new replies.

Advertisement