Advertisement

Just a simple question for you guys

Started by July 21, 2002 11:16 PM
18 comments, last by Azurewrath 22 years, 7 months ago
Hello, I must say the tutorials are awesome, and a great help for me, but I can''t seem to figure one thing out. Call me a newbie if you want, but when I bind a texture and make something with it, how can I get rid of that texture so I can use the plain and simple shapes without a texture? What I am trying to do right now is basically make a text box, but of course my box is the same texture that I''ve previously used.
Bind something that doesn''t exist. If you have texture[0] to texture[20] loaded, bind texture[21].

------------
aud.vze.com - The Audacious Engine <-- It''s not much, yet. But it''s mine... my own... my preciousssss...
MSN: nmaster42@hotmail.com, AIM: LockePick42, ICQ: 74128155
_______________________________________Pixelante Game Studios - Fowl Language
Advertisement
Cool, thanks a lot! I'll just use -1.

[edited by - Azurewrath on July 22, 2002 3:07:46 AM]
Never call glBindTexture with an invalid value! Instead, just use glDisable with GL_TEXTURE_2D. How hard is that?

Well, that works too, as long as you remember to enable it later (hehe). That method seems more professional, too, but what''s wrong with just putting "-1"?
quote:
Original post by Azurewrath
Well, that works too, as long as you remember to enable it later (hehe). That method seems more professional, too, but what''s wrong with just putting "-1"?


Putting -1 doesn''t chang anything, I just digged around in the mesa source, if the value isn''t valid the function return''s without changing a thing. I''m assuming driver implementations do the same thing.
"THE INFORMATION CONTAINED IN THIS REPORT IS CLASSIFIED; DO NOT GO TO FOX NEWS TO READ OR OBTAIN A COPY." , the pentagon
Advertisement
Last I checked the best way to disable textures is to bind texture ''0''. Simple, and it makes logical sense (sortof) too.
Putting "-1" is NOT the negative integer 1. It is the highest integer which is 0xFFFFFFFF because "Texture names are unsigned integers" (read from manual pages, can also be found in OpenGL specs).

Binding 0 is not meant to do the trick. 0 is a valid texture. Moreover even if it does the trick, it is slower since the GL will take texture coordinates and get (and probably interpolate many) the texel for each fragment.
quote:
Original post by Azurewrath
Well, that works too, as long as you remember to enable it later (hehe).

If you have written a half-way decent scenegraph, remembering to turn texturing back on is a non-issue.

quote:
Original post by vincoof
Putting "-1" is NOT the negative integer 1. It is the highest integer which is 0xFFFFFFFF because "Texture names are unsigned integers" (read from manual pages, can also be found in OpenGL specs).

Binding 0 is not meant to do the trick. 0 is a valid texture. Moreover even if it does the trick, it is slower since the GL will take texture coordinates and get (and probably interpolate many) the texel for each fragment.


Good point that I hadn''t thought of (and probably never would have on my own), but still I doubt I will ever create a texture with a number that high anyway. I do use texture 0, though. I don''t know why, but using an invalid texture seems to do the job for me, but you say it will be slower? Oh well, "glDisable(GL_TEXTURE_2D);" works perfectly fine for me. Thanks guys for all of your input. I''m quite new to OpenGL, and, as you can tell, I am new to this forum.

This topic is closed to new replies.

Advertisement