VBO and indexed vertexes

Started by
5 comments, last by guvidu 16 years, 1 month ago
Hy there. Maybe you can help me with this and tell me whats the best way of rendering my objects. i have the vertexes put in an array "vertexes" i have the textures and normals also put in their own arrays. and i have the indexes of the vertexes. what im doing now is like this: at initialization compute a vector<CVector3> verts with all the vertexes push_back based on de indexes... - so from 200 "vertexes" i now have like 600 put in the vector "verts". afther that compute a VBO - clear the vector "verts" and render the VBO. what i want is to pass the "vertexes" to the vbo not the "verts" - so instead of passing 600 just pass 200. and then render based on the indexes. i tried this with glVertexPointer(....vertexes); glDrawElements(..... indexes); but that doesnt give me performance; so i may be doing something wrong. Can you guys help me? pls forgive my english:) Thanks
Advertisement
There is an example here. It places vertices, texcoord, normals in the same array. It is called an interlaced format, for better performance.

http://www.opengl.org/wiki/index.php/GL_ARB_vertex_buffer_object
Sig: http://glhlib.sourceforge.net
an open source GLU replacement library. Much more modern than GLU.
float matrix[16], inverse_matrix[16];
glhLoadIdentityf2(matrix);
glhTranslatef2(matrix, 0.0, 0.0, 5.0);
glhRotateAboutXf2(matrix, angleInRadians);
glhScalef2(matrix, 1.0, 1.0, -1.0);
glhQuickInvertMatrixf2(matrix, inverse_matrix);
glUniformMatrix4fv(uniformLocation1, 1, FALSE, matrix);
glUniformMatrix4fv(uniformLocation2, 1, FALSE, inverse_matrix);
Quote:Original post by V-man
There is an example here. It places vertices, texcoord, normals in the same array. It is called an interlaced format, for better performance.

http://www.opengl.org/wiki/index.php/GL_ARB_vertex_buffer_object


Interleaved :) not interlaced!
You say tomato, I say potato.
Sig: http://glhlib.sourceforge.net
an open source GLU replacement library. Much more modern than GLU.
float matrix[16], inverse_matrix[16];
glhLoadIdentityf2(matrix);
glhTranslatef2(matrix, 0.0, 0.0, 5.0);
glhRotateAboutXf2(matrix, angleInRadians);
glhScalef2(matrix, 1.0, 1.0, -1.0);
glhQuickInvertMatrixf2(matrix, inverse_matrix);
glUniformMatrix4fv(uniformLocation1, 1, FALSE, matrix);
glUniformMatrix4fv(uniformLocation2, 1, FALSE, inverse_matrix);
Quote:Original post by V-man
You say tomato, I say potato.

The problem is that interlaced already has another, very specific meaning, also as related to graphics (i.e. 1080i as opposed to 1080p for resolutions).

Tristam MacDonald. Ex-BigTech Software Engineer. Future farmer. [https://trist.am]

Quote:Original post by V-man
You say tomato, I say potato.


I really laughed out loud.
This is what i was looking for - thanks alot :)

This topic is closed to new replies.

Advertisement