problems about resize view in iOS

You are an experienced programmer and have a problem with the engine, shaders, or advanced effects? Here you'll get answers.
No questions about C++ programming or topics which are answered in the tutorials!
Post Reply
beof
Posts: 8
Joined: Thu Nov 22, 2012 9:40 am

problems about resize view in iOS

Post by beof »

Hello, guys,
I am using irrlicht engine in iPhone using opengl es2, when I resize my view, the coordinate seems to be wrong.
Here are the following steps:
1. params.WindowSize = (160,240)
params.WindowId = theView
pDevice = createDeviceEx(params)
pDriver = pDevice->getDriver()
beginScene()
pDriver->draw2DImage(destRect(0, 20, 160, 200), sourceRect(0,0,160,200), texture)
endScene()

2. Then theView size is changed to (320,480) by the application,
and we call this api:

pDriver->onResize(320,480) //in iPhone 4, I also double the width and height for the retina display.
pDriver->draw2DImage(destRect(0,40,320,400), sourceRect(0,0,160,200))

As the described, I have both resize the driver and recalculated the texture's position to make it center in the y-axis.
However, the step2's result shows that the 2d image's position is completely wrong.

Is it possible to resize the view without recreated the device in the iPhone?
Thank you.
Nadro
Posts: 1648
Joined: Sun Feb 19, 2006 9:08 am
Location: Warsaw, Poland

Re: problems about resize view in iOS

Post by Nadro »

Under iOS Irrlicht works in fullscreen mode with native device resolution. Params.WindowSize may be even (0,0). Why You need smaller window for Irrlicht in your iOS app? (all apps are fullscreen)
Library helping with network requests, tasks management, logger etc in desktop and mobile apps: https://github.com/GrupaPracuj/hermes
beof
Posts: 8
Joined: Thu Nov 22, 2012 9:40 am

Re: problems about resize view in iOS

Post by beof »

@Nadro,
I was not using irrlicht for game developing, there is a child view rendering the 3D model, while there are many other UI controls below the child view in the app's window.

If the view's size is not changed, it works, however, when it the size is changed, it failed to get the right position.

But in android, the rendering scene is scaled with the window size.
Nadro
Posts: 1648
Joined: Sun Feb 19, 2006 9:08 am
Location: Warsaw, Poland

Re: problems about resize view in iOS

Post by Nadro »

Hmmm, in future i'll look again into windows size case on iOS, but currently I have other things to do in Irrlicht. You can change window behaviour by editing Irrlicht sources (CIrrDeviceiOS.mm and COGLES(1)Driver.cpp (only part related to window size)).
Library helping with network requests, tasks management, logger etc in desktop and mobile apps: https://github.com/GrupaPracuj/hermes
Post Reply