| |||
| [Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] |
| Thank you very much Stefan - this has helped point me in the right direction. Im still having some issues however (again, apologies if most of this is self evident - this is way beyond my normal hobbying around - I appreciate anyone taking the time to look at this). I would love some more guidance on this subject. Here is what I am attempting in a bit more detail ( taken from 10.5s Quart Composer example patch GLHeighField) I am generating two VBOs and allocating memory for them : (kSize is a constant, say 128/256) /* Create VBOs */ glGenBuffers(2, &_vertexBuffer); // change this to two buffers - one for VBO and the other for Texture Coords glBindBuffer(GL_ARRAY_BUFFER, _vertexBuffer); glBufferData(GL_ARRAY_BUFFER, kSize * kSize * 4 * sizeof(GLfloat), NULL, GL_DYNAMIC_COPY); glBindBuffer(GL_ARRAY_BUFFER, 1); // for textures glBufferData(GL_ARRAY_BUFFER, kSize * kSize * 4 * sizeof(GLfloat), NULL, GL_DYNAMIC_COPY); glBindBuffer(GL_ARRAY_BUFFER, 0); // for verts I Draw to them via // for textures glBegin(); blah blah glEnd(); glBindBuffer(GL_PIXEL_PACK_BUFFER_ARB, _vertexBuffer); glReadPixels(0, 0, kSize, kSize, GL_RGBA, GL_FLOAT, NULL); glBindBuffer(GL_PIXEL_PACK_BUFFER_ARB, 1); // use the second buffer for texturing. yay?
// for verts glBegin(); blah blah glEnd(); /* Copy the rendered pixels into the VBO */ glBindBuffer(GL_PIXEL_PACK_BUFFER_ARB, _vertexBuffer); glReadPixels(0, 0, kSize, kSize, GL_RGBA, GL_FLOAT, NULL); glBindBuffer(GL_PIXEL_PACK_BUFFER_ARB, 0); // use the first buffer for verts Now, I am attempting to draw the vertex buffer with glDrawElements, using both the vert buffer and the pseudo texture buffer vert hack thingy (ahem :) ) glEnableClientState(GL_VERTEX_ARRAY); glBindBuffer(GL_ARRAY_BUFFER, _vertexBuffer); glVertexPointer(4, GL_FLOAT, 0, NULL); glBindBuffer(GL_ARRAY_BUFFER, 0); glEnableClientState(GL_VERTEX_ARRAY); glBindBuffer(GL_ARRAY_BUFFER, _vertexBuffer); glTexCoordPointer(4, GL_FLOAT, 0, NULL); glBindBuffer(GL_ARRAY_BUFFER, 1); glDrawElements(GL_TRIANGLES, (kSize - 1) * (kSize - 1) * 6, GL_UNSIGNED_INT, _indices); glDisableClientState(GL_VERTEX_ARRAY); Again, this is just me attempting to reverse engineer the example code and infer proper syntax. Ive consulted google and checked up on some other fora, however I am still at a loss - so I do appreciate any other guidance. Thanks in advance (again).
On Oct 31, 2007, at 5:54 PM, Stefan Dösinger wrote: Am Mittwoch, 31. Oktober 2007 21:14:25 schrieb vade:So, in short, how does one specify texture coordinates for theglDrawElements without using interleaved buffers? Apologies if this isself evident, this is a bit deeper into OpenGL than I normally go.If I understand it correctly, using two vbos might be helpful: Create one vbo |
_______________________________________________ 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.