Archived

This topic is now archived and is closed to further replies.

I have almost been converted

This topic is 5266 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

After wasting countless hours because of a driver problem with DirectX, I''m about to switch to OpenGL. I do have a few questions I would like answered though. As long as you didn''t do anything really stupid, it was pretty easy to get fairly good performance in DirectX. It seems a little harder in OpenGL, but it also seems a little more forgiving if you do mess up. Since I''m so used to using vertex buffers, how hard is it to use the new vbo extension? Is it widely supported? If not, would I be better off using display lists instead? What model format do people recommend? Milkshape3D''s format looks nice but I don''t own a copy of it . Is there a free program that can convert 3ds files to ms3d? What''s up with OpenGL 2.0? I keep hearing elements of it are already being released (like the new vbo extension). Is it going to be an entirely new release or what? Thanks!

Share this post


Link to post
Share on other sites
the new arb_vertex_buffer_object-s are supported by the newer chips. however opengl still has _conventional_ "vertex buffers". arb_vertex_array has been added in opengl 1.1 and is supported by nearly any of todays chips. unlike vbo, arb_vertex_array has its geometric information on the "client side"-memory, and has to transfer it to the graphics device at the time it is beeing rendered. arb_vertex_array generaly is some slower than vbo-s but always faster than immidiate mode. arb_vertex_array should be as fast as display lists, with the difference that you can change the geometry, while you can't do that with display lists. if you have to draw the same object several times, you can "compile" the vertex array, and so gain performance with it ( nearly as fast as vbo )

uh.. there is no *best* model format. use what you like. milkshape 3d is freely(shareware) downloadable at it's homepage, and milkshape can convert 3ds to ms3d



[edited by - 666_1337 on August 16, 2003 3:06:32 PM]

Share this post


Link to post
Share on other sites
As a lot of people say around here when the question of model format comes up, other formats are fine but eventually most games end up writing their own format.

At the end of the day all you are doing is putting geometry from a file into memory so just use what you are comfortable with.

Share this post


Link to post
Share on other sites
I know it's "free", but after 30 days you can't save files anymore. My 30 day trial ran out .

Maybe I should just shell out the $25. I hear it's great for exporting to your own format...

[edited by - Raloth on August 16, 2003 3:15:35 PM]

Share this post


Link to post
Share on other sites
quote:
Original post by Raloth
I know it''s "free", but after 30 days you can''t save files anymore. My 30 day trial ran out .

Maybe I should just shell out the $25. I hear it''s great for exporting to your own format...

[edited by - Raloth on August 16, 2003 3:15:35 PM]



Yeah writing your own plugin''s is nice and easy

Share this post


Link to post
Share on other sites
Thanks everyone for your answers. I have a quick question about vertex arrays. I've done some searching and I can hardly find any information about them. Everyone always says "search", but they've filled up the search engines with it! Basically I'm just confused by the whole concept . I mean, I understand what they are, but not at all how to use them. Also, I've come across references to indexing with them, but not a single source showing how to use indexing with vertex arrays. Can anyone clear this up for me please?

[edit] I figured it out! MSDN comes to the rescue again.

[edited by - Raloth on August 16, 2003 9:56:24 PM]

Share this post


Link to post
Share on other sites
arrays are pretty much the same as the vertex and index buffers in d3d. just that you dont have to "lock" them or anything. vbo is even closer and except that the functions have different names work quite the same (and of course: you can be sure, that they will still work exactly the same in 2 years, because nobody but ms would just keep changing interfaces with every version to make porting version x to version y as painful as possible).

btw. if you know how vertex and index buffers work, the only difference is setting a pointer to the vertex array/buffer and calling drawelements instead of drawarray. a bunch of examples can be found in the specs for vbo.

http://oss.sgi.com/projects/ogl-sample/registry/ARB/vertex_buffer_object.txt

Share this post


Link to post
Share on other sites
arb_vertex_array (or ext_vertex_array): you have your geometry anywhere in the memory, like you do with direct3d''s vbs.


float quadVertices[4][3] = //vertices of a quad
{
{ 0.0f, 0.0f, 0.0f }, //first vertex
{ 1.0f, 0.0f, 0.0f }, //second vertex
{ 1.0f, 1.0f, 0.0f }, //third vertex
{ 0.0f, 1.0f, 0.0f } //fourth vertex
};


