te')); return $arr; } /* 遍历用户所有主题 * @param $uid 用户ID * @param int $page 页数 * @param int $pagesize 每页记录条数 * @param bool $desc 排序方式 TRUE降序 FALSE升序 * @param string $key 返回的数组用那一列的值作为 key * @param array $col 查询哪些列 */ function thread_tid_find_by_uid($uid, $page = 1, $pagesize = 1000, $desc = TRUE, $key = 'tid', $col = array()) { if (empty($uid)) return array(); $orderby = TRUE == $desc ? -1 : 1; $arr = thread_tid__find($cond = array('uid' => $uid), array('tid' => $orderby), $page, $pagesize, $key, $col); return $arr; } // 遍历栏目下tid 支持数组 $fid = array(1,2,3) function thread_tid_find_by_fid($fid, $page = 1, $pagesize = 1000, $desc = TRUE) { if (empty($fid)) return array(); $orderby = TRUE == $desc ? -1 : 1; $arr = thread_tid__find($cond = array('fid' => $fid), array('tid' => $orderby), $page, $pagesize, 'tid', array('tid', 'verify_date')); return $arr; } function thread_tid_delete($tid) { if (empty($tid)) return FALSE; $r = thread_tid__delete(array('tid' => $tid)); return $r; } function thread_tid_count() { $n = thread_tid__count(); return $n; } // 统计用户主题数 大数量下严谨使用非主键统计 function thread_uid_count($uid) { $n = thread_tid__count(array('uid' => $uid)); return $n; } // 统计栏目主题数 大数量下严谨使用非主键统计 function thread_fid_count($fid) { $n = thread_tid__count(array('fid' => $fid)); return $n; } ?>javascript - Some questions about WebGL - Stack Overflow
最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Some questions about WebGL - Stack Overflow

programmeradmin4浏览0评论

I am learning OpenGL 3.3 and working on an small game engine of mine.

But the more I explore it feels like the offline PC games might bee obsolete one day. All the games will be on browser.

I am also very interested in integrating everything in browse as long as it is possible to leverage the same strength as any other non-browser game.

After a little research I found, WebGL, which runs on HTML 5's Canvas.

