Archived

This topic is now archived and is closed to further replies.

Direct3D Immediate mode - Initialising PROBLEM!!!

This topic is 6356 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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();





Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
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....

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
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....

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites