Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9036125
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T08:54:42+00:00 2026-06-16T08:54:42+00:00

Possible Duplicate: Making redundant OpenGL calls Let’s say I have an Image class that

  • 0

Possible Duplicate:
Making redundant OpenGL calls

Let’s say I have an Image class that has a method called draw that draws a part of the image on the screen, and also stores a handle to a 2d texture that contains the actual image data.

Is it OK to implement the draw() method like this?

// ix, iy, w and h specify which part of the image to draw
void Image::draw(int x, int y, int ix, int iy, int w, int h)
{
   glBindTexture(GL_TEXTURE_2D, m_textureHandle);
   //and then draw the specified part of the image
}

My main concern here is the call to glBindTexture. Is it correct to assume that if the texture is already bound, this call won’t result in some kind of a performance hit?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T08:54:44+00:00Added an answer on June 16, 2026 at 8:54 am

    Having worked on some implementatioins (drivers) for OpenGL, OpenVG and similar, the glBindTexture really just stores the m_textureHandle in some “good place” inside the “current context”. It is not a difficult thing to do, and shouldn’t “cost much”.

    If you are trying to save every last cycle of execution, by all means add a variable to determine if you have already bound your texture, and only do it if needed. But in general, I would be very surprised if you can’t save 5-10x the amount of time by doing other clever stuff.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicate: CSS Opacity Property I'm making a layer on an image which has
Possible Duplicate: Making an undefined class as friend, and defining it later. I have
Possible Duplicate: Making a generic property I'm not quite sure how to do that,
Possible Duplicate: I am making some parts of java image transparent by some code,
Possible Duplicate: PHP take all combinations I'm thinking of making something in PHP that
Possible Duplicate: making a pretty url via ruby I have looked around but I
Possible Duplicate: Java, GUI builder or hand coding? I have been making GUI hand-coded
Possible Duplicate: Making a <button> that's a link in HTML How apply CSS to
Possible Duplicate: iPhone : making UIBarButtonItem that is arrow shaped Creating a left-arrow button
Possible Duplicate: Hiding Title in a Fullscreen mode? I am making a app that

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.