Jump to content
  • Advertisement

Archived

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

saian

more than one texture with glDraw* ?

This topic is 5962 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
Advertisement
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
what about an interleaved array
store the vertex and uv texturing coordinates in one array and render it

Share this post


Link to post
Share on other sites
thanx for replies.

that was my fault, i was making something absurd. now it works !

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!