|
| [Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] |
Well, do to everyone (approximation) informing me that open-GL's array
functions would greatly increase the performance I went and looked at
(the very few) examples I could find using them (all of the GLUT
examples apparently use display lists - which makes me wonder if their
even better?) Anyways to cut to the point I've set up a simple app to
help me learn some tricks of speeding up my main app - I've made me an
array of vertices and enabled the array like so...
static GLfloat vertices[] = { 0.0, 0.5, 0.0,
-0.5, 0.0, 0.0,
0.5, 0.0, 0.0,
0.0, -0.5, 0.0,
0.5, 0.0, 0.0,
-0.5, 0.0, 0.0};
glEnableClientState(GL_VERTEX_ARRAY);
glVertexPointer(3, GL_FLOAT, 0, vertices);
Now I can get this to render fine with glArrayElement() or
glDrawArrays; however I can't get it to render at all using
glDrawElements() I've looked through the Red Book but haven't came up
with much... I know that glDrawElements() only takes uByte, uShort, or
uInt for its type - so I tried switching my array over to be GLubyte
and calling glDrawElements like so...
glDrawElements(GL_TRIANGLES, 18, GL_UNSIGNED_BYTE, vertices);
But it doesn't render anything to the screen.
Any idea where I'm going wrong here?
Also, is there any (semi-simple) examples on using the
APPLE_vertex_array_object and APPLE_element_array extensions? I've
looked (briefly) at both Vertex Optimization and VertexPerformanceTest
but they seem to concentrate solely on the APPLE_array_range extension
or can you not have one without the other? To be completely honest I'm
a bit lost when it comes to finding any kind of information on the
extensions I've looked over their specs but its a little hard to grasp
- I guess I'll just have to read over them a few more times.
| References: | |
| >glDrawElements and Arrays (From: Lee Morgan <email@hidden>) |
| Home | Archives | 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 © 2011 Apple Inc. All rights reserved.