Opened 4 months ago
Last modified 4 months ago
#15272 new defect
TINYGL: triangle fan produces less triangles than expected?
Reported by: | neuromancer | Owned by: | |
---|---|---|---|
Priority: | normal | Component: | Graphics |
Version: | Keywords: | tinygl | |
Cc: | Game: |
Description
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'
Attachments (2)
Change History (3)
by , 4 months ago
Attachment: | scummvm-totaleclipse-1-00000.webp added |
---|
by , 4 months ago
Attachment: | scummvm-totaleclipse-00000.webp added |
---|
comment:1 by , 4 months ago
Summary: | TINY: triangle fan produces less triangles than expected? → TINYGL: triangle fan produces less triangles than expected? |
---|
Note:
See TracTickets
for help on using tickets.