几何尺寸与公差论坛------致力于产品几何量公差标准GD&T (GDT:ASME)|New GPS(ISO)研究/CAD设计/CAM加工/CMM测量  


返回   几何尺寸与公差论坛------致力于产品几何量公差标准GD&T (GDT:ASME)|New GPS(ISO)研究/CAD设计/CAM加工/CMM测量 » 仿射空间:CAX软件开发(三)二次开发与程序设计 » CAD二次开发 » AutoCAD二次开发 » DirectDWG
用户名
密码
注册 帮助 会员 日历 银行 搜索 今日新帖 标记论坛为已读


 
 
主题工具 搜索本主题 显示模式
旧 2009-05-06, 09:26 PM   #1
yang686526
高级会员
 
注册日期: 06-11
帖子: 14579
精华: 1
现金: 224494 标准币
资产: 234494 标准币
yang686526 向着好的方向发展
默认 【转帖】opengl and background transpapency

opengl and background transpapency...
opengl and background transparency...
does anybody know how to draw with opengl and not paint the background first. i have tried a few of the suggestions that i searched for in the forum (like the "clearscreen" and "doublebuffering" properties), to no avail. were are drawing multiple charts and chart formats on top of each other.
attached is my attempt to get this working in our environment. perhaps you could show me the error in my ways.
thank you in advance,
nuzzi
attached files

quote:
originally posted by nuzzi
does anybody know how to draw with opengl and not paint the background first. i have tried a few of the suggestions that i searched for in the forum (like the "clearscreen" and "doublebuffering" properties), to no avail. were are drawing multiple charts and chart formats on top of each other.
attached is my attempt to get this working in our environment. perhaps you could show me the error in my ways.
thank you in advance,
nuzzi
besides that opengl-questions might be better placed in some other news groups ...
opengl doesn't know a concept called background. if you wan't to clear the screenbuffer in opengl there is the glclear -function which takes the buffers to be emptied (like gl_color_buffer_bit or gl_depth_buffer_bit)
if you want to draw things on top of each other in 2d (like windows or charts) you need to turn off depth buffering and draw them in the correct order (topmost window last). if i didn't understand your question feel free to give me some more hints.
hth
psy
thanks for the reply...
sorry...re-reading my question, i realize it was pretty unclear. i am using opengl as the .gs for the opendesign libraries.
nuzzi
quote:
originally posted by nuzzi
does anybody know how to draw with opengl and not paint the background first. i have tried a few of the suggestions that i searched for in the forum (like the "clearscreen" and "doublebuffering" properties), to no avail. were are drawing multiple charts and chart formats on top of each other.
attached is my attempt to get this working in our environment. perhaps you could show me the error in my ways.
thank you in advance,
nuzzi
as a strange aside. if i change the .gs to wingdi it works beautifully, but we are using opengl. what we would really like to do is have the gl drawing calls be made on a thread we create in our drawing engine, without the device needed.
nuzzi
has anybody used opengl and opendesign libraries to draw multiple charts on top of each other with transparency?
thank you,
nuzzi
ok, another approach...
since i haven't found a way to make the opengl gs device draw transparently, i figure i will draw to an offscreen bitmap and do the transparency myself. the following code throws and assert for setpixelformat in the exgsopenglvectorizedevice.
void __stdcall c_od_dwg::mapdraw( idc2* dc )
{
rect r;
dc->getscrrect( &r );
pt2d_t mc;
dc->getmapcenter( &mc );
if (( srect.left != r.left ) || ( srect.right != r.right ) || ( srect.top != r.top ) || ( srect.bottom != r.bottom ))
reset_device( dc );
if ( p_db.isnull() || ( srect.left == srect.right ) || ( srect.top == srect.bottom )) return;
odgsinitialize();
odgsview* pview = p_dev->viewat(0);
// return a pointer to the dictionary entity containing the device properties
odrxdictionaryptr p_props = p_dev->properties();
// set the dc handle for this gsdevice
//hbitmap hmsk = createcompatiblebitmap( dc->gethandle(), srect.right, srect.top );
hdc hdcbuf = createcompatibledc( dc->gethandle());
hbitmap hbmp;// = createcompatiblebitmap( dc->gethandle(), srect.right, srect.top );
bitmapinfo bmi;
bmi.bmiheader.bisize = sizeof(bitmapinfoheader);
bmi.bmiheader.biwidth = srect.right;
bmi.bmiheader.biheight = -srect.bottom; // negative indicates a top-down image
bmi.bmiheader.biplanes = 1;
bmi.bmiheader.bibitcount = 32;
bmi.bmiheader.bicompression = bi_rgb;
bmi.bmiheader.bisizeimage = (((( 32 * srect.right ) + 31 ) & ~31 ) >> 3 ) * srect.bottom;
bmi.bmiheader.bixpelspermeter = 0;
bmi.bmiheader.biypelspermeter = 0;
bmi.bmiheader.biclrused = 0;
bmi.bmiheader.biclrimportant = 0;
hbmp = createdibsection(null, &bmi, dib_rgb_colors, 0, 0, 0l);
selectobject(hdcbuf, hbmp);
if( p_props->has( "windowhdc" )) p_props->putat( "windowhdc", odrxvariantvalue(( long )hdcbuf ));
odgepoint3d targ = pview->target();
odgepoint3d dir = pview->position();
odgevector3d dir_targ = dir - targ;
odgevector3d up = odgevector3d( sin( dc->getrotation()), cos( dc->getrotation()), 0.0 ); //pview->upvector();
targ.x = mc.x;
targ.y = mc.y;
pview->setview(targ + dir_targ, targ, up, dc->getscale() * abs( srect.right - srect.left ), dc->getscale() * abs( srect.bottom - srect.top ));
p_dev->update();
odgsuninitialize();
bitblt( dc->gethandle(), 0, 0, srect.right, srect.bottom, hdcbuf, 0, 0, srccopy );
deletedc(hdcbuf);
deleteobject(hbmp);
}
any ideas what might be wrong here?
thanks again...
yang686526离线中   回复时引用此帖
GDT自动化论坛(仅游客可见)
 


主题工具 搜索本主题
搜索本主题:

高级搜索
显示模式

发帖规则
不可以发表新主题
不可以回复主题
不可以上传附件
不可以编辑您的帖子

vB 代码开启
[IMG]代码开启
HTML代码关闭

相似的主题
主题 主题发起者 论坛 回复 最后发表
【转帖】mtext background mask fill color bug yang686526 DirectDWG 0 2009-05-06 06:10 PM
【转帖】how to resize paper background yang686526 DirectDWG 0 2009-05-06 03:08 PM
【转帖】dwf background color yang686526 DirectDWG 0 2009-05-04 08:15 PM
【转帖】display drawing without background yang686526 DirectDWG 0 2009-05-04 07:50 PM
【转帖】changing paper space background color yang686526 DirectDWG 0 2009-05-04 05:44 PM


所有的时间均为北京时间。 现在的时间是 01:16 AM.


于2004年创办,几何尺寸与公差论坛"致力于产品几何量公差标准GD&T | GPS研究/CAD设计/CAM加工/CMM测量"。免责声明:论坛严禁发布色情反动言论及有关违反国家法律法规内容!情节严重者提供其IP,并配合相关部门进行严厉查处,若內容有涉及侵权,请立即联系我们QQ:44671734。注:此论坛须管理员验证方可发帖。
沪ICP备06057009号-2
更多