#108370 - Rajveer - Wed Nov 08, 2006 4:49 am
I have an array of polygons with their normals which I store as a fixed point number (for calculations). I want to use these normal data for hardware lighting of my mesh too. I have a loop which I call:
However I dont get the results I want, infact its not lit at all, and after testing I think its a problem with the f32tofloat part. When I replaced it with a bitshift >>12 it gave me screwed up lighting. I dont think theres a glNormal3v16 function so any tips?
Code: |
int n = 0;
for(n = 0; n < polylimit; n++) { glBegin(GL_TRIANGLES); glNormal3f((f32tofloat(Level1Poly[n].normal[0])),(f32tofloat(Level1Poly[n].normal[1])),(f32tofloat(Level1Poly[n].normal[2]))); glTexCoord2t16(Level1Poly[n].tex0[0], Level1Poly[n].tex0[1]); glVertex3v16(Level1Poly[n].vertex0[0],Level1Poly[n].vertex0[1],Level1Poly[n].vertex0[2]); glTexCoord2t16(Level1Poly[n].tex1[0], Level1Poly[n].tex1[1]); glVertex3v16(Level1Poly[n].vertex1[0],Level1Poly[n].vertex1[1],Level1Poly[n].vertex1[2]); glTexCoord2t16(Level1Poly[n].tex2[0], Level1Poly[n].tex2[1]); glVertex3v16(Level1Poly[n].vertex2[0],Level1Poly[n].vertex2[1],Level1Poly[n].vertex2[2]); glEnd(); } |
However I dont get the results I want, infact its not lit at all, and after testing I think its a problem with the f32tofloat part. When I replaced it with a bitshift >>12 it gave me screwed up lighting. I dont think theres a glNormal3v16 function so any tips?