mirror of
https://github.com/bjornbytes/lovr.git
synced 2024-07-07 06:43:34 +00:00
Fix lovr.headset.getDisplayDimensions when called in lovr.load;
This commit is contained in:
parent
e2c27fb74c
commit
511598f605
|
@ -142,6 +142,14 @@ static TrackedDevicePose_t getPose(unsigned int deviceIndex) {
|
||||||
return poses[deviceIndex];
|
return poses[deviceIndex];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void initializeCanvas() {
|
||||||
|
glBindFramebuffer(GL_FRAMEBUFFER, 0);
|
||||||
|
int msaa = 0;
|
||||||
|
glGetIntegerv(GL_SAMPLES, &msaa);
|
||||||
|
state.system->GetRecommendedRenderTargetSize(&state.renderWidth, &state.renderHeight);
|
||||||
|
state.canvas = lovrCanvasCreate(state.renderWidth, state.renderHeight, FORMAT_RGB, CANVAS_3D, msaa, true, true);
|
||||||
|
}
|
||||||
|
|
||||||
static void openvrInit() {
|
static void openvrInit() {
|
||||||
state.isInitialized = false;
|
state.isInitialized = false;
|
||||||
state.isRendering = false;
|
state.isRendering = false;
|
||||||
|
@ -320,6 +328,7 @@ static void openvrGetDisplayDimensions(int* width, int* height) {
|
||||||
if (!state.isInitialized) {
|
if (!state.isInitialized) {
|
||||||
*width = *height = 0;
|
*width = *height = 0;
|
||||||
} else {
|
} else {
|
||||||
|
initializeCanvas();
|
||||||
*width = state.renderWidth;
|
*width = state.renderWidth;
|
||||||
*height = state.renderHeight;
|
*height = state.renderHeight;
|
||||||
}
|
}
|
||||||
|
@ -716,11 +725,7 @@ static void openvrRenderTo(headsetRenderCallback callback, void* userdata) {
|
||||||
lovrGraphicsPushView();
|
lovrGraphicsPushView();
|
||||||
|
|
||||||
if (!state.canvas) {
|
if (!state.canvas) {
|
||||||
glBindFramebuffer(GL_FRAMEBUFFER, 0);
|
initializeCanvas();
|
||||||
int msaa = 0;
|
|
||||||
glGetIntegerv(GL_SAMPLES, &msaa);
|
|
||||||
state.system->GetRecommendedRenderTargetSize(&state.renderWidth, &state.renderHeight);
|
|
||||||
state.canvas = lovrCanvasCreate(state.renderWidth, state.renderHeight, FORMAT_RGB, CANVAS_3D, msaa, true, true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
float head[16], transform[16], projection[16];
|
float head[16], transform[16], projection[16];
|
||||||
|
|
Loading…
Reference in a new issue