Skip to main content
GameDev.net gamedev.net
🔒 Locked

Getting pixel data from a texture object.

Started by cowsarenotevil Sep 4, 2003 at 10:37 PM 4 replies 450+ views
Original Post
cowsarenotevil
cowsarenotevil
Don''t you hate that sudden feeling of retardation that you get when you realize that you don''t know something that you probably should? Anyway, I''m sure there''s a relatively easy way of doing this, but what is it?
-~-The Cow of Darkness-~-
MazyNoc
MazyNoc
glGetTexImage is what youre looking for..

I think you must get the width/height and other properties first.. but those are glGet* as well

Then I dont see the use of it if you have uploaded the image, you can keep a copy in system mem ( get is suer to be much slower than upload it), or if its a realtime created texture it probably was rendertarget at some point and then a glReadPixels would work ( and thats slow to, but i think its more demands on making that fast, and reliable than glGetTexImage )
cowsarenotevil
cowsarenotevil
Actually, I was planning on rendering to a texture and then getting the coordinates from the texture. Now that you mention it, there''s probably a better way, but oh well.
-~-The Cow of Darkness-~-
cowsarenotevil
cowsarenotevil
Ok, if format is GL_RBG, type is GL_FLOAT, and pixels is a pointer to an array of GL_FLOATs, how will the data be stored? The MSDN doesn't really explain it.

EDIT: Shameless edit-bump

EDIT: Again
EDIT: I think I might sctually have it figured out, never mind.

[edited by - cowsarenotevil on September 6, 2003 10:16:40 AM]
-~-The Cow of Darkness-~-
MazyNoc
MazyNoc
you didnt say if it was the glTexImage2d or glGetTexImage that youre calling with those values.
cowsarenotevil
cowsarenotevil
It''s a 2D texture.
-~-The Cow of Darkness-~-

Topic Locked

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

Sign in to reply to this topic.