﻿<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"><channel><title>C++博客-力为的技术博客-随笔分类-2. Graphics</title><link>http://www.cppblog.com/mythma/category/10330.html</link><description /><language>zh-cn</language><lastBuildDate>Wed, 30 Sep 2015 01:35:51 GMT</lastBuildDate><pubDate>Wed, 30 Sep 2015 01:35:51 GMT</pubDate><ttl>60</ttl><item><title>在MFC中使用快速三维建模控件</title><link>http://www.cppblog.com/mythma/archive/2015/09/28/mfc-graphics-control.html</link><dc:creator>力为</dc:creator><author>力为</author><pubDate>Mon, 28 Sep 2015 08:35:00 GMT</pubDate><guid>http://www.cppblog.com/mythma/archive/2015/09/28/mfc-graphics-control.html</guid><wfw:comment>http://www.cppblog.com/mythma/comments/211910.html</wfw:comment><comments>http://www.cppblog.com/mythma/archive/2015/09/28/mfc-graphics-control.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/mythma/comments/commentRss/211910.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/mythma/services/trackbacks/211910.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: &nbsp;&nbsp;<a href='http://www.cppblog.com/mythma/archive/2015/09/28/mfc-graphics-control.html'>阅读全文</a><img src ="http://www.cppblog.com/mythma/aggbug/211910.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/mythma/" target="_blank">力为</a> 2015-09-28 16:35 <a href="http://www.cppblog.com/mythma/archive/2015/09/28/mfc-graphics-control.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>2015武汉校园招聘归来</title><link>http://www.cppblog.com/mythma/archive/2015/09/28/new_hire_wuhan_2015.html</link><dc:creator>力为</dc:creator><author>力为</author><pubDate>Mon, 28 Sep 2015 08:32:00 GMT</pubDate><guid>http://www.cppblog.com/mythma/archive/2015/09/28/new_hire_wuhan_2015.html</guid><wfw:comment>http://www.cppblog.com/mythma/comments/211909.html</wfw:comment><comments>http://www.cppblog.com/mythma/archive/2015/09/28/new_hire_wuhan_2015.html#Feedback</comments><slash:comments>4</slash:comments><wfw:commentRss>http://www.cppblog.com/mythma/comments/commentRss/211909.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/mythma/services/trackbacks/211909.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: 结束了在武汉四天的校招行程。第一天判笔试题到晚上十二点，接着连续技术面试两天半。校招不仅仅是脑力上考验，也是体力上的考验。但相比去年在成都的招聘行程，今年感觉轻松许多，从而也有精力写写这几天的感想。&nbsp;&nbsp;<a href='http://www.cppblog.com/mythma/archive/2015/09/28/new_hire_wuhan_2015.html'>阅读全文</a><img src ="http://www.cppblog.com/mythma/aggbug/211909.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/mythma/" target="_blank">力为</a> 2015-09-28 16:32 <a href="http://www.cppblog.com/mythma/archive/2015/09/28/new_hire_wuhan_2015.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>引发glDrawElements产生GL_INVALID_OPERATION错误一例</title><link>http://www.cppblog.com/mythma/archive/2014/08/28/glDrawElements-GL_INVALID_OPERATION.html</link><dc:creator>力为</dc:creator><author>力为</author><pubDate>Thu, 28 Aug 2014 08:55:00 GMT</pubDate><guid>http://www.cppblog.com/mythma/archive/2014/08/28/glDrawElements-GL_INVALID_OPERATION.html</guid><wfw:comment>http://www.cppblog.com/mythma/comments/208164.html</wfw:comment><comments>http://www.cppblog.com/mythma/archive/2014/08/28/glDrawElements-GL_INVALID_OPERATION.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/mythma/comments/commentRss/208164.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/mythma/services/trackbacks/208164.html</trackback:ping><description><![CDATA[<div>GL_INVALID_OPERATION是OpenGL一个很诡异的错误代码，不知道到底是什么引起的无效操作。<br />即使在调用glDrawElements和glDrawArrays的时候有机会遇到，也不容易确定到底是哪个状态出错。<br /><br />这里有一种情况可以间接的触发这个错误，并且会产生蝴蝶效应，让程序在后续的执行中产生更诡异不容易定位的错误。<br /><br /><br /><div style="background-color:#eeeeee;font-size:13px;border:1px solid #CCCCCC;padding-right: 5px;padding-bottom: 4px;padding-left: 4px;padding-top: 4px;width: 98%;word-break:break-all"><!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />http://www.CodeHighlighter.com/<br /><br />-->texture&nbsp;+&nbsp;shader&nbsp;+&nbsp;glDrawElements/glDrawArrays</div><br />即在shader中使用texture绘制物体。<br /><br />如果为shader中sampler设置的location位置与glActiveTexture不一致，就会触发glDrawElements操作失败。<br /><br />另外，如果shader中定义了并使用了多个sampler，即使在某种条件下没有用到，也需要给他设置个值。</div><img src ="http://www.cppblog.com/mythma/aggbug/208164.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/mythma/" target="_blank">力为</a> 2014-08-28 16:55 <a href="http://www.cppblog.com/mythma/archive/2014/08/28/glDrawElements-GL_INVALID_OPERATION.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Shadow Mapping via OpenGL （固定管线篇）</title><link>http://www.cppblog.com/mythma/archive/2013/12/13/Shadow-Mapping-via-OpenGL.html</link><dc:creator>力为</dc:creator><author>力为</author><pubDate>Fri, 13 Dec 2013 09:34:00 GMT</pubDate><guid>http://www.cppblog.com/mythma/archive/2013/12/13/Shadow-Mapping-via-OpenGL.html</guid><wfw:comment>http://www.cppblog.com/mythma/comments/204781.html</wfw:comment><comments>http://www.cppblog.com/mythma/archive/2013/12/13/Shadow-Mapping-via-OpenGL.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/mythma/comments/commentRss/204781.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/mythma/services/trackbacks/204781.html</trackback:ping><description><![CDATA[基本原理：<a href="http://en.wikipedia.org/wiki/Shadow_mapping">http://en.wikipedia.org/wiki/Shadow_mapping</a><br /><br />在大家都在用shader实现的时候，我竟然还在用固定管线。<br /><br />使用OpenGL固定管线实现，主要用到 GL_ARB_depth_texture和GL_ARB_shadow，GL_ARB_shadow_ambient扩展。整个过程分三步:<br />1. 计算shadow mapping<br />2. 绘制阴暗的部分<br />3. 绘制光亮的部分<br /><br />每一步都可能是坑。<br />以下是可能出现的&#8220;效果&#8221;：<br /><br /><ul><li>斑点</li></ul><img src="http://www.cppblog.com/images/cppblog_com/mythma/20131128113604.jpg" border="0" alt="" width="453" height="511" /><br /><ul><li>Peter Pan</li></ul><br /><img src="http://www.cppblog.com/images/cppblog_com/mythma/20131213165344.png" border="0" alt="" width="330" height="453" /><br /><ul><li>锯齿</li></ul><br /><img src="http://www.cppblog.com/images/cppblog_com/mythma/20131213170037.png" border="0" alt="" width="549" height="465" /><br /><br /><ul><li>大块阴影</li></ul><br /><img src="http://www.cppblog.com/images/cppblog_com/mythma/20131227095709.png" border="0" alt="" width="548" height="295" /><br /><br /><ul><li>模糊的阴影</li></ul><img src="http://www.cppblog.com/images/cppblog_com/mythma/sss.png" border="0" alt="" width="319" height="260" /><br /><br /><img src ="http://www.cppblog.com/mythma/aggbug/204781.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/mythma/" target="_blank">力为</a> 2013-12-13 17:34 <a href="http://www.cppblog.com/mythma/archive/2013/12/13/Shadow-Mapping-via-OpenGL.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>glUniformXXX第2个参数</title><link>http://www.cppblog.com/mythma/archive/2013/09/09/glUniform.html</link><dc:creator>力为</dc:creator><author>力为</author><pubDate>Mon, 09 Sep 2013 02:21:00 GMT</pubDate><guid>http://www.cppblog.com/mythma/archive/2013/09/09/glUniform.html</guid><wfw:comment>http://www.cppblog.com/mythma/comments/203100.html</wfw:comment><comments>http://www.cppblog.com/mythma/archive/2013/09/09/glUniform.html#Feedback</comments><slash:comments>2</slash:comments><wfw:commentRss>http://www.cppblog.com/mythma/comments/commentRss/203100.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/mythma/services/trackbacks/203100.html</trackback:ping><description><![CDATA[<div>glUniform4fv(loc, 4, GL_FALSE, vec4.ptr());<br />第二个参数写成4，在A卡上<span style="color: red;">能</span>正常运行，而在N和I上却<span style="color: red;">不能</span>正常解析。</div><img src ="http://www.cppblog.com/mythma/aggbug/203100.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/mythma/" target="_blank">力为</a> 2013-09-09 10:21 <a href="http://www.cppblog.com/mythma/archive/2013/09/09/glUniform.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>VTK6.0初始化</title><link>http://www.cppblog.com/mythma/archive/2013/08/02/VTK-6-New-NULL.html</link><dc:creator>力为</dc:creator><author>力为</author><pubDate>Fri, 02 Aug 2013 05:56:00 GMT</pubDate><guid>http://www.cppblog.com/mythma/archive/2013/08/02/VTK-6-New-NULL.html</guid><wfw:comment>http://www.cppblog.com/mythma/comments/202302.html</wfw:comment><comments>http://www.cppblog.com/mythma/archive/2013/08/02/VTK-6-New-NULL.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/mythma/comments/commentRss/202302.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/mythma/services/trackbacks/202302.html</trackback:ping><description><![CDATA[<br />在使用VTK6.0时候，会遇到X::New()返回为null的情况，需要全局初始化一下：<br /><br /><div style="background-color:#eeeeee;font-size:13px;border:1px solid #CCCCCC;padding-right: 5px;padding-bottom: 4px;padding-left: 4px;padding-top: 4px;width: 98%;word-break:break-all"><!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />http://www.CodeHighlighter.com/<br /><br />-->&nbsp;<span style="color: #0000FF; ">#define</span>&nbsp;vtkRenderingCore_AUTOINIT&nbsp;4(vtkInteractionStyle,vtkRenderingFreeType,vtkRenderingFreeTypeOpenGL,vtkRenderingOpenGL)<br />&nbsp;<span style="color: #0000FF; ">#define</span>&nbsp;vtkRenderingVolume_AUTOINIT&nbsp;1(vtkRenderingVolumeOpenGL)</div><img src ="http://www.cppblog.com/mythma/aggbug/202302.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/mythma/" target="_blank">力为</a> 2013-08-02 13:56 <a href="http://www.cppblog.com/mythma/archive/2013/08/02/VTK-6-New-NULL.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>wxWidgets2.9x + VTK6.0 示例 </title><link>http://www.cppblog.com/mythma/archive/2012/12/28/wxWidgets_vtk_wxvtk.html</link><dc:creator>力为</dc:creator><author>力为</author><pubDate>Fri, 28 Dec 2012 06:58:00 GMT</pubDate><guid>http://www.cppblog.com/mythma/archive/2012/12/28/wxWidgets_vtk_wxvtk.html</guid><wfw:comment>http://www.cppblog.com/mythma/comments/196745.html</wfw:comment><comments>http://www.cppblog.com/mythma/archive/2012/12/28/wxWidgets_vtk_wxvtk.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/mythma/comments/commentRss/196745.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/mythma/services/trackbacks/196745.html</trackback:ping><description><![CDATA[<br /><h2><strong>vtk6.0</strong></h2>相比vtk5.x，vtk6.0的一个很大的变化就是新的build system。若配置不正确，就会出现有的类（如vtkPolyDataMapper）调用New返回NULL的状况。<br /><div>在<a href="http://vtk.org/Wiki/VTK/Build_System_Migration">VTK/Build System Migration</a>一文中对整个过程的来龙去脉做了详细的说明。<br /><br />另外，vtk6.0更改一些常用的函数签名：如xx::SetInput, yy::GetOutput。举例说明：<br /><div style="background-color:#eeeeee;font-size:13px;border:1px solid #CCCCCC;padding-right: 5px;padding-bottom: 4px;padding-left: 4px;padding-top: 4px;width: 98%;word-break:break-all"><!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />http://www.CodeHighlighter.com/<br /><br />-->&nbsp;<span style="color: #008000; ">//</span><span style="color: #008000; ">&nbsp;VTK5.x</span><span style="color: #008000; "><br /></span>&nbsp;&nbsp;pConeMapper-&gt;SetInput(pConeSource-&gt;GetOutput());<br />&nbsp;&nbsp;pConeActor-&gt;SetMapper(pConeMapper);</div><br /><div style="background-color:#eeeeee;font-size:13px;border:1px solid #CCCCCC;padding-right: 5px;padding-bottom: 4px;padding-left: 4px;padding-top: 4px;width: 98%;word-break:break-all"><!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />http://www.CodeHighlighter.com/<br /><br />-->&nbsp;&nbsp;<span style="color: #008000; ">//</span><span style="color: #008000; ">VTK6</span><span style="color: #008000; "><br /></span>&nbsp;&nbsp;pConeMapper-&gt;SetInputConnection(pConeSource-&gt;GetOutputPort());<br />&nbsp;&nbsp;pConeActor-&gt;SetMapper(pConeMapper);</div><div><br /><h2>在wxWidgets中使用vtk</h2>前人已经写了个<a href="http://wxvtk.sourceforge.net/">wxvtk</a>，拿来用即可。但在vtk6.0下有些问题，需要做些修改。这里是我的<a href="http://www.cppblog.com/Files/mythma/WXVTK.7z">修改版本</a>。</div></div><img src ="http://www.cppblog.com/mythma/aggbug/196745.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/mythma/" target="_blank">力为</a> 2012-12-28 14:58 <a href="http://www.cppblog.com/mythma/archive/2012/12/28/wxWidgets_vtk_wxvtk.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>解决XP花屏View</title><link>http://www.cppblog.com/mythma/archive/2012/11/05/194629.html</link><dc:creator>力为</dc:creator><author>力为</author><pubDate>Mon, 05 Nov 2012 12:25:00 GMT</pubDate><guid>http://www.cppblog.com/mythma/archive/2012/11/05/194629.html</guid><wfw:comment>http://www.cppblog.com/mythma/comments/194629.html</wfw:comment><comments>http://www.cppblog.com/mythma/archive/2012/11/05/194629.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/mythma/comments/commentRss/194629.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/mythma/services/trackbacks/194629.html</trackback:ping><description><![CDATA[在xp下，MFC+OpenGL有时候会出现花屏的现象，在Win7下却运行良好。XP下的花屏&#8220;效果&#8221;如下图所示：<br /><img src="http://www.cppblog.com/images/cppblog_com/mythma/huaping.jpg" border="0" alt="" width="810" height="440" /><br /><br />虽然关掉弹出的对话，能正常显示，但对用户来说却不友好。<br /><br />原因：<br />在Win7下，当拖动顶层的对话框时候，不会调用View刷新视图。而在Xp下，却调用了View的EraseBackground消息，却没有调用WM_PAINT消息。<br />而一般OpenGL的程序，都会响应EraseBK消息，直接返回为True。<br /><br />解决办法：<br />检查是否为XP，若是则在EraseBk响应函数里面重绘视图。当然能够避免XP在这种情况下调用EraseBk消息最好。<br /><img src="http://www.cppblog.com/images/cppblog_com/mythma/2.jpg" border="0" alt="" width="522" height="473" /><img src="http://www.cppblog.com/images/cppblog_com/mythma/1.jpg" border="0" alt="" width="545" height="380" /><img src ="http://www.cppblog.com/mythma/aggbug/194629.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/mythma/" target="_blank">力为</a> 2012-11-05 20:25 <a href="http://www.cppblog.com/mythma/archive/2012/11/05/194629.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>我的原创技术随笔大全（2000~2009）</title><link>http://www.cppblog.com/mythma/archive/2010/01/09/105218.html</link><dc:creator>力为</dc:creator><author>力为</author><pubDate>Fri, 08 Jan 2010 17:13:00 GMT</pubDate><guid>http://www.cppblog.com/mythma/archive/2010/01/09/105218.html</guid><wfw:comment>http://www.cppblog.com/mythma/comments/105218.html</wfw:comment><comments>http://www.cppblog.com/mythma/archive/2010/01/09/105218.html#Feedback</comments><slash:comments>4</slash:comments><wfw:commentRss>http://www.cppblog.com/mythma/comments/commentRss/105218.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/mythma/services/trackbacks/105218.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要:   二十一世纪的第一个十年过去了，回顾了一下这些年写的博客，发现自己也没闲着。但不免也有些遗憾，内容大都是关于知识、经验和技术，而关于思考和idea的却比较少。期待下一个十年吧！<br>    第一篇日志是在2004年发布在CSDN的博客上（记得开始不叫博客），截至到现在累积了不少东西了。为了怀念这过去的十年（2000~2003是个空白期，那段时间国内好像也没博客，网络也不发达，信息也闭塞），特整理了一下，称作我的原创技术随笔大全（2000~2009）&nbsp;&nbsp;<a href='http://www.cppblog.com/mythma/archive/2010/01/09/105218.html'>阅读全文</a><img src ="http://www.cppblog.com/mythma/aggbug/105218.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/mythma/" target="_blank">力为</a> 2010-01-09 01:13 <a href="http://www.cppblog.com/mythma/archive/2010/01/09/105218.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>O3D - 又一套基于Web的3D API</title><link>http://www.cppblog.com/mythma/archive/2009/04/23/80843.html</link><dc:creator>力为</dc:creator><author>力为</author><pubDate>Thu, 23 Apr 2009 05:36:00 GMT</pubDate><guid>http://www.cppblog.com/mythma/archive/2009/04/23/80843.html</guid><wfw:comment>http://www.cppblog.com/mythma/comments/80843.html</wfw:comment><comments>http://www.cppblog.com/mythma/archive/2009/04/23/80843.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/mythma/comments/commentRss/80843.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/mythma/services/trackbacks/80843.html</trackback:ping><description><![CDATA[<p><br>如今，在Web上呈现3D我们有多种选择：VRML, X3D, 3DMLW, Canvas 3D, Java 3D, Shockwave, Flash, Silverlight.&#8230;&#8230; <br><br>而在GOOGLE的&#8220;掺和&#8221;下，现在我们还可以选择一套新的API&nbsp;—— <a href="http://code.google.com/apis/o3d/">O3D<br></a>O3D重要的一点是开源的。<br><br>O3D底层C++，上层JavaScript，再结合Google Chrome, Gadget, Gears, Skechup，一夜间，Web 3D成为Google的天下。<br>作为程序员的我们还等啥？赶紧学吧！<br><br>PS：转发O3D的几张图：<br><br>O3D架构图：<br><br><img border=0 alt="" src="http://code.google.com/apis/o3d/images/O3DSoftwareStack.png" width=418 height=609><br>Demo：</p>
<img border=0 alt="" src="http://code.google.com/apis/o3d/images/beachdemotiny.gif" width=125 height=90><img border=0 alt="" src="http://code.google.com/apis/o3d/images/trendstiny.gif" width=128 height=90><img border=0 alt="" src="http://code.google.com/apis/o3d/images/fantasyindextiny.gif" width=125 height=90> 
<img src ="http://www.cppblog.com/mythma/aggbug/80843.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/mythma/" target="_blank">力为</a> 2009-04-23 13:36 <a href="http://www.cppblog.com/mythma/archive/2009/04/23/80843.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>