#126262 - trabis - Sat Apr 21, 2007 11:49 am
Hello, i want a simple code with a 3d cube and changing color light but something is wrong. I`ve modified the lesson06 from nehe libnds examples. That?s the loop code:
Why don`t I feel any difference? Can anyone help me?
Thanks
Code: |
while (1) { // Reset the screen and setup the view glReset(); gluPerspective(35, 256.0 / 192.0, 0.1, 100); glColor3f(1,1,1); glLight(0, RGB15(r,g,b) , 0, floattov10(-1.0), 0); glLight(1, RGB15(r,g,b) , 0, 0, floattov10(-1.0)); glLight(2, RGB15(r,g,b) , 0, 0, floattov10(1.0)); glMatrixMode(GL_TEXTURE); glIdentity(); glMatrixMode(GL_MODELVIEW); //need to set up some material properties since DS does not have them set by default glMaterialf(GL_AMBIENT, RGB15(16,16,16)); glMaterialf(GL_DIFFUSE, RGB15(16,16,16)); glMaterialf(GL_SPECULAR, BIT(15) | RGB15(8,8,8)); glMaterialf(GL_EMISSION, RGB15(16,16,16)); //ds uses a table for shinyness..this generates a half-ass one glMaterialShinyness(); // Set the current matrix to be the model matrix glMatrixMode(GL_MODELVIEW); //Push our original Matrix onto the stack (save state) glPushMatrix(); //ds specific, several attributes can be set here glPolyFmt(POLY_ALPHA(31) | POLY_CULL_NONE | POLY_FORMAT_LIGHT0| POLY_FORMAT_LIGHT1| POLY_FORMAT_LIGHT2); DrawGLScene(); // Pop our Matrix from the stack (restore state) glPopMatrix(1); // flush to screen glFlush(); r=(r+1)%32; g=(g+1)%32; b=(b+1)%32; } |
Why don`t I feel any difference? Can anyone help me?
Thanks