Skip to main content
gamedev.net
🔒 Locked

glGenTextures

Started by Matt Calabrese 3 replies 700+ views
Original Post
Matt Calabrese
Matt Calabrese
Will a successful call to glGentTextures ever set a texture (2nd param) to 0? -------------------- Matthew Calabrese Realtime 3D Orchestra: Programmer, Composer, and 3D Artist/Animator "I can see the music..."
Matt Calabrese
Matt Calabrese
Also, is there a way to retrieve the GLuint identifier of the currently bound texture?

--------------------
Matthew Calabrese
Realtime 3D Orchestra:
Programmer, Composer,
and 3D Artist/Animator
"I can see the music..."
outRider
outRider
From MSDN, "Texture names are unsigned integers with the value zero reserved to represent the default texture for each texture target."

Which means if you create a texture WITHOUT first calling glGenTextures and glBindTexture on a target the identifier is 0.

For your second question, the currently bound texture needs to be bound by using glBindTexture, which needs the identifier, so if a texture is bound it should be assumed that you know its identifier since you had to have bound it. As such, I don't know of any way to retrieve the currently bound texture. You can try calling glAreTexturesResident with some identifiers and it will tell you if they are in VRAM, and the currently bound textures would be in VRAM if you had a lot of texture swapping, but if you had enough memory you'd probably have other textures that weren't bound in VRAM as well so it wouldn't work.

------------
- outRider -

[edited by - outRider on July 31, 2002 6:44:04 PM]
Null and Void
Null and Void
quote:
Original post by Matt Calabrese
Also, is there a way to retrieve the GLuint identifier of the currently bound texture?

glGet with GL_TEXTURE_BINDING_2D.

Matt Calabrese
Matt Calabrese
quote:
Original post by outRider
For your second question, the currently bound texture needs to be bound by using glBindTexture, which needs the identifier, so if a texture is bound it should be assumed that you know its identifier since you had to have bound it.


Not when they are of different scope.

Thanks, both of you!

--------------------
Matthew Calabrese
Realtime 3D Orchestra:
Programmer, Composer,
and 3D Artist/Animator
"I can see the music..."

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.