PDA

View Full Version : About hardware acceleration



T.james
06-12-2006, 09:40 PM
Now I need some codes about hidden_surface elimenation algorithm,and the codes must be implemented by hardware accelerated.
May any hero give some referrences of relative datums.
The datas I have got are some objects obtained by some bodys intersection.Then I want to put them into depth buffer,and at last get the data of most top surface.
That means the intersection operation should be implemented by the OpenGL languages concerned hardware acceleration. And first of all,I can get the datas at last, not only render them on the screen.
Thanks to any body any data any code which have a little relation with it. So urgent for you reply!!!!!!Thank you!!

V-man
06-13-2006, 06:24 AM
GL is a renderer. It is possible to use it to do hidden surface removal. I think you want to render as wireframe and the hidden surfaces should not render.

1. glColoMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE);
2. glPolygonMode(GL_FRONT, GL_FILL);
3. Render your object. Now the depth buffer is filled with proper values.
4. glColoMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
5. glPolygonMode(GL_FRONT, GL_LINE);
6. Render your object

There is the issue of z fighting because the lines nearly have the same z as the polygons.
You can tinker with glPolygonOffset and enable line offsetting. Maybe glPolygonOffset(-1.0, -1.0) will do or is it glPolygonOffset(1.0, 1.0)

For the "intersection operation", you need a 3rd party library or find an innovative way to use what GL offers.
GL doesn't actually compute intersections.

T.james
06-14-2006, 03:39 AM
Thank you for your answer!
The algorithm I have got from one thesis conceived that the datas of some bodys maybe intersect or not could be put into depths_buffers in order. For OpenGL can offer the hidden_surface elimination function, the image at last appeared on screen would be the most top surface.And the proccess is implemened by hardware, so my quesition is:
1.To confirm the core process are hardware acceleration,which functions are suitable?
2.The outcome can appears on screen easily, but I need the datas of the most top surface,how can I get them? And which funtions are suitable?

Thank you for you !

Korval
06-14-2006, 01:05 PM
OpenGL is a rendering system. It does "hidden surface elimination", but it does it only to the extent that it needs it for rendering purposes.

You should not use OpenGL to determine whether a particular object is visible for CPU purposes; you should instead have your own functions for that. The round-trip time for asking for that kind of information is slower than just doing it yourself.

T.james
06-14-2006, 08:14 PM
May be you are right, But the algorithms I reffered have been achieved by the author.The problem is I can`t obtain the details.
Now there is a rising topic called CPGPU,and which ancestor can be thought as OpenGL.And It applied hardware acceleration in the earler time.
So I still think it is doable! Please any more usefull in formation,thanks!

Brolingstanz
06-14-2006, 09:22 PM
The problem is I can`t obtain the details.Sure you can. You're just going to have to dig a bit deeper. V-man and Korval have given you enough to keep you busy for the next year, at least.

T.james
06-14-2006, 09:34 PM
Just one mouth,I will have to solve them perfectly.If the algorithm turn out to be not useful,I must find another.One year is too long for everyone to waste. OpenGL are tighted to hardware acceleration, why the corelative information or codes presents so thin!!

V-man
06-15-2006, 01:46 PM
Originally posted by T.james:
1.To confirm the core process are hardware acceleration,which functions are suitable?
2.The outcome can appears on screen easily, but I need the datas of the most top surface,how can I get them? And which funtions are suitable?
It's hard to answer this kind of question because you are asking people to write down a lot of info.
These days, GPU have the majority of GL in silicon. The important stuff is entirely on silicon plus specialized vendor extensions.

z buffer has been in silicon for many generations but something like line rendering (I think thick lines, more than 1 pixel) is not but is emulated with polygons.

For #2, maybe you can render each poly with a different color and readback the framebuffer content. Occlusion queries might be useful.