View previous topic :: View next topic |
Author |
Message |
quartz
Joined: 02 Jul 2006 Posts: 35 Location: Florida, US
|
Posted: Sun Jul 02, 2006 12:53 pm Post subject: Vertex Arrays |
|
|
Greetings,
I was wondering if anyone has used Vertex Arrays with D/Dererlict yet. I am attempting to use them but no success yet. I can use immediate mode and Displaylists fine but converting it to VAs doesn't seem to work.
I made sure when I allocated arrays as GLunit* and not GLuint[] such that it works with the OpenGL C API.
Of course i could have something wrong with how i am filling the arrays.
Any suggestions? I appreciate it. |
|
Back to top |
|
|
jaak
Joined: 02 Jul 2006 Posts: 5
|
Posted: Sun Jul 02, 2006 1:36 pm Post subject: |
|
|
The following worked for me:
Code: |
GLfloat[] qtVertices;
GLfloat[] qtColors;
GLuint[] qtList;
// create lists here as normal dynamic arrays
glVertexPointer (3, GL_FLOAT, 0, qtVertices.ptr);
glColorPointer (3, GL_FLOAT, 0, qtColors.ptr);
glDrawElements(GL_TRIANGLE_STRIP, N, GL_UNSIGNED_INT, qtList.ptr);
|
|
|
Back to top |
|
|
quartz
Joined: 02 Jul 2006 Posts: 35 Location: Florida, US
|
Posted: Sun Jul 02, 2006 5:14 pm Post subject: RE: Vertex Arrays |
|
|
Thanks jaak,
Oops, I went back and analyzed my code further and found my mistakes. I was defining my vertex coords wrong. However, your suggestion seems like a better way of passing arrays to C than declaring pointers. I do want the bounds checking feature of D but i didn't realize you could use the .ptr property like that. I guess the .ptr property skips over the hidden array info stuff.
Now my trival game runs about several times faster with VertexArrays!, Yea! I ported an earlier version of mine, done in java, to D in order to evaluate the language and I am very, very impressed with D. I will be posting my D version tonight some time but here is the current site for it. I admit it is a silly game, but fun to write and play:
http://distanthumans.info/programming/java/spout.php
Seeing as D is an excellent language (what C++ should have been long ago), I have stopped mid stream with my Bosconian clone and will now begin porting it over. I may look into clayasaurus's engine after a while; I'm not that much into to lua though, i much prefer python.
Thanks for the info and suggestion.
-Will. |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|