Use texture as geometry

I have a texture that is used as a texture. However, I’d also like to use the RGB values as XYZ vertex values. What would be the best way to do this?

Two ways actualy - by rendering that texture to vertex buffer or by using this texture in vertex shader.
To use in shader it has to be FLOAT32 format with GL_NEAREST (no filtering and no mipmaps). It will require GeForce 6 / Radeon X1000 to work though.

AFAIK, Radeon X1000 does not support any vertex texture formats…

Originally posted by k_szczech:
To use in shader it has to be FLOAT32 format with GL_NEAREST (no filtering and no mipmaps). It will require GeForce 6 / Radeon X1000 to work though.
No current ATI hw has support for texture fetches in vertex shader so it will work on Nvidia cards only.

No current ATI hw has support for texture fetches in vertex shader so it will work on Nvidia cards only.
I thought the X1xxx cards did have vertex texture support.

Yeah, I thought they have floating point filtering, too. But it turns out that they have fp blending but still no filtering. Seems like when comes to floating point textures ATI is way behind NVIDIA.

It’s like I always say - if in doubt, get the nvidia card.

Vertex texture fetch is supposed to have pretty high latency, at least in GeForce 6 and 7 (probably much better in GF8). You’re probably better off using a separate vertex buffer for the geometry data.

If the texture is being generated on the GPU (e.g., with a FBO), you can use glReadPixels or glGetTexImage with the VBO bound to GL_PIXEL_PACK_BUFFER to do the copy entirely on the GPU.

that’s a great name you’ve got, bruce.

HI
My name is Aji Abraham. Am now working with OpenGL Game Programming… Now am in between a Big issue in thread programming… My problem is that when i try to load GL textures in a thread (To load texture in background) glGenTextures is not working. is der any solution…

Ok Aji, yours is a great name too. Happy?

(secretly I don’t think it’s as great a name as Bruce Merry)

@knackered:
:slight_smile: )))))

@Aji Abraham:
OpenGL calls is allowed only from thread that own GL context. ie… when some app thread execute wglMakeCurrent(rc, dc) only that thread may do OpenGL calls.
There is a solution for your problem:

  1. load texture data (using separate thread) in mem buffer and notify rendering thread to upload texture.
  2. Create another GL context (temp_rc) and share lists (using wglShareLists call) with main rendering context. Then fire up texture-loader-thread and from this thread call wglMakeCurrent(temp_rc, dc). Now… you can load and gen opengl textures from texture-loader-thread.