Jump to content
  • Advertisement
Sign in to follow this  
flylin

OpenGL How to manipulate(translate\rotate) massive model in opengl more fast?

This topic is 3422 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

language:vc++ graphic platform: opengl a Large Model Visualization, more than one million triangles element, onece i display the model, if i translate or ratate it, it's display very slowly. i hope it can be like the cad system performce, can you give me some good propose?

Share this post


Link to post
Share on other sites
Advertisement
You should try to give more information, like the algorithm you are using ;)

Do you only redraw the screen when the model moves? Then your drawing is the issues. Or is the rotating/translating the problem. You are doing the translate/rotate part on the GPU, right? You aren't using immediate mode, right?

Share this post


Link to post
Share on other sites
oh, my use like this:

glTranslatef();
glRotatef();
glScalef();

//draw model
glBegin(GL_TRIANGLES)
glVertex3f();
glVertex3f();
glVertex3f();
glEnd();


if my model is too big, once i ratate the my model, the display is very slowly,

i just use opengl only , i didn't write other algorithm!

thank you!

Share this post


Link to post
Share on other sites
For large models (and certainly by the time you are drawing million vertex models), you need to ditch immediate mode (glBegin/glEnd/etc.), and use Vertex Buffer Objects (VBO) instead.

Share this post


Link to post
Share on other sites
swiftcoder is right - even if not VBO just using vertex arrays (glVertexPointer() etc) will be a huge step up.

Your display is going to be slow even if its not rotating, you just don't notice because nothing is moving :)

Share this post


Link to post
Share on other sites
Thanks swiftcoder and Exorcist very much!

But someone says displaylist is better than VBO ,

How do you think?

Share this post


Link to post
Share on other sites
VBO is good, you should also try to exploit structure of model you want to display. for example if it's a dense scan of simple object then you could use some LOD technique (simple clustering might work) and display reduced object when user is manipulating it. when user stops, you draw full detail.
if object is not densely sampled but has big depth complexity like large buildings then you should also use occlusion query.

Share this post


Link to post
Share on other sites
Hey,I use VBO like below,but the speed is still not satisfied to me. it's just faster than immediate mode (glBegin/glEnd/etc.) a little.


static int isFirstCall=1;
if (GLEE_ARB_vertex_buffer_object)
{

if (isFirstCall)
{
//asign a buffer,vertex to it
glGenBuffersARB(1,&g_pMesh->m_nVBOVertices);
glBindBufferARB(GL_ARRAY_BUFFER_ARB,g_pMesh->m_nVBOVertices);
glBufferDataARB(GL_ARRAY_BUFFER_ARB,g_pMesh->m_nVertexCount*sizeof (CVec),g_pMesh->m_pVertices,GL_STATIC_DRAW_ARB);

//assign a buffer, indices to it
glGenBuffersARB(1,&g_pMesh->m_nVBOIndices);
glBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB,g_pMesh->m_nVBOIndices);
glBufferDataARB(GL_ELEMENT_ARRAY_BUFFER_ARB, g_pMesh->m_nIndexCount*sizeof(int),g_pMesh->m_pIndices,GL_STATIC_DRAW_ARB);

delete [] g_pMesh->m_pVertices;
delete [] g_pMesh->m_pIndices;
isFirstCall=0;
}


glBindBufferARB(GL_ARRAY_BUFFER_ARB,g_pMesh->m_nVBOVertices);
glBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB,g_pMesh->m_nVBOIndices);

//most likely vertex array
glEnableClientState(GL_VERTEX_ARRAY);
glVertexPointer(3,GL_FLOAT,sizeof(CVec),NULL);
glDrawElements(GL_TRIANGLES,unvModel.iCTETRANum*12,GL_UNSIGNED_INT,NULL);

}
else
{
//no support vbo,using vertex array
glEnableClientState(GL_VERTEX_ARRAY);
glVertexPointer(3,GL_FLOAT,sizeof(CVec),g_pMesh->m_pVertices);
glDrawElements(GL_TRIANGLES,unvModel.iCTETRANum*12,GL_UNSIGNED_INT,g_pMesh->m_pIndices);
}

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!