I have the data of pcb circuit and I want to draw it in 3D/2D quickly. All parts in pcb are not same. In same pcb can be 200,000 parts and the other objects. The parts can be only line, pixel, circle, rectangle or some combinations of this.
My data saved in database like list of points for lines, rectangles, pixels and radius for circles. I get the data from database and trying to draw it by vertex coordinates. It works little slow. I need this quickly.
I need the suggestion how to solve it.
Your problem seem me to be the time that you have to read datas from your database …
You need first to transform your data into a “more OpenGL friendly format” and save this to disk (a binary format seem generally the best choice for the speed, but is not always easy portable across differents OS and is not “human readable”).
After, you have only to load/decode this data and send it to OpenGL …
Are you calling glBegin/glEnd for each circuit element? How are you doing your rendering actually?
If you just render every element as a batch(with a glBegin/glEnd call) the performance will be really teriffic.
The best way would be to transform all your primitives in some sort of preprocess and put them into a vertex array. This would be most “opengl friendly”
Originally posted by Zengar
Are you calling glBegin/glEnd for each circuit element? How are you doing your rendering actually?
If you just render every element as a batch(with a glBegin/glEnd call) the performance will be really teriffic.
I am sure he meant performance WON’T be really terrific.
I assume you have vertex data of each element and most of your elements don’t use textures (lines and points) and there probably won’t be many transformations (i assume every vertex to be in object space), to break up your batching. You can put similar data e.g. all the lines in one vertex buffer and all the points in another and all the polys in yet another . You can then issue just one draw call for each buffer e.g. you call glDrawRangeElements(…, GL_LINES, …) to draw all the lines in the buffer containing data for lines. You can also use VBO’s if your data doesn’t change frequently. I doubt that there will be many triangles in your scene, but in case there are many then you can try to arrange your triangles in a triangle strip (as opposed to a triangle list) to increase performance.
But i bet that its the lines and points that are really degrading your performance. Most consumer cards are optimized for polygon drawing (and not line drawing). Workstation cards are really optimized for line drawing since its their requirement.
Hope it helps.
Originally posted by Zulfiqar Malik:
[b] [quote]
Originally posted by Zengar
Are you calling glBegin/glEnd for each circuit element? How are you doing your rendering actually?
If you just render every element as a batch(with a glBegin/glEnd call) the performance will be really teriffic.
I am sure he meant performance WON’T be really terrific.
[/b][/QUOTE]“Terrific” as “bad”, “terrible”