Fullscreen issues
-
- Posts: 13
- Joined: Tue Jul 19, 2011 10:17 am
- Location: Eindhoven, NL
Fullscreen issues
Hey everybody!
I've been wanting to create a low resolution game to be a bit more like the NES games, however I'm running up against some issues.
When I try to use fullscreen it doesn't seem to be actually going fullscreen. The only thing that's happening is a window is being drawn in the top corner of my screen without any border. I've tried to maximize the window via the device and instead I get something like that:
My Irrlicht device is drawn in the corner and everything else is black.
I've also tried making it not fullscreen and allowing the window to be resized, hoping the device would stretch to match the resolution of the window, which doesn't happen either.
I've tried to peek around the API and in the methods of the interfaces to see but I'm not really sure where else to search, or what to search for. Does anybody have some tips on where to start searching?
I've been wanting to create a low resolution game to be a bit more like the NES games, however I'm running up against some issues.
When I try to use fullscreen it doesn't seem to be actually going fullscreen. The only thing that's happening is a window is being drawn in the top corner of my screen without any border. I've tried to maximize the window via the device and instead I get something like that:
My Irrlicht device is drawn in the corner and everything else is black.
I've also tried making it not fullscreen and allowing the window to be resized, hoping the device would stretch to match the resolution of the window, which doesn't happen either.
I've tried to peek around the API and in the methods of the interfaces to see but I'm not really sure where else to search, or what to search for. Does anybody have some tips on where to start searching?
-
- Admin
- Posts: 14143
- Joined: Wed Apr 19, 2006 9:20 pm
- Location: Oldenburg(Oldb), Germany
- Contact:
Re: Fullscreen issues
What about some code? Though you tell us some details, it's far from knowing what you really do. And even if the code is completely correct, we might still give some hints how to do things better regarding the Irrlicht part.
Re: Fullscreen issues
And for stuff like fullscreen behaviour please also mention the OS you are using. For a quick test if it is working at all use the Irrlicht Demo - that has a fullscreen option. If that's not working there is likely some problem with Irrlicht on your system - if that is working then it's more likely something in your code.
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
-
- Posts: 13
- Joined: Tue Jul 19, 2011 10:17 am
- Location: Eindhoven, NL
Re: Fullscreen issues
Sure, I'm using Windows 7 and the OpenGL driver, as for code there really isn't too much to be shown.hybrid wrote:What about some code? Though you tell us some details, it's far from knowing what you really do. And even if the code is completely correct, we might still give some hints how to do things better regarding the Irrlicht part.
Code: Select all
IrrlichtService * IrrlichtService::instance = NULL;
IrrlichtService * IrrlichtService::Instance()
{
if ( instance == NULL )
instance = new IrrlichtService();
return instance;
}
IrrlichtService::IrrlichtService()
{
irrlichtDevice = createDevice( EDT_OPENGL, // type of renderer
dimension2d<u32>(256,240), // dimension of window
32, // bits
true, // fullscreen
false, // stencil buffer
true, // vsync
NULL );
irrlichtDevice->setResizable(true);
videoDriver = irrlichtDevice->getVideoDriver();
guiEnvironment = irrlichtDevice->getGUIEnvironment();
}
Code: Select all
ITexture * link = video->getTexture("link.png");
while ( service->IsRunning() )
{
video->beginScene(true,true,SColor(255,45,10,10));
video->draw2DImage( link, vector2d<s32>(0,0), rect<s32>(0,0,16,32), 0, SColor(255,255,255,255), true );
video->endScene();
}
The demo is working OK, so I'll check out the source code for that that report back if that was any help, thanks for the tip!CuteAlien wrote:And for stuff like fullscreen behaviour please also mention the OS you are using. For a quick test if it is working at all use the Irrlicht Demo - that has a fullscreen option. If that's not working there is likely some problem with Irrlicht on your system - if that is working then it's more likely something in your code.
Re: Fullscreen issues
That's the thing - the draw2D methods are pixel-accurate.
You can either use your own relative drawing, or render to a RTT of that size, and then render that to the screen to blow it up (without bilinear to make it look blocky).
You can either use your own relative drawing, or render to a RTT of that size, and then render that to the screen to blow it up (without bilinear to make it look blocky).
-
- Posts: 13
- Joined: Tue Jul 19, 2011 10:17 am
- Location: Eindhoven, NL
Re: Fullscreen issues
Is it pixel accurate based on the resolution of the desktop or the resolution that you passed to the createDevice function? I'm not disputing the positioning of things.hendu wrote:That's the thing - the draw2D methods are pixel-accurate.
You can either use your own relative drawing, or render to a RTT of that size, and then render that to the screen to blow it up (without bilinear to make it look blocky).
If I use render to target as well I'd have to either assign that to a sort of ISceneNode* and then work inside a 3D space, or use the draw function again which would be a redudant step (or am I thinking about it incorrectly?)
EDIT: Also on the issue of the fullscreen thing, I can't seem to find anything different that the Demo uses that I don't. The only thing I saw was in the Demo it uses createDeviceEx(), so I switched to that but that also isn't working.
Re: Fullscreen issues
The current resolution of the irrlicht window.Is it pixel accurate based on the resolution of the desktop or the resolution that you passed to the createDevice function? I'm not disputing the positioning of things.
If you tell it to draw a 16x16 picture to position 0x0, it will draw it as 16x16 no matter what your window has been resized to. Anything else would be just weird for normal use.
Sorry, I don't understand you.If I use render to target as well I'd have to either assign that to a sort of ISceneNode* and then work inside a 3D space, or use the draw function again which would be a redudant step (or am I thinking about it incorrectly?)
Re: Fullscreen issues
Is it possible your video card doesn't support your requested resolution? Mine only goes down to 640 x 480 using DirectX. I doubt GL would go lower.
-
- Posts: 13
- Joined: Tue Jul 19, 2011 10:17 am
- Location: Eindhoven, NL
Re: Fullscreen issues
I have an Nvidia GeForce GTX 460, and I get the same result no matter what resolution I use.Mikhail9 wrote:Is it possible your video card doesn't support your requested resolution? Mine only goes down to 640 x 480 using DirectX. I doubt GL would go lower.
-
- Posts: 13
- Joined: Tue Jul 19, 2011 10:17 am
- Location: Eindhoven, NL
Re: Fullscreen issues
Update on the fullscreen issue:
I was having problems even with 640x480 originally (as in not drawing the entire screen, I'm not sure why). I reinstalled my video drivers and now it's working with 640x480. I tried again with 256x240 and got the same issue of not using the entire screen. So Mikhail9 was correct, thanks for the help.
Hendu, I'm assuming you mean something like this?
I have 2 cubes active in my scene right now (I don't have a 3D modeling tool so I'm using addCubeSceneNode and scaling them to the size I want.) But I'm a bit confused about the specific details.
My first cube is the background image:
I've created a cube, scaled it to a window resolution (640x480) and pushed it 1 unit back to compenstate for the Z sticking out 1 unit so that the node face is aligned at Z = 0.
Next I have a cube created for the 'hero' running around the map scaled at 32x32
The binlinear filtering is disabled on both meshes to keep the sharp pixels.
As it is now 1 image pixel = 1 irrlicht pixel ( the images I used were 16x16 that I scaled up myself to 32x32 ). However I'm not entirely sure how to align the camera to always match this. At first I positioned the camera at -640 units on the Z axis, and I get something like this:
So I figured if I divided it in half I'd get the correct pixel ratio, but it's still not fine:
Confused I just randomly pushed the camera back 10 units and this gives me a result in the first screenshots.
I'm guessing this may have something to do with the perspective of the camera? Or I'm not sure about the mathematics behind the positioning.
I was having problems even with 640x480 originally (as in not drawing the entire screen, I'm not sure why). I reinstalled my video drivers and now it's working with 640x480. I tried again with 256x240 and got the same issue of not using the entire screen. So Mikhail9 was correct, thanks for the help.
Hendu, I'm assuming you mean something like this?
I have 2 cubes active in my scene right now (I don't have a 3D modeling tool so I'm using addCubeSceneNode and scaling them to the size I want.) But I'm a bit confused about the specific details.
My first cube is the background image:
Code: Select all
ISceneNode * mapN = scene->addCubeSceneNode( 1.0F );
mapN->setScale( vector3df( 640.0F, 480.0F, 1.0F ) );
mapN->setPosition( vector3d<f32>(0,0,1) );
Next I have a cube created for the 'hero' running around the map scaled at 32x32
Code: Select all
ISceneNode * heroN = scene->addCubeSceneNode( 1.0F );
heroN->setScale( vector3d<f32>( 32.0f, 32.0f, 1.0f ) );
heroN->setPosition( vector3d<f32>(0,0,1) );
As it is now 1 image pixel = 1 irrlicht pixel ( the images I used were 16x16 that I scaled up myself to 32x32 ). However I'm not entirely sure how to align the camera to always match this. At first I positioned the camera at -640 units on the Z axis, and I get something like this:
Code: Select all
camera->setPosition( vector3d<f32>(0,0,-640.0F) );
camera->setTarget( vector3d<f32>(0,0,0) );
So I figured if I divided it in half I'd get the correct pixel ratio, but it's still not fine:
Code: Select all
camera->setPosition( vector3d<f32>(0,0,-320.0F) );
camera->setTarget( vector3d<f32>(0,0,0) );
Confused I just randomly pushed the camera back 10 units and this gives me a result in the first screenshots.
I'm guessing this may have something to do with the perspective of the camera? Or I'm not sure about the mathematics behind the positioning.
Re: Fullscreen issues
use an orthogonal projection matrix.
matrix for has functions for that. buildProjectionMatrixOrthoLH and buildProjectionMatrixOrthoRH
matrix for has functions for that. buildProjectionMatrixOrthoLH and buildProjectionMatrixOrthoRH
We're programmers. Programmers are, in their hearts, architects, and the first thing they want to do when they get to a site is to bulldoze the place flat and build something grand. We're not excited by renovation:tinkering,improving,planting flower beds.
-
- Posts: 13
- Joined: Tue Jul 19, 2011 10:17 am
- Location: Eindhoven, NL
Re: Fullscreen issues
Thanks! Though I don't fully understand it.Sudi wrote:use an orthogonal projection matrix.
matrix for has functions for that. buildProjectionMatrixOrthoLH and buildProjectionMatrixOrthoRH
My vertical pixels are at a 1:1, but my horizontal are pretty off. I'll do a bit of research on this.
Re: Fullscreen issues
make the cube scale 1,1 the otho matrix streches it automaticly
We're programmers. Programmers are, in their hearts, architects, and the first thing they want to do when they get to a site is to bulldoze the place flat and build something grand. We're not excited by renovation:tinkering,improving,planting flower beds.
-
- Posts: 13
- Joined: Tue Jul 19, 2011 10:17 am
- Location: Eindhoven, NL
Re: Fullscreen issues
Well I've seen matricies but I've never really understood it all (reading up on it now). Also with the function I filled in the height for the width and the width for the height by accident.Sudi wrote:make the cube scale 1,1 the otho matrix streches it automaticly
http://www.songho.ca/opengl/gl_projectionmatrix.html
Though now I've got values that seem to at least make sense that I can reproduce consistently across multiple resolutions and my image pixel to screen pixel ration is staying 1:1 with nice sharp pixels (and also in fullscreen):
(I rotated the hero scenenode to make sure the pixels were 1:1)
Thanks for the help everybody!
Re: Fullscreen issues
You're going about it way too difficult
I meant:
1. Draw to a 240x120 (or whatever your target is) texture/RTT, using the standard draw2D calls
2. Blit it to the screen using a screen quad, those are available in the snippets forum
Much simpler.
Of course if you want 3d effects, then this wouldn't be enough.
I meant:
1. Draw to a 240x120 (or whatever your target is) texture/RTT, using the standard draw2D calls
2. Blit it to the screen using a screen quad, those are available in the snippets forum
Much simpler.
Of course if you want 3d effects, then this wouldn't be enough.