From 66ec0b5d829de6db72d8a7508373ab52a8c3c1f2 Mon Sep 17 00:00:00 2001 From: raysan5 Date: Sun, 12 Jun 2016 10:47:50 +0200 Subject: [PATCH 1/2] Oculus tracking correction --- src/core.c | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/src/core.c b/src/core.c index 0c1e0454..122453e3 100644 --- a/src/core.c +++ b/src/core.c @@ -565,7 +565,7 @@ void CloseOculusDevice(void) void UpdateOculusTracking(void) { frameIndex++; - + ovrPosef eyePoses[2]; ovr_GetEyePoses(session, frameIndex, ovrTrue, layer.viewScaleDesc.HmdToEyeOffset, eyePoses, &layer.eyeLayer.SensorSampleTime); @@ -644,14 +644,6 @@ void BeginDrawing(void) previousTime = currentTime; #if defined(PLATFORM_OCULUS) - frameIndex++; - - ovrPosef eyePoses[2]; - ovr_GetEyePoses(session, frameIndex, ovrTrue, layer.viewScaleDesc.HmdToEyeOffset, eyePoses, &layer.eyeLayer.SensorSampleTime); - - layer.eyeLayer.RenderPose[0] = eyePoses[0]; - layer.eyeLayer.RenderPose[1] = eyePoses[1]; - SetOculusBuffer(session, buffer); #endif From 4dae3385c3871d4629a0e391165173ed86f87dcf Mon Sep 17 00:00:00 2001 From: raysan5 Date: Sun, 12 Jun 2016 19:40:08 +0200 Subject: [PATCH 2/2] Record draw call for batch processing Just started working on this, not sure if it would be available for raylib 1.5 --- src/rlgl.c | 30 ++++++++++++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) diff --git a/src/rlgl.c b/src/rlgl.c index d4502595..e69ff983 100644 --- a/src/rlgl.c +++ b/src/rlgl.c @@ -159,9 +159,17 @@ typedef struct { // Draw call type // NOTE: Used to track required draw-calls, organized by texture typedef struct { - GLuint textureId; int vertexCount; - // TODO: Store draw state -> blending mode, shader + GLuint vaoId; + GLuint textureId; + GLuint shaderId; + + Matrix projection; + Matrix modelview; + + // TODO: Store additional draw state data + //int blendMode; + //Guint fboId; } DrawCall; //---------------------------------------------------------------------------------- @@ -2099,6 +2107,24 @@ void *rlglReadTexturePixels(Texture2D texture) return pixels; } +/* +// TODO: Record draw calls to be processed in batch +// NOTE: Global state must be kept +void rlglRecordDraw(void) +{ + // TODO: Before adding a new draw, check if anything changed from last stored draw +#if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2) + draws[drawsCounter].vaoId = currentState.vaoId; // lines.id, trangles.id, quads.id? + draws[drawsCounter].textureId = currentState.textureId; // whiteTexture? + draws[drawsCounter].shaderId = currentState.shaderId; // defaultShader.id + draws[drawsCounter].projection = projection; + draws[drawsCounter].modelview = modelview; + draws[drawsCounter].vertexCount = currentState.vertexCount; + + drawsCounter++; +#endif +} +*/ //---------------------------------------------------------------------------------- // Module Functions Definition - Shaders Functions