Skip to main content
gamedev.net
🔒 Locked

accessing image data

Started by bschwagg Sep 29, 2002 at 3:28 PM 1 replies 500+ views
Original Post
bschwagg
bschwagg
Hi, i''m trying to create a LOD heightmapped terrain. I found a *.rgb loader to use which i know works. An (unsigned int *) data is given to the glTexImage2D(...) function to create textures. I know the width, height, & components of it. I know its also in the form of: GL_RGBA, GL_UNSIGNED_BYTE what would be the procedure to get the RGB values of this texture? So far i''ve only been able to extract junk. The loader source for rgb''s is very complex, but i''d like to use rgb images because i''m working in Unix. any help would be greatly apreciated!
cha cha cha
bschwagg
bschwagg
well.... this one i got myself & im dang near impressed i figured it out.
2 things:
1)changed data ''buf'' from a unsigned int * to a GLubyte
2)pointHeightRED = buf[components*(y*width + x)]/255.000;
pointHeightGREEN = buf[components*(y*width + x)+1]/255.000;
etc,...

I know i wouldv''e gotten this same response soon, because everyone on this forum knows so much knowledge about everything. now i can help out the kid who asks the same question later on...
peace
cha cha cha
zedzeek
zedzeek
im not to sure what u want if u want to get the RGBA (or whatever) values from a opengl texture first bind it + then call glGetTexImage(..)

http://uk.geocities.com/sloppyturds/kea/kea.html
http://uk.geocities.com/sloppyturds/gotterdammerung.html

Topic Locked

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

Sign in to reply to this topic.