voyageur / openglide

Git mirror of openglide CVS (http://openglide.sourceforge.net/)
GNU Lesser General Public License v2.1
48 stars 17 forks source link

EnableVertexArrayEXT=1 causes crash #27

Closed 4ndyc closed 10 months ago

4ndyc commented 10 months ago

Testing with dosbox-x and qemu-3dfx, EnableVertexArrayEXT=1 causes the program to crash. The cause appears to be the arguments to p_glFogCoordPointerEXT in RenderUpdateArrays are incorrect. The following seems to solve the problem:

p_glFogCoordPointerEXT( GL_FLOAT, 0, &OGLRender.TFog[0] );

voyageur commented 10 months ago

Interesting, and this is quite old code! Indeed, from glext.h: GLAPI void APIENTRY glFogCoordPointerEXT (GLenum type, GLsizei stride, const void *pointer); the arguments are incorrect

Does rendering look OK with stride=0? It is defined as "specifies the byte offset between consecutive fog coordinates" and I see mesa fog demo program uses default too so this looks like acceptable fix: https://gitlab.freedesktop.org/mesa/demos/-/blob/main/src/demos/fogcoord.c#L397

4ndyc commented 10 months ago

I've only tested a couple of games so far but they seem to be fine. Apparently stride=0 indicates the array is tightly packed so I think it's either 0 or sizeof(GLfloat) in this instance.