Direct3D Immediate mode - Initialising PROBLEM!!!

Started by
8 comments, last by Memir 23 years, 9 months ago
The hardest part of 3D, IMO, has to be the initialising - Nothing related to vectors, cross products etc. Just the fact that the interfaces are so screwed up: Okay, when I do: HRESULT hr; hr = lpdd->QueryInterface(IID_IDirect3D7, (void **)&lpd3d); I compile and excute the code, but for some reason I get an Error, where hr=E_NOINTERFACE. But, when I do: HRESULT hr; hr = lpdd->QueryInterface(IID_IDirect3D3, (void **)&lpd3d); I compile and excute the code, but this time to my amazement it works, i.e hr=S_OK. I have the Direct 7a Runtime installed, aswell as the SDK. But for some reason this DirectX crap doesn''t allow me to use the Ver 7.0 interface of Direct 3D. I don''t want to use the other versions (3.0 etc), because I don''t have no reference to those. If no-one else knows how to solve this stupid idiotic F***''ed up problem then can they just tell me this: HRESULT CreateDevice(????); ( IDirect3D3::CreateDevice ) wtf is the parameters for this. I already know the prototype (and hence the parameters) for IDirect3D7::CreateDevice (since I have the information in the DX7 Refrence), I need to know the prototype for IDirect3D3::CreateDevice. No wonder why people use OpenGL... Direct3D doesn''t even let people get thru the initialisation, let alone near any of the TRUE 3D functions. /Memir
Flash Pool - Pool/Billiards game for Facebook (developed by Memir).
Advertisement
It''s ok dewds. I solved the problem a couple mins later.

The Problem was, I was using ''DirectDrawCreate()'' to get my directdraw interface (lpdd). I read in the small print/link inside the reference that you need to use ''DirectDrawCreateEx()'' instead of ''DirectDrawCreate()'' in order to access the IID_IDirect3D7 interface.

So for anyone else who falls in the same ''Rabbit Hole'' as me:

If you want to access Direct3D V.7 interface make sure you use DirectDrawCreateEx() instead of DirectDrawCreate. I know it''s messed up, but they (Microsoft) make up the rules.

/Memir
Flash Pool - Pool/Billiards game for Facebook (developed by Memir).
If you want to make your life easier, try checking out the D3DX inititalization routines. Your initialization code will go down considerably. Just a few lines of code, and you''ll be set to get to the fun stuff.

For example, (this is off the top of my head and untested)

D3DXInitialize();

D3DXCreateContext(D3DX_DEFAULT, D3DX_CONTEXT_FULLSCREEN,
hWnd, 640,480, &lpContext);

pDevice = pContext->GetD3DDevice();





D3DX still has some bugslies in it

oh yeah, does someone know how directgrphics will look
Actually I tried the quick & easy D3DX functions. However for some reason mine failed near the very start:

D3DXCreateContext(D3DX_DEFAULT, D3DX_CONTEXT_FULLSCREEN,
hWnd, 640,480, &lpContext);

When I tried that it would''nt give me the context so I said FuÇK it.

I checked out Direct3D Retained mode - basically the DX7 Reference said this is shit for games [Designed for Apps].
So I decided to use Direct3D Immediate mode, because they say this is the best for High performance games.

Anyway, the progress on my 3D has improoved considerbly. I can now draw boxes on the screen (built up from triangles), which implies I can make any mesh. I''ve also sorted out FOG, the Camera, projection, all translations. Now I''ve just gotta sort out the Textures.

So I must say, all this progress in just 24 Hours, IMO, Direct3D Immediate mode is piss easy (well compared to coding on the N64 lol).

I''ve got another question anyway:

How do I create a texture surface e.g 64x64 insize (using the DirectDraw). Then change the texture data. I''m not interrested in using some shitty Load_Bitmap_using_microshit_funcs("mybitmap.bmp"...);.

Okay I''m gonna have my dinner, when I check back I''ll look forward to some responses

/Memir
Flash Pool - Pool/Billiards game for Facebook (developed by Memir).
Create a DirectDrawSurface with the DDSCAPS_TEXTURE bit set (think I got the cap-name right)..
Then Lock() the surface and do whatever you want with it it.

Or you can use BitBlt() to blt from a windows dc to a DirectDrawSurface dc, retrieved through DirectDrawSurrface::GetDC().

Hope this helps....
Damn dewd!!!!... That''s all you had to say!!!

(Thanks)

/Memir
Flash Pool - Pool/Billiards game for Facebook (developed by Memir).
Try using D3DXCreateContextEx
It lets you specify alot more options, and remember to call D3DXInitialize before creating a context.

(For some strange reason the D3DXInitialize didn''t initialize anything when I called it from a dll''s DllMain, upon recieving a DLL_PROCESS_ATTACH message. I had to move it to just before the call to D3DXCreateContextEx, and then everything worked as a charm)

Or why not try OpenGL, its really easy to initialize and the rest is a cakewalk too....
I feel like I''ve got ALL the access codes to Zion now - Texturing, Fog effects, Lighting, almost everything I need to compete with the likes of Unreal Tourney etc. I''m gonna put up a little Demo on my website later on today so check it out, tell me whether it worked properly etc.

Memir Web Site

The next thing I''m going to be looking into is porting Meshes & Animations / Textures from a 3D package e.g 3dsMAX to a suitable format. What I''m looking for is:


1) A 3dsMAX (r3.1) plugin/Max Script which converts from .MAX to ???
2) A 3dsMAX (r3.1) external program?? which does this conversion.

3) Any other 3d Design packages which come with / have downloadable Mesh converters.

4) Anywhere url?? that I can obtain information on 3dsMAX''s Max-Script - a reference to all the functions, and some basic teaching guide.

Thanks Guys.

/Memir
Flash Pool - Pool/Billiards game for Facebook (developed by Memir).
Hey, could you send me some D3D init code? Try as I may, I can never seem to make it work at all! Jeez, I''m starting to think of doing 3d myself in DDraw (very ironically) if I can''t figure this out soon. I''m pretty frustrated right now.

please help!

~BenDilts( void );
benbeandogdilts@cs.com

This topic is closed to new replies.

Advertisement