| |||
| [Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] |
| Hello I am in the process of modifying the 10.5 Quartz Composer GLHeightfield plugin example for my own devious purposes, 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. Fun stuff. Except i cannot figure out how to properly texture the VBO being drawn. 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 for the Quartz Plugin 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? Apologies if this is self evident, this is a bit deeper into OpenGL than I normally go. Thanks very much, - Anton (some code below) Thanks again, <snip of the actual VBO drawing - not the VBO creation (its in the developer examples for Quartz Composer within the GLHeighField example) > /* 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 |
_______________________________________________ Do not post admin requests to the list. They will be ignored. Mac-opengl mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/mac-opengl/email@hidden This email sent to email@hidden
| Home | Archives | FAQ | Terms/Conditions | Contact | RSS | Lists | About |
Visit the Apple Store online or at retail locations.
1-800-MY-APPLE
Contact Apple | Terms of Use | Privacy Policy
Copyright © 2007 Apple Inc. All rights reserved.