cancel
Showing results for 
Search instead for 
Did you mean: 

Linux版のフルスクリーン表示について

ttymsm
Honored Guest
お世話になります。
ttymsmと申します。

Linux版のSDK(0.4.4)を試しているのですが、DK2でフルスクリーン表示する場合にテクスチャやレンダリング設定をどのようにすればよいか教えて下さい。m(_ _)m

SDKに添付されていたLINUX_READMEに以下の記述があったので、特に設定をいじらずDK2のスクリーンが90度傾いたままになっています。


SHOULD I ROTATE MY DEVICE'S SCREEN?

Manual screen rotation is not recommended. If your window is fullscreen on a
rift device, set the ovrDistortionCap_LinuxDevFullscreen distortion cap to
have the SDK automatically rotate the distortion mesh on appropriate devices.
Be aware you will have to account for window size. You can use
OVR::SDKWindow::findDevScreenForHMD (Displays/OVR_Linux_SDKWindow.h) to
return the screen offset and dimensions necessary to size your Linux window.
See Samples/CommonSrc/Platform/Linux_Platform.cpp for an example.


この状況では、DK2のスクリーン解像度は横1080,縦1920となると思います。
もしovrDistortionCap_LinuxDevFullscreenを指定してDK2の画面にOculusアプリをフルスクリーンで表示する場合は、以下のテクスチャやレンダリングの設定をどのようにすればよろしいでしょうか?


// テクスチャサイズ(一枚のテクスチャに左右の絵をレンダリングする場合)
// Configure Stereo settings.
ovrSizei recommenedTex0Size = ovrHmd_GetFovTextureSize(hmd, ovrEye_Left,
hmd->DefaultEyeFov[0], 1.0f);
ovrSizei recommenedTex1Size = ovrHmd_GetFovTextureSize(hmd, ovrEye_Right,
hmd->DefaultEyeFov[1], 1.0f);

// The actual RT size may be different due to HW limits.
ovrSizei renderTargetSize;
renderTargetSize.w = recommenedTex0Size.w + recommenedTex1Size.w;
renderTargetSize.h = max ( recommenedTex0Size.h, recommenedTex1Size.h );



// レンダリング設定
ovrRecti EyeRenderViewport[2]; // Useful to remember when varying resolution
// ----
EyeRenderViewport[0].Pos = ovrVector2i{ 0, 0};
EyeRenderViewport[0].Size = ovrSizei{ renderTargetSize.w / 2, renderTargetSize.h};
EyeRenderViewport[1].Pos = ovrVector2i{(renderTargetSize.w + 1) / 2, 0};
EyeRenderViewport[1].Size = EyeRenderViewport[0].Size;

ovrGLTexture EyeTexture[2];
EyeTexture[0].OGL.Header.API = ovrRenderAPI_OpenGL;
EyeTexture[0].OGL.Header.TextureSize = renderTargetSize;
EyeTexture[0].OGL.Header.RenderViewport = EyeRenderViewport[0];
EyeTexture[0].OGL.TexId = texID;
EyeTexture[1] = EyeTexture[0];
EyeTexture[1].OGL.Header.RenderViewport = EyeRenderViewport[1];


以上、よろしくお願いします。
2 REPLIES 2

needle
Expert Protege
ご質問ありがとうございます。
お返事遅くなりまして申し訳ありません。

ご質問のフルスクリーン時の処理などに関してですが、
テクスチャ設定・レンダリング設定等の記述は特に手を加える必要はありません。
フルスクリーン時の処理に関しては、Linux SDKのサンプルコード内にある、
/ovr_sdk_linux_0.4.4/Samples/CommonSrc/Platform/Linux_Platform.cpp
をご覧頂けると幸いです。
具体的には543行目からの bool PlatformCore::SetFullscreen() の中、
特に622行目からの


else if (fullscreen == Render::Display_Fullscreen)
{
// Obtain display information so that we can make and informed
// decision about display modes.
...以下続く...

のif文のセクション中でLinuxでのフルスクリーン時に必要な処理が書かれています。
/ovr_sdk_linux_0.4.4/Samples/OculusWorldDemo/OculusWorldDemo.cpp の内容も併せてご参考にして頂ければと思います。
よろしくお願いいたします。

ttymsm
Honored Guest
Needle様

ご回答ありがとうございました。
こちらこそお返事が遅くなってすみません。

結論から申し上げると、以下の部分を変更したら意図したとおりに動作しました。

変更前

// Configure OpenGL.
union ovrGLConfig cfg;
cfg.OGL.Header.API = ovrRenderAPI_OpenGL;
cfg.OGL.Header.BackBufferSize = g_ovrHmd->Resolution;
cfg.OGL.Header.Multisample = 0; //backBufferMultisample
cfg.OGL.Disp = glfwGetX11Display();

変更後

// Configure OpenGL.
union ovrGLConfig cfg;
cfg.OGL.Header.API = ovrRenderAPI_OpenGL;
cfg.OGL.Header.BackBufferSize.h = g_ovrHmd->Resolution.w; //縦横入れ替え
cfg.OGL.Header.BackBufferSize.w = g_ovrHmd->Resolution.h; //縦横入れ替え
cfg.OGL.Header.Multisample = 0; //backBufferMultisample
cfg.OGL.Disp = glfwGetX11Display();


テクスチャサイズ等はご指摘の通り特に変更は不要でした。

以上、お礼とご報告までに。