Results 1 to 2 of 2

Thread: How expensive is calling glBindTexture2D multiple times?

  1. #1
    Member Contributor
    Join Date
    Sep 2000
    Location
    Copenhagen, Denmark
    Posts
    56

    How expensive is calling glBindTexture2D multiple times?

    Hi

    This may be a really stupid question, but I was just wondering something. If I draw a tesselated surface and each patch has a texture associated with it, how expensive is it to call glBindTexture2D for each patch, even if the texture associated with different patches is the same? If the surface for example is a brick wall, then all the patches would have the same texture associated with it (i.e. bricks), so it should only be nesecary to call glBindTexture once. The reason why every patch would have a reference to a texture is because one of the patches might use a different one, say to simulate a hole in the wall or something. So is calling glBindTexture multiple times while rendering expensive?

    Hope this made sense
    Anders

  2. #2
    Senior Member OpenGL Guru
    Join Date
    Feb 2000
    Location
    Sweden
    Posts
    2,978

    Re: How expensive is calling glBindTexture2D multiple times?

    Unnecessary calls should always be avoided. Texture bindings can be expensive. Don't know if it's cheaper to "rebind" a texture, but it's still costs. You should keep track of the texture states yourself. For example, when you bind a texture, store it's id in a local variable, and when binding a texture again, check the current id with the id you want to bind. Another way is to sort every primitive by texture. That is, first draw everything with one texture id, then draw everything wither another texture id, and so on. This way you will bind a texture only once.

    [This message has been edited by Bob (edited 12-19-2002).]

Similar Threads

  1. Painting the same texture multiple times
    By fhazubski in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 05-26-2016, 03:25 AM
  2. Replies: 4
    Last Post: 05-20-2010, 01:41 PM
  3. calling the same kernel object multiple times
    By poonaatsoc in forum OpenCL
    Replies: 3
    Last Post: 07-29-2009, 01:06 PM
  4. Calling gluLookAt() multiple times within a scene?
    By jkj2000 in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 03-24-2009, 02:24 PM
  5. VBOs and binding multiple times
    By in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 02-18-2004, 03:57 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Proudly hosted by Digital Ocean