Some questions about WebGL

I am learning OpenGL 3.3 and working on a small game engine.

But the more I study, the better that stand-alone computer games can become obsolete one day. All games will be in the browser.

I am also very interested in integrating everything into the viewing, if you can use the same power as any other non-browser game.

After a little research I found, WebGL, which runs on HTML 5 canvas.

Now there are a few questions

  • Can WebGL use the same power from a PC, because a product without viewing can?

  • Is it completely shader based? or also supports legacy (I don't know if it is also deprecated in WebGL) rendering a fixed function? Since I'm exploring a shader-based approach, I really don't want to go back to the pipeline with a fixed function.

  • Or do I need to use another shell (Copperlich or GLGE) to get shader support? (although none of these engines support a shader).

  • Is JavaScript the only way to interact with WebGL? Is there a way to write a WebGL application using C / C ++ / Java?

  • Is it possible to integrate other middleware using WebGL? (e.g. bullet, phyX). Should I write some kind of interface using JS that connects to this native libary?

  • A Java application can be embedded in a browser that has an OpenGl interface using JOGL or LWJGL. Then why WebGL when Java can do this?

  • Does JavaScript work slower? Is this a really good choice?

  • Is it possible to run an engine written using C / C ++ using OpenGL in the context of WebGL? Is it just abstraction of the rendering system or is it impossible at all?

  • Is it possible for Microsoft to come up with WebX (DirectX) to implement WebGL in IE?

  • I think the most important part of WebGL will be the default integration with the browser. Thus, you do not need to download a plugin for a game, for example, Unity Player for Unity3d or any other plugin for a specific game engine. You can still play in any recently installed browser if it supports WebGL. Just open the page and start playing. Is that not so?

  • Is there an alternative to WebGL that can provide launch without installing a plugin?

  • What are the stability issues? Since the game will run in a browser, its responsiveness will play a crucial role in the stability of the game. Should I still worry about this? Will the browser be a bottleneck in the game?

  • What are the (main) things that WebGL does not support, which are supported by OpenGL 3.3 or later (I know that WebGL is based on OpenGL ES 2.0). As I said earlier, I am working on my own engine based on OpenGL 3.3.

Instead, yes / no, some explanation or web link will help.

+7
source share
3 answers

But the more I study, the better that offline games computer games can become olfactory one day. All games will be in the browser.

And if this happens in 15 years, WebGL or some similar technology will still be there. No need to hurry.

After a little research I found, WebGL, which runs on HTML 5 canvas.

Unless, of course, a person has Internet Explorer.

Your questions:

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

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

3: See No. 2.

4: WebGL is an implementation of JavaScript OpenGL ES 2.0. So this is just JavaScript;)

5: WebGL is an implementation of JavaScript OpenGL ES 2.0. Bullet and such compiled libraries. If you don't go into some browser add-ons, the only libraries you can use are what comes with the browser and any JavaScript technologies you want to use.

Note. I'm not sure if JavaScript can interact directly with browser add-ons. If possible, it will be through a browser-specific API. So this may not be possible at all.

6: Because Java requires the installation of the Java runtime, which is actually an add-on. JavaScript has more direct access to the browser. You can interact with the HTML DOM, server communication through JSON or other mechanisms, etc.

7: Define "slow." Most browsers use some form of JIT, so it will work "fast enough." Will it have performance that native code can have? Not. But then again, are you making a game that will need this performance?

8: Tell it to me now: WebGL is an implementation of JavaScript OpenGL ES 2.0. Thus, there is no interaction with C / C ++ code, which is not part of the browser;)

9: They plan to soon introduce 3D rendering through Silverlight. Silverlight is an add-on.

10: Yes.

11: No. Nothing even remotely cross-platform.

12: This browser and driver are dependent. WebGL implementations are still young, so they may have some ripening.

13: This is a tricky question. You may know about this, but WebGL is an implementation of JavaScript OpenGL ES 2.0 ;). This means that it supports what ES 2.0 does, as well as any extensions that the implementation provides. Unlike regular desktop or mobile OpenGL implementations, the implementation here consists of two parts: the browser itself and the hardware driver.

