[Scummvm-tracker] [ScummVM :: Bugs] #15272: TINY: triangle fan produces less triangles than expected?
ScummVM :: Bugs
trac at scummvm.org
Sun Jul 14 07:13:05 UTC 2024
#15272: TINY: triangle fan produces less triangles than expected?
------------------------+----------------------
Reporter: neuromancer | Owner: (none)
Type: defect | Status: new
Priority: normal | Component: Graphics
Version: | Keywords: tinygl
Game: |
------------------------+----------------------
TGL_TRIANGLE_FAN seems to produce less triangles than expected. Check the
screenshots associated, where similar code is for TinyGL and OpenGL
implementation. The code is basically this one:
{{{
void TinyGLRenderer::drawCelestialBody(Math::Vector3d position, float
radius, byte color) {
uint8 r1, g1, b1, r2, g2, b2;
byte *stipple = nullptr;
getRGBAt(color, 0, r1, g1, b1, r2, g2, b2, stipple);
int triangleAmount = 20;
float twicePi = (float)(2.0 * M_PI);
...
tglDisable(TGL_DEPTH_TEST);
tglDepthMask(TGL_FALSE);
setStippleData(stipple);
useColor(r1, g1, b1);
tglEnableClientState(TGL_VERTEX_ARRAY);
copyToVertexArray(0, position);
float adj = 1.25; // Perspective correction
for(int i = 0; i <= triangleAmount; i++) {
copyToVertexArray(i + 1,
Math::Vector3d(position.x(), position.y() + (radius * cos(i *
twicePi / triangleAmount)),
position.z() + (adj * radius * sin(i * twicePi /
triangleAmount)))
);
}
tglVertexPointer(3, TGL_FLOAT, 0, _verts);
tglDrawArrays(TGL_TRIANGLE_FAN, 0, triangleAmount + 2);
tglDisableClientState(TGL_VERTEX_ARRAY);
}
}}}
I'm also seeing a bunch of sanitizer warning/errors when rendering this,
perhaps they are related:
{{{
graphics/tinygl/ztriangle.cpp:418:19: runtime error: left shift of
negative value -5
graphics/tinygl/ztriangle.cpp:362:16: runtime error: left shift of
negative value -10
graphics/tinygl/clip.cpp:251:58: runtime error: signed integer overflow:
-2147483648 - 43 cannot be represented in type 'int'
graphics/tinygl/clip.cpp:252:24: runtime error: signed integer overflow:
-2147483648 - 185 cannot be represented in type 'int'
graphics/tinygl/ztriangle.cpp:212:23: runtime error: signed integer
overflow: 185 - -2147483648 cannot be represented in type 'int'
graphics/tinygl/ztriangle.cpp:213:23: runtime error: signed integer
overflow: 32 - -2147483648 cannot be represented in type 'int'
graphics/tinygl/ztriangle.cpp:215:23: runtime error: signed integer
overflow: 185 - -2147483648 cannot be represented in type 'int'
graphics/tinygl/ztriangle.cpp:216:23: runtime error: signed integer
overflow: 43 - -2147483648 cannot be represented in type 'int'
graphics/tinygl/ztriangle.cpp:362:16: runtime error: left shift of
negative value -102
graphics/tinygl/ztriangle.cpp:418:19: runtime error: left shift of
negative value -102
graphics/tinygl/clip.cpp:251:27: runtime error: signed integer overflow:
-2147483648 - 159 cannot be represented in type 'int'
graphics/tinygl/clip.cpp:252:55: runtime error: signed integer overflow:
-2147483648 - 32 cannot be represented in type 'int'
}}}
--
Ticket URL: <https://bugs.scummvm.org/ticket/15272>
ScummVM :: Bugs <https://bugs.scummvm.org>
ScummVM
More information about the Scummvm-tracker
mailing list