Hello, I am in the process of modifying the GLHeightfield example, and have added some patch inputs that do various things, and have modified some of the openGL state variables, and would like to texture the output geometry rather than simply color it.

Ive done a bit of reading on texturing vertex buffers arrays, and it seems the 'proper' technique is to use interleaved buffers by rendering out the texture coordinates, etc next to the vertex values, but implementing this is a bit above my head. *cough* ok more than a bit.

Ive added an image input named "image" (I renamed the original image input to imageLuma (the actual texture that does the displacement) - to clarify the two sources), and have wrapped the VBO drawing code with texture binding code. It seems however the VBO does not have any 'useful' texture coordinates.

So, in short, how does one specify texture coordinates for the glDrawElements without using interleaved buffers?

Thanks very much,

Anton

(some code below)

Apologies if this is received twice, I sent this once from an address unsubscribed from the list.

Also, apologies if this belongs more in the OpenGL dev list.

Thanks again,

<snip>

/* Draw the VBO */
        glEnable(GL_BLEND);
        glBlendFunc(GL_SRC_ALPHA, GL_ONE);
if(image && [image lockTextureRepresentationWithColorSpace:[image imageColorSpace] forBounds:[image imageBounds]])
        {
[image bindTextureRepresentationToCGLContext:cgl_ctx textureUnit:GL_TEXTURE1 normalizeCoordinates:YES];
                
                glEnableClientState(GL_VERTEX_ARRAY);
                glBindBuffer(GL_ARRAY_BUFFER, _vertexBuffer);
                glVertexPointer(4, GL_FLOAT, 0, NULL);
glDrawElements(GL_TRIANGLES, (kSize - 1) * (kSize - 1) * 6, GL_UNSIGNED_INT, _indices);
                glBindBuffer(GL_ARRAY_BUFFER, 0);
                glDisableClientState(GL_VERTEX_ARRAY);
        
[image unbindTextureRepresentationFromCGLContext:cgl_ctx textureUnit:GL_TEXTURE1];
                
                [image unlockTextureRepresentation];
        
        } // end addition by vade

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Quartzcomposer-dev mailing list      ([email protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/quartzcomposer-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to