Now there are several questions,

  1. Does WebGL can leverage the same strength from the PC, as a non-browse product can?

  2. It is fully shader based? or also supports deprecated(i don't know if it is also deprecated in WebGL) fixed function rendering? As I am learning shader based approach, I really don't want to go back to fixed function pipeline.

  3. Or do I have to use other wrapper (Copperlich or GLGE) to get shader support? (though, none of those engines has shader support).

  4. Is JavaScript the only way to interact with WebGL? Is there any way to write WebGL application using C/C++/Java?

  5. Is it possible to integrate other middleware with WebGL? (for example: bullet, phyX). Do I have to write some interface using JS which connects with this native liberary?

  6. Java application can be integrated inside the browser, which have OpenGl interface using JOGL or LWJGL. Then why WebGL, when Java can do that?

  7. Isn't JavaScript slow? Is it really a good choice?

  8. Is it possible to run a engine written using C/C++ using OpenGL, on WebGL context? Is it just about abstracting out the rendering system or is it not possible at all?

  9. Is there any possibiliry for Microsoft to e up with WebX (DirectX) instread of implementing WebGL on IE?

  10. I think the most important part of WebGL is going to be, the default integration with browser. So, you don't have to download a plug-in to play the game, like Unity Player for Unity3d or any other plug-in for a particular game engine. You can still play on any freshly installed browser as long as it supports WebGL. Just open the page and start playing. Isn't that right?

  11. Is there any alternate to WebGL, that can provide "no plugin installation needed" launch?

  12. What are the stability issues? Because the game will be running in the browser, its responsiveness is going to play a crucial role about the stability of the game. Should I bother about it yet? Will the browser be a bottleneck of the game?

  13. What are the (major) things that WebGL don't support that is supported by OpenGL 3.3 or later (I know WebGL is based on OpenGL ES 2.0). As I have said earlier, I am working on my own game engine based on OpenGL 3.3

Rather then yes/no, some explanation or web reference would help.

I am learning OpenGL 3.3 and working on an small game engine of mine.

But the more I explore it feels like the offline PC games might bee obsolete one day. All the games will be on browser.

I am also very interested in integrating everything in browse as long as it is possible to leverage the same strength as any other non-browser game.

After a little research I found, WebGL, which runs on HTML 5's Canvas.

Now there are several questions,

  1. Does WebGL can leverage the same strength from the PC, as a non-browse product can?

  2. It is fully shader based? or also supports deprecated(i don't know if it is also deprecated in WebGL) fixed function rendering? As I am learning shader based approach, I really don't want to go back to fixed function pipeline.

  3. Or do I have to use other wrapper (Copperlich or GLGE) to get shader support? (though, none of those engines has shader support).

  4. Is JavaScript the only way to interact with WebGL? Is there any way to write WebGL application using C/C++/Java?

  5. Is it possible to integrate other middleware with WebGL? (for example: bullet, phyX). Do I have to write some interface using JS which connects with this native liberary?

  6. Java application can be integrated inside the browser, which have OpenGl interface using JOGL or LWJGL. Then why WebGL, when Java can do that?

  7. Isn't JavaScript slow? Is it really a good choice?

  8. Is it possible to run a engine written using C/C++ using OpenGL, on WebGL context? Is it just about abstracting out the rendering system or is it not possible at all?

  9. Is there any possibiliry for Microsoft to e up with WebX (DirectX) instread of implementing WebGL on IE?

  10. I think the most important part of WebGL is going to be, the default integration with browser. So, you don't have to download a plug-in to play the game, like Unity Player for Unity3d or any other plug-in for a particular game engine. You can still play on any freshly installed browser as long as it supports WebGL. Just open the page and start playing. Isn't that right?

  11. Is there any alternate to WebGL, that can provide "no plugin installation needed" launch?

  12. What are the stability issues? Because the game will be running in the browser, its responsiveness is going to play a crucial role about the stability of the game. Should I bother about it yet? Will the browser be a bottleneck of the game?

  13. What are the (major) things that WebGL don't support that is supported by OpenGL 3.3 or later (I know WebGL is based on OpenGL ES 2.0). As I have said earlier, I am working on my own game engine based on OpenGL 3.3

Rather then yes/no, some explanation or web reference would help.

Share Improve this question edited Oct 8, 2015 at 17:22 genpfault 52.1k12 gold badges91 silver badges148 bronze badges asked Jul 2, 2011 at 7:44 Quazi IrfanQuazi Irfan 2,5895 gold badges35 silver badges72 bronze badges 0
Add a ment  | 

3 Answers 3

Reset to default 9

But the more I explore it feels like the offline pc games might bee obsolute one day. All the games will be on browser.

And if that happens 15 years from now, WebGL or some similar technology will still be there. No need to rush.

After a little research I found, WebGL, which runs on HTML 5's Canvas.

Unless of course the person is running Internet Explorer.

Your questions:

1: What do you mean by "same strengths?"

2: WebGL is a JavaScript implementation of OpenGL ES 2.0. So yes.

3: See #2.

4: WebGL is a JavaScript implementation of OpenGL ES 2.0. So it's JavaScript only ;)

5: WebGL is a JavaScript implementation of OpenGL ES 2.0. Bullet and such are piled libraries. Unless you start getting into some browser add-ons, the only libraries you can use are what es with the browser and whatever JavaScript tech you want to use.

Note: I'm not certain that JavaScript can directly interact with browser add-ons. If it can, it would be via a browser-specific API. So it may not be possible at all.

6: Because Java requires installing the Java runtime, which is effectively an add-on. JavaScript has more direct access to the browser. You can interface with an HTML's DOM, server-side munication via JSON or other mechanisms and the like.

7: Define "slow." Most browsers use some form of JIT, so it will run "reasonably fast." Will it have the performance that native code might have? No. But then again, are you making a game that will need that performance?

8: Say it with me now: WebGL is a JavaScript implementation of OpenGL ES 2.0. So no interfacing with C/C++ code that isn't part of the browser ;)

9: They're planning to expose 3D rendering via Silverlight soon. Silverlight is of course an add-on.

10: Yes.

11: No. Nothing even remotely cross-platform.

12: That's browser and driver dependent. WebGL implementations are still young, so they may still have some maturation to do.

13: This is a plex question. You may be aware of this, but, WebGL is a JavaScript implementation of OpenGL ES 2.0 ;) This means it supports what ES 2.0 does, along with whatever extensions that the implementation exposes. Unlike regular desktop or mobile OpenGL implementations, the implementation here has two parts: the browser itself and the hardware driver.

Google's implementation of WebGL translates WebGL's OpenGL ES 2.0 calls into Direct3D calls on Windows desktop machines. This allows them a bit of stability (since OpenGL drivers, particularly on Linux machines, are flaky). The cost is that Google now decides what extensions to support. Firefox's WebGL implementation goes straight to desktop OpenGL or the underlying OpenGL ES 2.0 for mobile devices. This allows the underlying implementation to expose extensions to WebGL.

The base ES 2.0, which is all WebGL guarantees, is approximately equivalent to desktop OpenGL 2.0. So nothing from desktop GL 3.x. There are many OpenGL ES extensions that provide access to more features, but the totality of them don't add up to desktop GL 3.x-level functionality yet.

Ultimately, WebGL is not meant for "hardcore games". It might certainly be able to implement some, but it's primary purpose is to allow drawing 3D graphics. Blistering speed and high-end physics are not what it's about.

  1. Does WebGL can leverage the same strength from the PC, as a non-browse product can?

No, native apps have access to the latest GPU features. WebGL apps do not.

  1. It is fully shader based? or also supports deprecated(i don't know if it is also deprecated in WebGL) fixed function rendering? As I am learning shader based approach, I really don't want to go back to fixed function pipeline.

There is no fixed function anything in WebGL. It's based on OpenGL ES 2.0 which is 100% shader based

  1. Or do I have to use other wrapper (Copperlich or GLGE) to get shader support? (though, none of those engines has shader support).

No

  1. Is JavaScript the only way to interact with WebGL? Is there any way to write WebGL application using C/C++/Java?

You can use Emscripten to pile C/C++ to asm.js/WebAssembly. This is what Unity3D and Unreal do to support games in the browser.

  1. Is it possible to integrate other middleware with WebGL? (for example: bullet, phyX). Do I have to write some interface using JS which connects with this native liberary?

Using emscripten, yes you can use C/C++ libraries

  1. Java application can be integrated inside the browser, which have OpenGl interface using JOGL or LWJGL. Then why WebGL, when Java can do that?

Java has been deprecated in the browser. It's unsafe as a plugin and has been removed from most browsers.

  1. Isn't JavaScript slow? Is it really a good choice?

Asm.js/WebAssembly has been shown to be about 70% as fast as native (which is faster than Java or C#'s average) At the same time some browser features add a certain amount of overhead that a native app might not have. One example, the <canvas> element is always posited with the page meaning there's at least 1 extra fullscreen/full-browser-window draw call.

  1. Is it possible to run a engine written using C/C++ using OpenGL, on WebGL context? Is it just about abstracting out the rendering system or is it not possible at all?

Yes, again see emscripten

  1. Is there any possibiliry for Microsoft to e up with WebX (DirectX) instread of implementing WebGL on IE?

It's certainly possible. No one can predict the future. Microsoft has already implemented WebGL in IE11 and Edge though.

  1. I think the most important part of WebGL is going to be, the default integration with browser. So, you don't have to download a plug-in to play the game, like Unity Player for Unity3d or any other plug-in for a particular game engine. You can still play on any freshly installed browser as long as it supports WebGL. Just open the page and start playing. Isn't that right?

Questions that ask for opinions are discouraged on Stack Overflow.

  1. Is there any alternate to WebGL, that can provide "no plugin installation needed" launch?

Not currently

  1. What are the stability issues? Because the game will be running in the browser, its responsiveness is going to play a crucial role about the stability of the game. Should I bother about it yet? Will the browser be a bottleneck of the game?

There's no way to know this except to test. Chrome and Firefox are both updated every 6 weeks. Edge and Safari are also updated a few times a year. Their behavior changes with each release. Usually for the better.

  1. What are the (major) things that WebGL don't support that is supported by OpenGL 3.3 or later (I know WebGL is based on OpenGL ES 2.0). As I have said earlier, I am working on my own game engine based on OpenGL 3.3

That list is too long to research.

JavaScript's speed is parable to Java nowadays.

Browser plug-ins are being phased out. For some things, data can be municated in and out with e.g. WebSockets or WebRTC.

For libraries like Bullet that don't need to interact with things outside the browser, there's Emscripten that piles C++ to asm.js. It's even possible to pile a full C++ application to JavaScript, in fact it's what UE4 and Unity do. For big games/applications with lots of data I don't remend that just yet, because it has memory limitations on 32 bit browsers.

By default, all major browsers translate WebGL calls to Direct3D on Windows (including Firefox), so it's fairly stable.

Baseline WebGL is parable to OpenGL 2.0 but there are extensions to bring WebGL 2.0 (OpenGL ES 3.x) features, such as WEBGL_draw_buffers (currently with >55% of global support).

发布评论

评论列表(0)

  1. 暂无评论