最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - How is webgl immediate mode? - Stack Overflow

programmeradmin0浏览0评论

Hey so I'm trying to learn 3d graphics and I've came to understand that immediate mode means to draw graphics straight from when they're called like html canvas and retained mode to be drawing to buffers and calculating before "flushing" or swapping buffers But these last few days I've been learning webgl and Iv discovered that it pletely lacks what this thread What does "immediate mode" mean in OpenGL? defines as immediate mode in opengl, "gl begin()"

So this got me to think that webgl must be retained mode only, but when I was reading the spec, on this page:.0/

In the very first yellow box it says webgl is an immediate mode api? Could someone please explain what I'm getting wrong here?

Hey so I'm trying to learn 3d graphics and I've came to understand that immediate mode means to draw graphics straight from when they're called like html canvas and retained mode to be drawing to buffers and calculating before "flushing" or swapping buffers But these last few days I've been learning webgl and Iv discovered that it pletely lacks what this thread What does "immediate mode" mean in OpenGL? defines as immediate mode in opengl, "gl begin()"

So this got me to think that webgl must be retained mode only, but when I was reading the spec, on this page:http://www.khronos/registry/webgl/specs/latest/1.0/

In the very first yellow box it says webgl is an immediate mode api? Could someone please explain what I'm getting wrong here?

Share Improve this question edited May 23, 2017 at 10:30 CommunityBot 11 silver badge asked Jan 6, 2014 at 23:48 Jim JonesJim Jones 2,7098 gold badges28 silver badges44 bronze badges 3
  • 1 webgl is immediate mode, but lacks some of the (deprecated) functionality of opengl 1 (like the stuff sown in the linked question) retained vs immediate is broader in scope than which opengl functions are available. – user3125280 Commented Jan 6, 2014 at 23:54
  • Thanks, I kind of assumed that but do you think you could explain difference in the way element arrays are rendered on an immediate canvas? – Jim Jones Commented Jan 7, 2014 at 0:33
  • I couldn't, but i can say that "immediate mode" means you are creating arrays,etc and passing them to the api, etc. It is used in this context (i think) to contrast to more abstracted alternatives (since javascript is so sandboxed, people might expect webgl doesn't give graphics programmers the level of control they are used to). Purely immediate mode api would pass array everytime, purely retained would pass it once and make calls some function like DrawThatThingIJustSentYou() – user3125280 Commented Jan 7, 2014 at 0:39
Add a ment  | 

2 Answers 2

Reset to default 10

I think the root of the confusion is the thread you pointed out is using OpenGL-specific concepts of immediate mode versus retained mode.

WebGL is deemed immediate as follows:

Immediate mode API means the application must call all the rendering mands to draw the entire scene for every frame. For example, WebGL and HTML5 Canvas are immediate mode. Retained mode API means the application only describes the scene objects but DOES NOT issue rendering requests. For example, SVG is retained mode.

Have a look at this discussion on SVG (retained mode) versus Canvas (immediate mode):

SVG vs canvas: how to choose

See also:

http://en.wikipedia/wiki/Immediate_mode

http://en.wikipedia/wiki/Retained_mode

You can look at the well pictured description at http://www.craftymind./guimark2/. Basically it es down to "buffer all my state changes, and then draw once" vs, "drawing every call". In this specific case, it has to do with the Javascript model as well.

发布评论

评论列表(0)

  1. 暂无评论
ok 不同模板 switch ($forum['model']) { /*case '0': include _include(APP_PATH . 'view/htm/read.htm'); break;*/ default: include _include(theme_load('read', $fid)); break; } } break; case '10': // 主题外链 / thread external link http_location(htmlspecialchars_decode(trim($thread['description']))); break; case '11': // 单页 / single page $attachlist = array(); $imagelist = array(); $thread['filelist'] = array(); $threadlist = NULL; $thread['files'] > 0 and list($attachlist, $imagelist, $thread['filelist']) = well_attach_find_by_tid($tid); $data = data_read_cache($tid); empty($data) and message(-1, lang('data_malformation')); $tidlist = $forum['threads'] ? page_find_by_fid($fid, $page, $pagesize) : NULL; if ($tidlist) { $tidarr = arrlist_values($tidlist, 'tid'); $threadlist = well_thread_find($tidarr, $pagesize); // 按之前tidlist排序 $threadlist = array2_sort_key($threadlist, $tidlist, 'tid'); } $allowpost = forum_access_user($fid, $gid, 'allowpost'); $allowupdate = forum_access_mod($fid, $gid, 'allowupdate'); $allowdelete = forum_access_mod($fid, $gid, 'allowdelete'); $access = array('allowpost' => $allowpost, 'allowupdate' => $allowupdate, 'allowdelete' => $allowdelete); $header['title'] = $thread['subject']; $header['mobile_link'] = $thread['url']; $header['keywords'] = $thread['keyword'] ? $thread['keyword'] : $thread['subject']; $header['description'] = $thread['description'] ? $thread['description'] : $thread['brief']; $_SESSION['fid'] = $fid; if ($ajax) { empty($conf['api_on']) and message(0, lang('closed')); $apilist['header'] = $header; $apilist['extra'] = $extra; $apilist['access'] = $access; $apilist['thread'] = well_thread_safe_info($thread); $apilist['thread_data'] = $data; $apilist['forum'] = $forum; $apilist['imagelist'] = $imagelist; $apilist['filelist'] = $thread['filelist']; $apilist['threadlist'] = $threadlist; message(0, $apilist); } else { include _include(theme_load('single_page', $fid)); } break; default: message(-1, lang('data_malformation')); break; } ?>