Archived

This topic is now archived and is closed to further replies.

more than one texture with glDraw* ?

This topic is 5742 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

hello, i''ve a problem. i draw a model from 3DS with glDrawElement or glDrawRangeElement. this model has many textures and materials. i put all the datas into a display list. this is how i do glNewList for( int gr=0; gr< groupe_nb; gr++){ glPushMatrix(); glPushClientAttrib( color, texture, lighting); glMaterialfv... glBindTexture( gr); glDrawElement( GL_TRIANGLES, number, GL_UNSIGNED_INT, &index[...]); // i don''t remember all, sorry glPopClientAttrib(); glPopMatrix(); } glEndList(); all my model is drawn correctly, but i only have one texture for all !! does anyone know why ? thanx in advance

Share this post


Link to post
Share on other sites
Use glDrawElements for each mesh in your model, a mesh being a series of triangles with one (or 2 if you use multitexturing) texture/material.

------------
- outRider -

Share this post


Link to post
Share on other sites
that''s what i do (as I think in all cases).
But only one texture is drawn.

normally, if you specify a texture for a part of an array that you draw, and do so on for each time the texture change, does that let opengl change it normally ?

ie:

for all meshes do
glBindTexture( texid)
glDrawRangeElement...
end for

this must change the texture, mustn''t it ?

thanx

Share this post


Link to post
Share on other sites
With multitexturing you first do glBind with the first texture unit active, then glBind again the new texture with the second texture unit active. Then glDrawElements.

Sorry, I just reread your problem. If you call glBind for each new textured set of triangles and you only get the first texture you glBinded then you're not passing a proper TexID to glBind. Either your texture was not properly created or something else went wrong.

------------
- outRider -

[edited by - outRider on March 27, 2002 11:06:33 PM]

Share this post


Link to post
Share on other sites