PDA

View Full Version : 2 textures on the same quad



04-16-2003, 12:45 AM
is that possible? how should it be done?will it works this way?

glNormal(0,0,1)
draw quad with texture1
glNormal(0,0,-1)
draw the same quad with texture2

jebus
04-16-2003, 08:30 AM
basically...yes. you bind your first texture, then draw the quad. then you bind the second texture, then draw the quad again. there is a multitexturing extension that will allow you to do this in one pass.

jebus

31337
04-16-2003, 08:35 AM
gasp!

04-16-2003, 11:29 AM
what i ment was if it is possible to show one texture on front side and other one on the back side

shinpaughp
04-16-2003, 07:02 PM
Same as what Jebus said but 1 quad is made clockwise, second is made counter-clockwise, and enable back face culling.

marcus256
04-16-2003, 09:08 PM
To be a bit more specific:




glEnable( GL_CULL_FACE );
glFrontFace( GL_CCW ); // or GL_CW, depending on how you draw
glCullFace( GL_BACK );
glBindTexture( GL_TEXTURE_2D, front_texture );
draw_my_quad();
glCullFace( GL_FRONT );
glBindTexture( GL_TEXTURE_2D, back_texture );
draw_my_quad();


This should not cost too much if you do it right (e.g. use vertex arrays and do all front faces in one go and then all back faces), since face culling is done very early in the rendering pipeline (after transformation but before lighting and rasterization I believe).


[This message has been edited by marcus256 (edited 04-16-2003).]