PDA

View Full Version : glDrawPixels problem in CAD application !



HanWu
06-11-2003, 08:44 PM
glDrawPixels is slow in OnBoard display card, does anyone know the fastest way that can give the same result. The speed is very important in a CAD program. i am not going to use wgl extension because not every display card support this function So can anyone tell me the best way to make my CAD program run smoothly even thought there are many object in the background when i am drawing? Does anyone know how autocad do it?(its good in every display card even in tnt2 & OnBoard display card. I wonder how autocad do it)
Please help me!! because i need to submit my program to my boss soon. Thanks

kansler
06-12-2003, 12:34 AM
The fastest alternative to glDrawPixels() on a hw-accelerated board is to use a textured quad. Combined with glTexSubImage2D(), this should give you much better performance compared to glDrawPixels(). Use glOrtho to correctly draw the quad in the window.

rgpc
06-12-2003, 12:53 AM
(a) You only need to ask once. People will answer your question if they see merit in doing so.

(b) I would bet autocad doesn't use glDrawPixels. It probably uses a "rubber banding" technique like a bitwise operation such as NOT or the like. And it's probably single buffered. It's either that or a glCopyTexSubImage() call of some sort.

HanWu
06-12-2003, 02:04 AM
sorry for duplicate question, and thanks for ur reply, i will try the method you suggest

Fredz
06-12-2003, 03:51 AM
> I would bet autocad doesn't use glDrawPixels

I wouldn't bet on that, Blender still use glDrawPixels for background image drawing for example, and the reason I was given was that it was faster this way at the time the code was written for the target hardware.

HanWu
06-12-2003, 05:33 AM
Originally posted by rgpc:
(a) You only need to ask once. People will answer your question if they see merit in doing so.

(b) I would bet autocad doesn't use glDrawPixels. It probably uses a "rubber banding" technique like a bitwise operation such as NOT or the like. And it's probably single buffered. It's either that or a glCopyTexSubImage() call of some sort.

what is rubber banding technique and bitwise operation? how to use it? Do you have any example or website to find all this stuff. Thanks in advance.

HanWu
06-25-2003, 05:38 PM
Originally posted by rgpc:
(a) You only need to ask once. People will answer your question if they see merit in doing so.

(b) I would bet autocad doesn't use glDrawPixels. It probably uses a "rubber banding" technique like a bitwise operation such as NOT or the like. And it's probably single buffered. It's either that or a glCopyTexSubImage() call of some sort.

now i have know how to use rubber binding. but if there are many object say 20000 object. When i use rubber binding techniq, i will draw the object 2 times which is 20000*2 and if i have four view then it would be 20000*2*4 times.

POSITION pos = m_objects.GetHeadPosition();
while (pos != NULL)
{
CBomObj* pObj = m_objects.GetNext(pos);
pObj->DrawShade(pView,1,shade);
}
everytime when i move the object to new position. I have to wait for the object list to complete the while loop first. So in 4 view case, I would have to wait for 4 while loop and it really take a long time.

In autocad, when i move the object to new position, the object will regenerate from the beginning instead of drawing all the object in this case the mouse pointer will never delay when moving i wonder how autocad do it. Does anyone know the techniq?
i would appreciate for any reply.