Jump to content

  • Log In with Google      Sign In   
  • Create Account

Can Load Multiple Textures, but can not Bind Them


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
6 replies to this topic

#1 d_s_lin   Members   -  Reputation: 122

Like
Likes
Like

Posted 17 July 2001 - 06:14 PM

Hi everybody, I''m having problems trying to get OpenGL to display multiple textures. I can load several textures, but my program only shows the very last texture I loaded. When I make a call to "glBindTexture", I still can''t change to a different texture. I checked all the texture names to make sure that they are valid, and I''ve tried including the "glBindTexture" inside and outside of "gLBegin-glEnd" blocks, but to no avail. Any help will be greatly apprecaited. Thanks.

Sponsor:

#2 GandalfDerGraue   Members   -  Reputation: 122

Like
Likes
Like

Posted 17 July 2001 - 06:46 PM

Hi.

I think it would be much easier to help you if you post some source of how you do it now...

Anyhow glBindTexture hast to stand outside ghe glBegin/glEnd Block...

#3 d_s_lin   Members   -  Reputation: 122

Like
Likes
Like

Posted 17 July 2001 - 07:03 PM

Hi,

I posted the code at:

http://www.harvestberkeley.org/~d_s_lin/opengl/

Thanks.








#4 mittens   Moderators   -  Reputation: 1315

Like
Likes
Like

Posted 18 July 2001 - 07:56 AM

Multitexturing... do a search on it, or check out NeHe''s tuts. (Never except long posts from me)

------------------------------
Trent (ShiningKnight)
E-mail me
OpenGL Game Programming Tutorials

#5 GKW   Members   -  Reputation: 200

Like
Likes
Like

Posted 18 July 2001 - 08:08 AM

It is because you have the glBindTexture calls in between glBegin and glEnd. Your program works just find when the bind calls are placed in the proper place.

The fanatic is incorruptible: if he kills for an idea, he can just as well get himself killed for one; in either case, tyrant or martyr, he is a monster.
--EM Cioran

Opere Citato

#6 Anonymous Poster_Anonymous Poster_*   Guests   -  Reputation:

Likes

Posted 18 July 2001 - 08:14 AM

Hi guys and gals,

I really appreciated your help. Thanks a lot!!



#7 guitardave24   Members   -  Reputation: 122

Like
Likes
Like

Posted 21 July 2001 - 05:33 PM

The best way to handle this is to encapsulate a texture as an object. Use a texture manager to hold texture objects and bind via those objects.

g_pTexManager->AddTexture("textures/image.bmp");
....
g_pTexManager->Use( "textures/image.bmp");
render();


This is a very basic example which can be further optimized, but it''s a start. Also, if you''re going to use a texture manager and get texture pointers on the fly from it, the best data structure to use ultimately would be an array and each index as an id. But sometimes it''s easier to keep track with strings or some other type of key, for this the data structure would be a good choice to hold all of the texture objects.

~David M. Byttow
www.integralstudios.com





Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS