0
\$\begingroup\$

Projection matrix? Renderer? Where is the error? I recently started studying NDK to create better performing android games ... but ... An error I didn't expect to deal with appeared a few weeks ago

The projection works perfectly on my device if I ignore some errors in the depth test

On my device:
On my device.gif because yes:

But... You must ask yourself what is the impossible mistake of this noob, right?

Let's look at another device with similar specifications:

Only the cube has disappeared ... the text works and the only difference between them is the projection.

Is it possible for a matrix4 to work only on specific devices?

On some devices the cube appears after clicking on the screen even though it is not related to rendering "with many depth glitch's"
Device 1

Device 2

My projection:

    auto fd =(float)( 1.0 / tan((fovy * (PI / 180.0))/2.0F));
    float a1 = (far+near)/(near-far);
    float a2 = (2* far * near)/(near-far);

    val[M00] = fd/aspectRatio;
    val[M01] = 0;
    val[M02] = 0;
    val[M03] = 0;

    val[M10] = 0;
    val[M11] = fd;
    val[M12] = 0;
    val[M13] = 0;

    val[M20] = 0;
    val[M21] = 0;
    val[M22] = a1;
    val[M23] = a2;

    val[M30] = 0;
    val[M31] = 0;
    val[M32] = -1;
    val[M33] = 0;

How I use it:

projection->setToProjection( 0.0f, 200.0f, 75.0f, 1.0f);
\$\endgroup\$
6
  • \$\begingroup\$ In another context, I have had issues in the past with setting the near and far planes covering too much depth. On some occasion, my object was not rendered. Maybe you could try and and adjust the depth to be just what you need, no more, no less. \$\endgroup\$ Commented Sep 9, 2020 at 16:59
  • \$\begingroup\$ Near stays at 0.0 and far at 200.0 on my device and "works" but ... on other devices it just doesn't and I have to set near to 0.000some random decimal "So stop working on one device and start working on another " \$\endgroup\$ Commented Sep 9, 2020 at 17:05
  • \$\begingroup\$ Can't you determine the exact values needed for both of those parameters? \$\endgroup\$ Commented Sep 9, 2020 at 17:37
  • \$\begingroup\$ The near should be 0.1 and the far greater than the block distance at least... But it does not work \$\endgroup\$ Commented Sep 9, 2020 at 17:56
  • \$\begingroup\$ Ok, I can't help you further; good luck :) \$\endgroup\$ Commented Sep 9, 2020 at 18:14

0

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.