DirectX Issue (OpenGL works fine...)

BlitzMax Forums/BlitzMax Beginners Area/DirectX Issue (OpenGL works fine...)

Pragun(Posted 2006) [#1]
Hey guys,
In my game I have directx and opengl as options the user can set. They can also set the resolution. Everything works fine with OpenGL...but it doesn't work at all with directX.
The funny thing is though, directx used to work when I had the older version of the compiler (1.10).
I just updated to 1.16 and there are no compile errors with the graphics stuff, but it just doesn't seem to like directx.

On startup:
If opengl=0 Then
SetGraphicsDriver D3D7Max2DDriver()
Else
SetGraphicsDriver GLMax2DDriver()
End If

...

Function setGLProject()

	SetGraphicsDriver GLMax2DDriver()
	
	glMatrixMode GL_PROJECTION
	glLoadIdentity
	glOrtho 0,640,480,0,-1,1
	glMatrixMode GL_MODELVIEW
End Function

Function setDXProject()

	SetGraphicsDriver D3D7Max2DDriver()

	Global matrix#[],depth=2
	matrix=[..
	2.0/640,0.0,0.0,0.0,..
	0.0,-2.0/480,0.0,0.0,..
	0.0,0.0,2.0/depth,0.0,..
	-1-(1.0/640),1+(1.0/480),1.0,1.0]

	primarydevice.Device.SetTransform(D3DTS_PROJECTION,matrix)
End Function

...

Global Width=640
Global Height=480

If fullscreen=0 Then
Graphics resolution,.75*resolution,0,60
Else
Graphics resolution,.75*resolution,32,60
End If


If opengl=0 Then
setDXProject()
Else
setGLProject()
End If


in the options screen:


			If opengl=0 Then opengl=1 Else opengl=0
			If opengl=1 Then
				setGLProject()
			End If
			?Win32
			If opengl=0 Then
				setDXProject()
			End If
			?



ideas on why dx would not work?
I'm testing on winxp (mce), p4 3.4ghz 1gb ram w/ati radeon x600xt


Yan(Posted 2006) [#2]
This work fine for me with 1.16...




Pragun(Posted 2006) [#3]
were there any things to look out for on how dx might have changed btw 1.10 and 1.16?


Pragun(Posted 2006) [#4]
actually...it was my mistake...if i have the game load up w/forced directx..then it works as well...except the directx seems to be going as fast as possible, and not at the assigned 60fps.

also, in game, if i try to switch from opengl to dx, or vice versa, it crashes.

didn't happen in 1.10. suggestions?