PDA

View Full Version : Question on VBO



rakesh_thp
10-15-2009, 02:56 AM
hello there...

I want to use VBOs for optimization of displaying data... Now i went through many tutorials.. So, my concept (theoretically) is clear.. I mean which function does what task and all i know..

But only thing is am confused where to write the code.. Now in my case, i have, base class called Objects, and am deriving various objects from this, like, Circle, Rectangle, Lines and points.. And each of these classes are having their own Render function... In my paint event of GLCanvas, i call a function which in turn traverses a list of objects and calls their corresponding render functions..

void MainRender()
{
for(std::map<unsigned int, EObjects *>::iterator it = ObjList.begin(); it != ObjList.end(); it++)
{
(*it)->Render();
}
}

Now, glGenBuffer() has to be called only once.. So i guess it will be ok if i call it in the constructor of GLcanvas class.. Secondly, where do i write a code for binding of buffer and data.?? in the corresponding classes render event or in the MainRender() function..???

Can anyone please help me to how to proceed with..??

Thanks in advance..

Regards
Rakesh Patil

vivek vyas
10-15-2009, 10:23 AM
you may also know which function where fitted
i hope you have seen songho and might as it at first place by google search

www.songho.ca/opengl/gl_vbo.html (http://www.songho.ca/opengl/gl_vbo.html)

but i hope you also go at
http://www.opengl.org/registry/specs/ARB/vertex_buffer_object.txt

there is simple way
DrawArrays
and other bla-bla in the above opengl extension

rakesh_thp
10-16-2009, 03:16 AM
hey dude.. thanks for a quick reply... I'll definitely go through those links..

Thanks once again..

rakesh_thp
11-02-2009, 09:31 PM
Hi..

How can i select a primitive when i'm rendering objects using VBOs..??

Thanks

V-man
11-03-2009, 10:06 AM
http://www.opengl.org/wiki/Common_Mistakes#Selection_and_Picking_and_Feedback _Mode