The Google implementation of WebGL translates WebGL OpenGL ES 2.0 to Direct3D calls on Windows desktop computers. This allows them to stabilize a bit (as OpenGL drivers, especially on Linux machines, are uneven). The cost is that Google now decides which extensions to support. The implementation of Firefox WebGL goes directly to the desktop OpenGL or the base OpenGL ES 2.0 for mobile devices. This allows the underlying implementation to expose extensions for WebGL.

Base ES 2.0, which is all WebGL guarantees, is roughly equivalent to desktop OpenGL 2.0. So nothing with the desktop GL 3.x. There are many OpenGL ES extensions that provide access to more functions, but their combination does not yet add functionality at the GL 3.x desktop level.

Ultimately, WebGL is not intended for "hardcore games." He may be able to implement some of them, but the main goal is to allow the drawing of 3D graphics. Blistering speed and high-end physics are nothing.

+8
source
  • Can WebGL use the same power from a PC as a product without viewing?

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

  1. Is it completely shader based? or also supports legacy (I don't know if it is also deprecated in WebGL) rendering a fixed function? Since I'm exploring a shader-based approach, I really don't want to go back to the pipeline with a fixed function.

There is no fixed function in WebGL. It is based on OpenGL ES 2.0, which is based on a 100% shader interface.

  1. Or do I need to use another shell (Copperlich or GLGE) to get shader support? (although none of these engines support a shader).

Not

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

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

  1. Is it possible to integrate other middleware with WebGL? (e.g. bullet, phyX). Should I write some kind of interface using JS that connects to this native libary?

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

  1. A Java application can be embedded in a browser that has an OpenGl interface using JOGL or LWJGL. Then why WebGL when Java can do this?

Java is not recommended in the browser. It is unsafe as a plugin and removed from most browsers.

  1. Does JavaScript work slower? Is this a really good choice?

Asm.js / WebAssembly has been shown to be about 70% faster than native (which is faster than Java or C # on average). At the same time, some browser functions add a certain amount of overhead that a native application may have. For example, the <canvas> always linked to a page that means there is at least one additional call for a full-screen / full browser.

  1. Is it possible to run an engine written using C / C ++ using OpenGL in the context of WebGL? Is it just abstraction of the rendering system or is it impossible at all?

Yes, see emscripten again

  1. Is there any way for Microsoft to come up with WebX (DirectX) to implement WebGL in IE?

It is certainly possible. No one can predict the future. However, Microsoft has already implemented WebGL in IE11 and Edge.

  1. I think the most important part of WebGL will be the default integration with the browser. Thus, you do not need to download a plugin for a game, for example, Unity Player for Unity3d or any other plugin for a specific game engine. You can still play in any recently installed browser if it supports WebGL. Just open the page and start playing. Is that not so?

Questions requiring an opinion are not recommended for.

  1. Is there an alternative to WebGL that can provide launch without installing plugins?

At present

  1. What are the stability issues? Since the game will run in a browser, its responsiveness will play a crucial role in the stability of the game. Should I still worry about this? Will the browser be a bottleneck in the game?

There is no way to find out, except to check. Chrome and Firefox are updated every 6 weeks. Edge and Safari are also updated several times a year. Their behavior changes with each release. Usually for the better.

  1. What are the (main) things that WebGL does not support, which are supported by OpenGL 3.3 or later (I know that WebGL is based on OpenGL ES 2.0). As I said earlier, I am working on my own engine based on OpenGL 3.3.

This list is too long to research.

+3
source

JavaScript speed is currently comparable to Java.

Browser plugins fail. For some things, data can be transmitted and output using, for example, WebSockets or WebRTC.

For libraries like Bullet, which should not interact with things outside the browser, there is Emscripten that compiles C ++ to asm.js. It can even compile a complete C ++ JavaScript application, in fact this is what UE4 and Unity do. For large games / applications with a lot of data, I do not recommend doing this yet, because it has limited memory limits on 32-bit browsers.

By default, all major browsers broadcast WebGL calls to Direct3D on Windows (including Firefox), so they are pretty stable.

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

0
source

All Articles