lunixbochs / glshim

OpenGL 1.x driver shim for OpenGL ES devices.
https://boards.openpandora.org/topic/11506-glshim/
MIT License
159 stars 32 forks source link

Wrong color when set in the middle of the block in display list #159

Closed M-HT closed 8 years ago

M-HT commented 8 years ago

In a code such as this: glNewList(di, GL_COMPILE); glColor3f(r1, g1, b1); glBegin(GL_QUADS); glVertex3f(1, 1, 0); glVertex3f(-1, 1, 0); glVertex3f(-1, -1, 0); glVertex3f(1, -1, 0); glColor3f(r2, g2, b2); glVertex3f(... The first 4 vertices should have color r1,g1,b1 and the rest should have color r2,g2,b2. But the 4th vertex has a wrong color (when drawing the display list).

I think the fix is to change these lines in function bl_draw in file src/gl/block.c: if ((pos = block->incomplete.color) >= 0) { for (int i = 0; i < pos; i++) { to: if ((pos = block->incomplete.color) >= 0) { for (int i = 0; i <= pos; i++) {

The normals probably have the same problem.

lunixbochs commented 8 years ago

fixed, thanks!