Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Some questions about WebGL

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 become 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 come 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.

like image 751
Quazi Irfan Avatar asked Jul 02 '11 07:07

Quazi Irfan


1 Answers

But the more I explore it feels like the offline pc games might become 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 compiled libraries. Unless you start getting into some browser add-ons, the only libraries you can use are what comes 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 communication 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 complex 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.

like image 174
Nicol Bolas Avatar answered Oct 05 '22 22:10

Nicol Bolas