fix -O3 warning. Fix indexes in vtx.

Loop 'for ( i = 0; i < 3; i++ )' sets values to vtx[0..2]. So next index must be 3(instead 4) and
loop 'for ( i = 16; i >= 0; i-- )' will set vtx[3..(18*3-1)].

=====
src/client/refresh/gl/r_light.c: In function ‘R_RenderDlight’:
src/client/refresh/gl/r_light.c:76:21: warning: iteration 16 invokes undefined behavior [-Waggressive-loop-optimizations]
    vtx[index_vtx++] = light->origin [ j ] + vright [ j ] * cos( a ) * rad
    ~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     + vup [ j ] * sin( a ) * rad;
     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/client/refresh/gl/r_light.c:65:2: note: within this loop
  for ( i = 16; i >= 0; i-- )
  ^~~
=====
This commit is contained in:
Denis Pauk 2018-01-21 11:47:50 +02:00
parent de30b75f94
commit bf19c8b50c

View file

@ -46,7 +46,7 @@ R_RenderDlight(dlight_t *light)
GLfloat vtx[3*18];
GLfloat clr[4*18];
unsigned int index_vtx = 4;
unsigned int index_vtx = 3;
unsigned int index_clr = 0;
glEnableClientState( GL_VERTEX_ARRAY );