Hi!.
I am developing a 2d game with Irrlicht and is a resolution of 160x144.
It is assumed that with the setViewport, could change the size of the view but I can not increase in a window 320x288 in order to see the larger region. I want to increase a region of the window to fill the window.
Someone can help me?
[with fix] Increase the viewport region
-
- Competition winner
- Posts: 80
- Joined: Tue Jun 29, 2010 10:06 pm
- Location: Valencia, Spain
[with fix] Increase the viewport region
Last edited by TheMrCerebro on Wed Aug 17, 2011 5:32 pm, edited 1 time in total.
Follow me on twitter: @themrcerebro
-
- Admin
- Posts: 14143
- Joined: Wed Apr 19, 2006 9:20 pm
- Location: Oldenburg(Oldb), Germany
- Contact:
Re: Increase the viewport region
No, setViewport can set a new render area inside the original window. This creates a partial render area, which uses the original resolution again in the smaller area. It is, e.g., used for multi-view games as shown in example 18.
-
- Competition winner
- Posts: 80
- Joined: Tue Jun 29, 2010 10:06 pm
- Location: Valencia, Spain
Re: [SOLVED] Increase the viewport region
Already is solved (but I had to modify the function setViewPort.
only for 2D with OpenGL.
only for 2D with OpenGL.
Code: Select all
void COpenGLDriver::setViewPort(const core::rect<s32>& area)
{
core::rect<s32> vp = area;
core::rect<s32> rendert(0,0, getCurrentRenderTargetSize().Width, getCurrentRenderTargetSize().Height);
//vp.clipAgainst(rendert); <----------------------------------------
if (vp.getHeight()>0 && vp.getWidth()>0)
glViewport(vp.UpperLeftCorner.X,
getCurrentRenderTargetSize().Height - vp.UpperLeftCorner.Y - vp.getHeight(),
vp.getWidth(), vp.getHeight());
ViewPort = vp;
}
Follow me on twitter: @themrcerebro
-
- Admin
- Posts: 14143
- Joined: Wed Apr 19, 2006 9:20 pm
- Location: Oldenburg(Oldb), Germany
- Contact:
Re: [SOLVED] Increase the viewport region
Ok, now I understand what you intend. You'd like to get a larger region to be shown in your window. Say, having a window of 800x600 you'd like to have 1600x1200 to be rendered into the screen. This should indeed be possible, and the current implementation of setViewport does prohibit it. But I need to check d3d as well, and see what happens there.
Moving to bug reports while investigating.
Moving to bug reports while investigating.
-
- Competition winner
- Posts: 80
- Joined: Tue Jun 29, 2010 10:06 pm
- Location: Valencia, Spain
Re: [with fix] Increase the viewport region
Huuuoooooo!! Thanks Hybrid
I found another engine (that specializes only in "2D") that it does, but I refuse to use another engine, even for 2D. I have all the best of Irrlicht and its source code and I'm comfortable with it.
I appreciate your attention.
I found another engine (that specializes only in "2D") that it does, but I refuse to use another engine, even for 2D. I have all the best of Irrlicht and its source code and I'm comfortable with it.
I appreciate your attention.
Follow me on twitter: @themrcerebro
-
- Admin
- Posts: 14143
- Joined: Wed Apr 19, 2006 9:20 pm
- Location: Oldenburg(Oldb), Germany
- Contact:
Re: [with fix] Increase the viewport region
Ok, as I feared. There's a restriction for D3D. It won't support negative x/y values. Which would be very handy for large screens. Otherwise they are not centered anymore. It sounds as if a matrix shift would help here. If someone has an idea or a link, please chime in. So maybe we start with a first try with only positive area values?!
-
- Competition winner
- Posts: 80
- Joined: Tue Jun 29, 2010 10:06 pm
- Location: Valencia, Spain
Re: [with fix] Increase the viewport region
I just found a modification to do what he wanted, without modifying the source code of Irrlicht (Only works for 2D).
Now I can center and resize the scene. (i'm happy)
Code: Select all
core::matrix4 m;
glMatrixMode(GL_MODELVIEW);
m.setTranslation(core::vector3df(400-240,300-216, 0));
m.setScale(3);
glLoadMatrixf(m.pointer());
Follow me on twitter: @themrcerebro