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
0 is a VALID texture !
The thing is, it is the DEFAULT texture that you certainly apply with the DEFAULT texture environment which behaves almost like disabling texturing.
That's what you look at now.
But later when your engine get new features, it will certainly NOT be good anymore.

[edited by - vincoof on July 23, 2002 1:31:53 AM]
if you would knew how your gl works, you would knew that if you bind an invalid texture, you will not change the pixelshader (yes, every gl has sort of a pixelshader, its called texenv). that means your gpu will calculate with the texture, uses it in the perpixel equation. that can result in undesired results.

if you dont want a texture, DISABLE the texturestage. that way you will get automatically the correct texenv back, no sideeffects will happen.

"take a look around" - limp bizkit
www.google.com
If that's not the help you're after then you're going to have to explain the problem better than what you have. - joanusdmentia

My Page davepermen.net | My Music on Bandcamp and on Soundcloud

Advertisement
Alright, I was just curious as to what difference it would make, and vincoof, I don''t know if we are misunderstanding each other, but I knew very well that 0 is valid; I use 0.
Are you guys completely sure that zero (0) is a valid texture ID?

I ask because I''ve written a simple MS3D loaded based on one of NeHe''s tutorials (#31). In this tutorial, and consequently in my code, the texture ID stored as part of a material is checked with if (textureID > 0) {... } before binding the texture. Now, if 0 is actually a valid value for the texture ID, the code risks to mess up the rendering of my models by not binding all the textures correctly .

I tried to look around for alternative methods determine if a given GLuint is a valid texture ID. I found the method glIsTexture(GLuint texture). Here is what the platform SDK help in MSVC had to say about that function:

quote:

If the texture parameter is currently the name of a texture, the glIsTexture function returns GL_TRUE. The glIsTexture function returns GL_FALSE if texture is zero. It also returns GL_FALSE if it is a non-zero value that is not currently the name of a texture, or if an error occurs.



That is, this function automaticly returns false if the ID == 0. That seems to contradict the whole idea that zero is a valid value for the ID.

I''m confused. Can anyone clear up the situation?

i just use NULL:
glBindTexture(GL_TEXTURE_2D,NULL);
that''s it. -PmanC
Azurewrath: I apologize. I misunderstood your post.

nicba: 0 is the default texture. You may not modify it. To be honest I'm not sure if it's really dangerous to modify it, but I think it is.
From the manual pages of glBindTexture :
quote:
Texture names are unsigned integers. The value zero is reserved to represent the default texture for each texture target.


PmanC: Please read what NULL is and then come back please :

  #define NULL 0  


[edited by - vincoof on July 23, 2002 3:28:32 PM]
Advertisement
Well, after re-reading my post again, I can see just how you misunderstood me, and it''s quite alright. I''m just curious, but where is that line from (NULL being defined as 0)?
WINDEF.H line 56 ( If you''re using VC++ 6 )
I''ve been using the texID 0 without problems. Actually, I loaded up *MY* default texture into that slot. It''s perfectly valid. Yes, OpenGL uses ''0'' has it''s default texture (In case you, for instance, have glBindTexture between glBegin and glEnd, but all it does is have that id bound by default. Modifying it has no effect on anything.
Deyja: You must be right since OpenGL specifications does NOT warn from using texture name 0 with glTexImage. Thanks for the clarifications.

This topic is closed to new replies.

Advertisement