Sign in to follow this  

SDL with DirectX

This topic is 4379 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

I first start off by: SDL_SysWMinfo m_Info; SetEnvironmentVariable("SDL_VIDEODRIVER", "directx"); SDL_Init(SDL_INIT_VIDEO | SDL_INIT_NOPARACHUTE) atexit(SDL_Quit); SDL_SetVideoMode( 800, 600, 0,0); SDL_VERSION(&m_Info.version); SDL_GetWMInfo(&m_Info); // Create Device m_pD3dCOM = Direct3DCreate9(D3D_SDK_VERSION); D3DPRESENT_PARAMETERS d3dpp; ZeroMemory(&d3dpp, sizeof(D3DPRESENT_PARAMETERS)); d3dpp.hDeviceWindow = m_Info.window; d3dpp.Windowed = true; d3dpp.BackBufferCount = 1; d3dpp.Flags = 0; d3dpp.FullScreen_RefreshRateInHz = D3DPRESENT_RATE_DEFAULT; d3dpp.MultiSampleQuality = 0; d3dpp.PresentationInterval = D3DPRESENT_INTERVAL_IMMEDIATE; d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD; D3DDISPLAYMODE d3ddm; m_pD3dCOM->GetAdapterDisplayMode(D3DADAPTER_DEFAULT, &d3ddm))) m_BPP = GetBPPfromFormat(d3ddm.Format); SetPixelFormat(GetFormatfromBPP(m_BPP)); d3dpp.BackBufferFormat = m_PixelFormat; if (m_bZBuffer) { m_StencilFormat = D3DFMT_D24S8; d3dpp.AutoDepthStencilFormat = m_StencilFormat; } d3dpp.EnableAutoDepthStencil = true; d3dpp.BackBufferHeight = 800; d3dpp.BackBufferWidth = 600; d3dpp.MultiSampleType = m_SampleType; m_pD3dCOM->CreateDevice(D3DADAPTER_DEFAULT, m_DevType,m_Info.window, (DWORD)m_VP,&d3dpp, &m_pD3dDeviceCOM)

Share this post


Link to post
Share on other sites
i dont know much about directX, but i read once that the SDL library inherits a copy of the enviormental variables, and that any attempts to change them wont affect those in the SDL dll:

Quote:

SetEnvironmentVariable("SDL_VIDEODRIVER", "directx");


this needs to be done either before the program using the dll is loaded or by specifing them in the system enviorment...

maybe thats changed though

[Edited by - rip-off on December 18, 2005 7:39:40 PM]

Share this post


Link to post
Share on other sites
Quote:
Original post by EvilKnuckles666
i have that line being called right from the beginning


that has no affect, the values are copied _before_ execution starts, so your program and SDL have different ones, and changes in one will not affect the other.

the articles linked above didnt contain any code to change the environment that i could see...

Share this post


Link to post
Share on other sites
Quote:
Original post by rip-off
Quote:
Original post by EvilKnuckles666
i have that line being called right from the beginning


that has no affect, the values are copied _before_ execution starts, so your program and SDL have different ones, and changes in one will not affect the other.

the articles linked above didnt contain any code to change the environment that i could see...


Why do you want to change the environment?

Apart from that, on first glance your D3D initialization looks okay.

Have you tried D3DFMT_D16 for your m_StencilFormat variable?

Can you post some more code around your actual rendering code?

Share this post


Link to post
Share on other sites
well, turns out i accidently still had the WinMain crap still in there, but now i'm getting some symbol errors:

Particle System error LNK2005: "private: __thiscall type_info::type_info(class type_info const &)" (??0type_info@@AAE@ABV0@@Z) already defined in LIBCMT.lib(typinfo.obj)
Particle System error LNK2005: "private: class type_info & __thiscall type_info::operator=(class type_info const &)" (??4type_info@@AAEAAV0@ABV0@@Z) already defined in LIBCMT.lib(typinfo.obj)
Particle System error LNK2005: _exit already defined in LIBCMT.lib(crt0dat.obj)
Particle System error LNK2005: _strncpy already defined in LIBCMT.lib(strncpy.obj)
Particle System error LNK2005: __isctype already defined in LIBCMT.lib(isctype.obj)
Particle System warning LNK4031: no subsystem specified; CONSOLE assumed
Particle System warning LNK4098: defaultlib 'msvcrt.lib' conflicts with use of other libs; use /NODEFAULTLIB:library

Share this post


Link to post
Share on other sites

This topic is 4379 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this