Sign in to follow this  
CuppoJava

OpenGL OpenGL: Help understanding how the GPU relates to anything.

Recommended Posts

Hi, I'm in the midst of programming my game right now and there's one thing that I don't really understand. in OpenGL you have to bind a texture a first before you can draw it. ie. bind( texture123 ) drawquad(); Would it be a good idea to keep track of the currently bound texture, if I wanted to make a simple-to-use drawing engine? ie. drawTexture( Texture tex ) { if( currentlyBoundTexture != tex) bind(tex); drawquad(); } This way, I'm still avoiding redundant calls to glBindTexture. Thanks a lot -Cuppo

Share this post


Link to post
Share on other sites
Checks for redundandany are normally quite useful to remove unnecessary state changes. Do it! I am not sure whether OpenGL will check for redundancy internally, but it is good software design to not trust a third-party library or interface by assuming it will do something that is not officially specified ;)

If I had to use your library I would not want to check for redundancy myself. It would expect you libary to do this for me ;)

Best regards,
Porthos

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this