Page 1 of 1

3D using light and texture together

Posted: Fri Apr 16, 2010 6:03 am
by dheart88
Is it possible to use light and texture together? I can't see the differences of light implementation...

Re: 3D using light and texture together

Posted: Fri Apr 16, 2010 7:47 am
by elhobbs
Yes it is possible. Make sure you not setting the vertex color after you send the required normal commands as this will override the color calculated by the normal command. Also, did you set the ambient, diffuse, and specular color materials?

Re: 3D using light and texture together

Posted: Fri Apr 16, 2010 9:51 am
by dheart88
will it work if i use calllist? all my objects are exported from 3dsmax (3ds format into bin)

Re: 3D using light and texture together

Posted: Fri Apr 16, 2010 1:49 pm
by elhobbs
yes, though the same issues apply.

Re: 3D using light and texture together

Posted: Sun Apr 18, 2010 7:33 pm
by dheart88
can you pls give me some example? It didn't work in my place... is it because I use RGB16 instead of RGBA?

Re: 3D using light and texture together

Posted: Mon Apr 19, 2010 1:55 pm
by elhobbs
this is the code I use:

per frame I call:

Code: Select all

        glLight(0, RGB15(31,31,31) , floattov10(r_vright[0]), floattov10(r_vright[1]), floattov10(r_vright[2])); 
per object that will use lighting I turn on the light and set the colors

Code: Select all

glPolyFmt(POLY_ALPHA(31) | POLY_CULL_FRONT | POLY_ID(6) | POLY_FORMAT_LIGHT0 | (1 << 13)); 
glColor3b(shadelight,shadelight,shadelight);
glMaterialf(GL_AMBIENT, RGB8(ambientlight,ambientlight,ambientlight)); 
glMaterialf(GL_DIFFUSE, RGB8(shadelight,shadelight,shadelight)); 
glMaterialf(GL_SPECULAR, RGB8(shadelight,shadelight,shadelight)); 
 
then for each point of each triangle I send the normal, the texcoord, and then the vertex - in that order.

Re: 3D using light and texture together

Posted: Wed Apr 21, 2010 9:11 am
by dheart88
Thx for your help.