Page 1 of 1

changing video driver

Posted: Sat Jun 04, 2011 7:05 pm
by circusdan
I set up a GUI, but when it is loading it is a white screen for a few seconds before it loads the GUI. I was wondering if there is a way to create the device with a NULL driver, then after it loads, switch the driver to the correct one. Or is there any other way of fixing this problem?

Posted: Sat Jun 04, 2011 9:48 pm
by CuteAlien
You could add a loading screen. Loading a single .jpg and displaying that should be fast.

Posted: Sun Jun 05, 2011 3:13 am
by circusdan
I tried that but it wasnt working right. I guess ill try to work with that more

Posted: Sun Jun 05, 2011 3:39 am
by circusdan
I got a loading screen, but its still a white screen for a second or two before the load screen comes on. Anyone know of a way to fix this?

Posted: Sun Jun 05, 2011 7:53 am
by CuteAlien
Can't help without further info/code. 1-2 second whitescreen isn't normal. Do you also get a whitescreen when starting the irrlicht examples?

Posted: Sun Jun 05, 2011 12:07 pm
by circusdan
No the examples run fine, here is my main game code:

#include <stdio.h>
#include <irrlicht.h>
#include "setUpGUI.h"


using namespace irr;

using namespace core;
using namespace scene;
using namespace video;
using namespace io;
using namespace gui;

#ifdef _MSC_VER
#pragma comment(lib, "Irrlicht.lib")
#endif

int runGame()
{
IrrlichtDevice *device =
createDevice(EDT_OPENGL, core::dimension2d<u32>(640, 480), 16, false, false, false, 0);
device->setResizable(true);

if (device == 0)
{
return 1; // could not create selected driver.
}
else
{
//get video driver and scene manager
mydriver = device->getVideoDriver();
myscene = device->getSceneManager();
mygui = device->getGUIEnvironment();

loadScreen(device);
setUpGUI(device);
}
}

My loadScreen() function looks like

IVideoDriver *mydriver;
ISceneManager *myscene;
IGUIEnvironment *mygui;
core::stringw listText = L"Dummy Lobby";
core::stringw wCharString = L"";
core::dimension2d<u32> screenSize;

void RenderAll()
{

mydriver->beginScene(true, true, SColor(255,155,155,155));
myscene->drawAll();
mygui->drawAll();
mydriver->endScene();
}

void loadScreen(IrrlichtDevice *device)
{
screenSize = device->getVideoDriver()->getScreenSize();
IGUIImage *load = mygui->addImage(rect<s32>(0, 0, screenSize.Width, screenSize.Height), 0, 101, L"");
load->setImage(mygui->getVideoDriver()->getTexture(
"C:/Users/DANNY/Documents/Visual Studio 2008/Projects/Fighting Game/Fighting Game/loading_screen.jpg"));
load->setScaleImage(true);
RenderAll();
}


I dont think you need to see my setUpGUI seeing how the loadScreen() has a white screen too and thats first, but i dont see why it would do that, there isnt really a crazy amount of stuff here to load

Posted: Sun Jun 05, 2011 12:10 pm
by circusdan
Nevermind, i take that back, the examples do have the white screen for a couple seconds, they worked fine a few days ago.

Posted: Sun Jun 05, 2011 9:44 pm
by CuteAlien
circusdan wrote:Nevermind, i take that back, the examples do have the white screen for a couple seconds, they worked fine a few days ago.
OK, things are getting strange. Any idea what you did in the meantime? Maybe installed a new Irrlicht version, or a new graphic card driver - anything like that?

Posted: Sun Jun 05, 2011 10:55 pm
by circusdan
I didnt do anything at all, i sent the code to my friend to see if it does it on his computer but he hasnt gotten back to me yet

Posted: Mon Jun 06, 2011 4:10 am
by Iyad
It may be a hardware problem or a coding problem. Did you tried both openGL and directX? Does it give white screens for the 2 drivers?

I think that you just overloaded the application in the beggining (loading tons of stuff and making tons of calculation), just re-check your code, i suggest that you post it all there, I looked quickly in your code and i see that you are calling 1 render (at loadscreen) before loading everything, so this maybe the white-grey screen (155,155,155) before the loading. Im sure that if you put :

Code: Select all

mydriver->beginScene(true, true, SColor(255,0,255,0)); 
instead of

Code: Select all

mydriver->beginScene(true, true, SColor(255,155,155,155)); 
you will see a different screen color (green) before waiting 1-2 seconds, this will mean that there is something wrong with

Code: Select all

setUpGUI(device); 
Ultimately, try to use a debugger.

Posted: Mon Jun 06, 2011 11:11 am
by CuteAlien
Hm, I just run a test with MinGW + gcc 4.5 + Windows 7 and on a 64-bit system ... and got the same trouble - 2 seconds white-screen on start. Unfortunately I have right now so many troubles with that combination that I'll probably be busy debugging other stuff all day.

But could you please tell what's your system and compiler?

edit: ok, I run a few more test - and I think the white background is simply white now in Windows 7 where it was drawing nothing in Windows XP. But the time until it's gone is the time it's doing something - starting a simple example like the first one doesn't show it - only complexer examples which do load stuff first.

Posted: Mon Jun 06, 2011 1:44 pm
by hybrid
Maybe we need to replace/reorder some map/update commands in the window creation section. Could be that there's something missing, or that some window commands have to be changed for Windows7?!

Posted: Mon Jun 06, 2011 1:53 pm
by circusdan
I'm using windows 7 64 bit, but im running 32 bit visual c++. At this point im pretty sure it's my computer, ive tried a bunch of different stuff and it still gives me the white screen, i even tried that green thing, but the loading page comes right up before it turns green. And using different video driver types all give me the same thing, except the software renderer, but im pretty sure that you can render 3d stuff with that right?