-
Notifications
You must be signed in to change notification settings - Fork 0
Trouble getting API to display my scene - from GilesGoat on the forum (https://forum.lookingglassfactory.com/t/opengl-bugs-and-issues/1225/4) #1
Description
Hi,
Ok … ‘what am I doing wtong ?’
So … my code goes along those lines , first -
wp.w = 512;
wp.h = 256;
window = Util_InitWindowAndGraphics(wp,
FullScreen, 4, UseAppWindowFrame, &l_pDevice, NULL, NULL, NULL, &error_code); //UseAppWindowFrame, &pDevice);
*the_Neon_Device = l_pDevice;
g_Neon_Device = l_pDevice;
#ifdef USING_HOLOPLAY
PRINTF(“Initializing Looking Glass\n”);
hp_initialize();
#endif
Then in my ‘begin view’ …
if (nviews == 32)
{
// ok we ARE in openGL !!
// simple case, simple screen
g_Neon_Device->SetCurrentRT(-1);
float fov = 0.244; // 14° in radians
float viewCone = 0.698; // 40° in radians
float cameraSize = 5; // for example
float aspectRatio = 1.6; // derived from calibration's screenW / screenH
//totalViews = 45 // derived from the quilt settings
Vector3 focalPosition;// = (0, 0, 0); // the center of the focal pane
focalPosition.zero();
float cameraDistance = -cameraSize / tan(fov / 2);
Vector3 cameraPosition = focalPosition + Vector3(0, 0, cameraDistance);
proj = glm::perspectiveRH(
SCE_MATH_PI / 4.0f,
(float)w*0.5f / (float)h,
//1.0f,
0.1f, // z near
20.0f); // z far
g_Neon_Device->camera(0, 0, 3,
0, 0, 0,
0, 1, 0,
&view, true);
// now let's do what they do
//PRINTF("View Index %d\n", view_index);
// start at -viewCone * 0.5 and go up to viewCone * 0.5
float offsetAngle = ((float)view_index / (float)(nviews - 1) - 0.5) * viewCone;
// calculate the offset
float offset = cameraDistance * tan(offsetAngle);
// modify the view matrix (position)
view[0, 3] += offset;
// modify the projection matrix, relative to the camera size and aspect ratio
proj[0, 2] += offset / (cameraSize * aspectRatio);
g_Neon_Device->setProjection(&proj);
g_Neon_Device->setCamera(&view);
}
Then it draw some cubes
the_Neon_Device->setWorld();
the_Neon_Device->scale(0.3, 0.3, 0.3);
the_Neon_Device->translate(0, 0.5, 0);
the_Neon_Device->UpdateWvpMatrix(NULL);
the_cube->draw(0);
Then my 'end-view' calls -
void LS_Display_Compositor::EndView(int view_index, void *graphic_context)
{
#ifdef USING_HOLOPLAY
hp_copyViewToQuilt(view_index);
#endif
return;
}
This is done 32 time with that view_index going from 0 to 31 …
Finally …
void LS_Display_Compositor::EndFrame(int frameindex)
{
if (g_Neon_Device) g_Neon_Device->EndFrame(0);
#ifdef USING_HOLOPLAY
hp_drawLightfield();
#endif
return;
}
I tried to move the Present(1); before to call the hp_drawLightfield(); ( tried also with present(0), no vsynch ) …
Fundamentally … nothing happens … the display just displays the desktop background, it’s like it does not get addressed at all …
What am I missing here ?
I linked with the HoloPlayApi.lib, put the DLL in the correct path … all ‘seems ok’ except the display seems not to give any sign of life.
Suggestions ?
Also I found out that despite the #pragma once and such it appears holoplay.h can be included only one in one source, otherwise it complains all time of ‘duplicated/already defined things’.
Anyway any suggestions to debug what’s going on ??
Cheers.