you also know in what order this vertices are to be passed to the graphics card


unsigned int order[6] = //6 indices, since a quad consitist of 2 triangles, having 3 vertices each
{
0, 1, 2, //first triangle
0, 2, 3 //second triangle
};


now in immidiate mode you would do this:

glBegin(GL_TRIANGLES);
for(int i = 0; i < 6; i++) //loop through "order"
glVertex3fv( quadVertices[ order ] ); //call the vertex "order" is _pointing_ to
glEnd();


now with vertex arrays (first posibility):

glVertexPointer( 3, GL_FLOAT, 0, quadVertices ); // _mount_ the array. google on "glVertexPointer" for more information
glEnable(GL_VERTEX_POINTER); //enable vertex array

glBegin(GL_TRIANGLES)
for(int i = 0; i < 6; i++)
glArrayElement( order[i] ); //glArrayElement calls a vertex of the vertex array
glEnd();

glDisable(GL_VERTEX_POINTER); //disable va


vertex arrays (second posibility):

glVertexPointer( 3, GL_FLOAT, 0, quadVertices );
glEnable(GL_VERTEX_POINTER);

glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_INT, order); //calls 6 unsigned integers from "order"-s memory location, and renders them as triangles.

glDisable(GL_VERTEX_POINTER);


Share this post


Link to post
Share on other sites
quote:
Original post by 666_1337

now with vertex arrays (first posibility):

glVertexPointer( 3, GL_FLOAT, 0, quadVertices ); // _mount_ the array. google on "glVertexPointer" for more information
glEnable(GL_VERTEX_POINTER); //enable vertex array

glBegin(GL_TRIANGLES)
for(int i = 0; i < 6; i++)
glArrayElement( order ); //glArrayElement calls a vertex of the vertex array
glEnd();

glDisable(GL_VERTEX_POINTER); //disable va


vertex arrays (second posibility):

glVertexPointer( 3, GL_FLOAT, 0, quadVertices );
glEnable(GL_VERTEX_POINTER);

glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_INT, order); //calls 6 unsigned integers from "order"-s memory location, and renders them as triangles.

glDisable(GL_VERTEX_POINTER);





Thats wrong, this is the way to do it :

// first enable it

// you can also call this with

// GL_NORMAL_ARRAY, GL_TEXCOORD_ARRAY, GL_COLOR_ARRAY, ...

glEnableClientState(GL_VERTEX_ARRAY);
// then setup the array

glVertexPointer(3,GL_FLOAT,0,ptr_to_array_of_vertices);
// there are also glNormalPointer, glTexCoordPointer,

// glColorPointer ... to setup vertex arrays with normals

// texture coordinates and color values


// then render using

glDrawArrays or glDrawElements


Anyway the whole proces is explained in the red book (which you can find online somewhere, just google OpenGL RedBook or something like that).

Share this post


Link to post
Share on other sites
quote:
Original post by 666_1337
if you have to draw the same object several times, you can "compile" the vertex array, and so gain performance with it ( nearly as fast as vbo )


For a start, CVA''s are horrible, thier actual implementations change so much, that it makes it next to useless to use ( so I hear, I used them and never got any speed increase what so ever ). Plus, CVA''s are incompatible with VAR/VBO, and get no where near the same speed anyway.

You have to remember that you''re unique, just like everybody else.

Share this post


Link to post
Share on other sites
I''ve never had a good experience with CVA''s or display lists.

Basically, VBO''s or even just plain vertex arrays, are you''re best bet for speed. The slight difference in speed between VBO''s/VA''s, is not such a big deal, since most next-gen games these days are limited by fill rate, not necessarily triangle rate.

Share this post


Link to post
Share on other sites
hm.. i wouldnt call it "slight" difference.. also i agree on the fillrate problem in general it wont be a problem if instead of having a few big triangles you render a lot of small triangles. fillrate shouldnt change, but detail definitely would (at least along the edges, now that everybody noticed what normalmaps can be used for ,-) )

Share this post


Link to post
Share on other sites