Game Development Community

GetDisplayDeviceList not displaying all devices

by Emil Diego · in Torque Game Engine · 05/25/2005 (11:44 am) · 15 replies

I am writing a Dialog box that lets the user change the graphical settings for the game. I have seen many examples from the SDK.

When I use the getDisplayDeviceList() function. I am only getting back one Device type. It only returns OpenGL.

I have run the demos on my system and when I use the options dialog boxes I get the choice of OpenGL or D3D as my Display Device.

Why does it only return OpenGL when I execute it in my app?

#1
05/25/2005 (12:28 pm)
It looks like getDeviceList() returns a tab delimited (\t) list of rendering devices. "OpenGL" + \t + "D3D" where \t is the character hex value of 0x09.
#2
05/25/2005 (12:30 pm)
When i execute the statement:

echo(getDisplayDeviceList())

the only output I get is:

OpenGL
#3
05/25/2005 (12:42 pm)
Put a break point in the source file in the getDeviceList() function and watch it build the list. If the device list size is really only 1, then you may want to watch the Platform::initWindow function and step into the
Video::installDevice( D3DDevice::create()) call to see where it's failing. You can also turn on verbose logging mode and check the console log file to see if it's writing out a "Accelerated D3D device not detected" message.
#4
05/25/2005 (2:36 pm)
My only insight: http://www.garagegames.com/mg/forums/result.thread.php?qt=25289
#5
05/25/2005 (6:47 pm)
I've tried tracing through the code and It looks ok.

Video::getDeviceList() returns the following string:
OpenGL\tD3D

But by the time the string makes it back to the script it looks like it gets cut short. Anyone have any ideas.
#6
05/25/2005 (8:14 pm)
Hmm, thats really weird. Not that this is much help but when I do echo(getDisplayDeviceList()) I get both OpenGL and D3D back. Did you try running this on another machine to see what you get? Have you made any changes to the engine? Maybe you just have a corrupted build, have you tried cleaning and rebuilding the projects?
#7
05/26/2005 (7:49 am)
I can't tell you why it's happening on your system. It seems to be working fine on ours. I just downloaded the latest HEAD from GG's cvs server, ran the default demo game (starter.fps) and typed this in the console at the main screen: echo( getDisplayDeviceList()); and it printed OpenGL^D3D. I then selected the Rebuild All command for the Torque Demo project, repeated the steps, and it worked again without any problems. I also tried it in both windowed and full screen mode without a problem. I can only suggest that you continue to trace the code in your project and see where it's loosing the D3D part in your version.
#8
05/26/2005 (7:55 am)
Perhaps it won't return D3D as an option if the DirectX drivers are old. What version of DirectX Runtime do you have installed ?
#9
05/26/2005 (8:13 am)
"I have run the demos on my system and when I use the options dialog boxes I get the choice of OpenGL or D3D as my Display Device."

The above statement strongly suggests that the problem lies in your coding attempt.

I'm using DX9.0c
#10
05/26/2005 (9:48 am)
I haven't changes any of the engine code. The only thing that Is different is that I have created my own options dialog. Here is a part of the script code that queries the display devices and outputs the information to a popup contol.

function cbDisplayDevice::init(%this)
{
//* Clear the list
%this.clear();

//* Get the avaialble options.
%buffer = getDisplayDeviceList();
%count = getFieldCount(%buffer);

echo("buffer: |" @ %buffer @ "|");
echo("count: " @ %count);

//* Add the options to the list
for(%i = 0; %i < %count; %i++)
%this.add(getField(%buffer, %i), %i);


//* Check which device is current and select it.
%selId = %this.findText( $currentDisplayDevice );
if ( %selId == -1 )
%selId = 0;
%this.setSelected( %selId );
%this.setText( %this.getTextById( %selId ) );

}


Here is the output from the console:
buffer: |OpenGL |
count: 1
leaving cbDisplayDevice::init() - return
#11
05/26/2005 (10:06 am)
Your code looks correct. Did you try any of the things I suggested?
#12
05/26/2005 (10:07 am)
Todd:

I don't have another machine that I can run it on.

I did try to clean and then rebuild it, but got the same response.
#13
05/26/2005 (2:17 pm)
I just found an issue in my own game where I had not copied the required opengl2d3d dll and the OpenAl dll into the game's working directory. Not having the opengl2d3d dll did not allow an accelerated D3D context to be created. This may be related to your problem Emil.
#14
05/26/2005 (3:42 pm)
Kirk,

Thank you, That fixed my problem. I never copied over the dll's that were in the SDK examples. I thought that the engine was entirely selfcontained. Once I copied over opengl2d3d_debug.dll, glu2d3d.dll, glu2d3d_debug.dll, openAL32.dll, opengl2d3d.dll It worked ok. Do you know what they do? Are there any docs on the dll's that you know of?
#15
05/26/2005 (4:37 pm)
They convert openGL calls to D3D calls, so no DLLs, no D3D support.