The SDL forums have moved to discourse.libsdl.org.
This is just a read-only archive of the previous forums, to keep old links working.


SDL Forum Index
SDL
Simple Directmedia Layer Forums
:?: windows phone orientation (using opengles and ANGLE)
asdron


Joined: 05 Nov 2014
Posts: 13
Hi, I'm trying to port my game to windows phone platform now. Because it was written with opengl es 2.0, I chose ANGLE project library. After few days I can now run it on simulator, but I have problem with screen rendering orientation. My game is in landscape mode, but it renders in portait Shocked . Setting hint
Code:
SDL_SetHint(SDL_HINT_ORIENTATIONS, "LandscapeLeft LandscapeRight");
not helped me. I tried to make simple hello world with drawing triangle with both platform versions 8.0 (winrt ANGLE branch) and 8.1 (future-dev ANGLE branch). But my triangle is still drawing in portrait mode even with "LandscapeLeft LandscapeRight" hint. Also it doesn't react with changing simulator orientation.

I'm creating window like this:
Code:

SDL_DisplayMode mode;
   SDL_Window * window = NULL;
   SDL_Renderer * renderer = NULL;
   SDL_Event evt;

   if(SDL_Init(SDL_INIT_VIDEO) != 0)
   {
      return 1;
   }

   SDL_SetHint(SDL_HINT_ORIENTATIONS, "LandscapeLeft LandscapeRight");

   if(SDL_GetCurrentDisplayMode(0, &mode) != 0)
   {
      return 1;
   }

   if ((window = SDL_CreateWindow(NULL, SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, mode.w, mode.h, SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN)) == NULL)
   {
      return 1;
   }
   

   SDL_GLContext context = SDL_GL_CreateContext(window);
   SDL_GL_MakeCurrent(window, context);
   SDL_GL_SwapWindow(window);


Can anyone help me to point what I'm missing in code? Or where I should look in code? Google didn't help me yet.
asdron


Joined: 05 Nov 2014
Posts: 13
Problem was resolved with creating projection matrix and rotating it. Also I found same comment in "Cube Render" sample in ANGLE.
CubeRenderer.cpp
Quote:
// In Windows Phone 8.0 C++ apps, we need to rotate the projection matrix by the
// device's current rotation matrix
:?: windows phone orientation (using opengles and ANGLE)
slvn


Joined: 06 Oct 2012
Posts: 88
Landscape/Portrait might be a setting in you project properties, to be configured from the IDE.

(I dont remember exactly)


On Fri, Nov 7, 2014 at 5:18 PM, asdron wrote:
Quote:
hi again. After few time I found, that above sollution not resolve main problem with displaying in landscape mode. It can be used for implementing autorotation. But my game still starts drawing with lanscape viewport in portrait mode

my splah screen is black on this image 480x800, and it't not in landscape...


_______________________________________________
SDL mailing list

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org




--
Sylvain Becker
:?: windows phone orientation (using opengles and ANGLE)
DLudwig


Joined: 09 Feb 2012
Posts: 179
I'm not sure this will help, but I just pushed out a fix for a bug whereby SDL would always alter the WinRT-app's 'AutoRotationPreferences' on app-startup, setting it to allow both Portrait and Landscape modes.  This fix is in as of https://hg.libsdl.org/SDL/rev/9c45fc8605d9

Cheers,
-- David L.




On Fri, Nov 7, 2014 at 11:18 AM, asdron wrote:
Quote:
hi again. After few time I found, that above sollution not resolve main problem with displaying in landscape mode. It can be used for implementing autorotation. But my game still starts drawing with lanscape viewport in portrait mode

my splah screen is black on this image 480x800, and it't not in landscape...


_______________________________________________
SDL mailing list

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

asdron


Joined: 05 Nov 2014
Posts: 13
slvn,
Setting Landscape/Portrait in project properties not work for current version SDL + ANGLE. I didn't yet fixed this in my new SDL+ANGLE project without initialization sdl window, so I will post results a bit later.

DLudwig,
your fix may be will work for pure directx app, but if I do not get them mixed up, then I tried to play with setting orientation flags in SDL, but it didn't make any changes for SDL+ANGLE project.

p.s.
I've found this issue https://github.com/MSOpenTech/angle/issues/25, but I can't say anything still I'm not worked yet on fixing orientation. I switched to windows 8.1 and there is no problem with starting app in landscape mode.
asdron


Joined: 05 Nov 2014
Posts: 13
Today I finished integration facebook in my game and returned to problem with orientation. After reading and googling a while, I have found this article. http://www.kraigbrockschmidt.com/2013/09/05/locking-orientation-supported-rotations-manifest/. There is interesting note, that I don't know (probably missed it in official docs).
Quote:
Note that orientation preferences set in the manifest and through the autoRotationPreferences property do not work with non-accelerometer hardware, such as desktop monitors and also the Visual Studio simulator.

I tested on device (microsoft surface tablet) and it's really truth. Game handles orientation properly on device, but on desktop simulator always working wrong after rotation.