WebGL: 2D vs 3D Libraries

This post has moved to

  • Everton Marques

    Good point.

  • Q-Guy

    Your argument that OpenGL is a “3D library” and OpenGL ES 2.0 is not, is flawed. Here’s why:

    Your OpenGL snippet uses GLUT, which hides the math of calculating the projection matrix. Furthermore your code snippet only uses the fixed function pipeline. As soon as you use the programmable piple, your OpenGL code is practically the same as ES 2.0.

    Whether you call it a “3D library” or not is up to you, but OpenGL and OpenGL ES 2.0 definitely belong in the same broad category.

  • greggman

    We’ll just have to disagree then. I know hundreds of programmers that can use the fixed function pipeline that can’t use shaders. Why, because shaders require 3D math knowledge that the fixed function stuff used provide for you. IMO that makes the fixed function GL a 3D library and the shader GL not. ES and WebGL have no fixed function pipeline. Therefore you need 3D knowledge. Therefore they aren’t 3D libraries. Libraries should provide the knowledge suggested by their name.

  • Q-Guy

    The fixed function pipleline has been removed in OpenGL 3.1. It is also no longer available in DirectX10 and 11.

    Again, your OpenGL snippet uses GLUT, without that extra lib, you would need to do the same math in OpenGL, no matter if it’s fixed function or shaders. So OpenGL does as much 3D math for you as OpenGL ES, except for fixed function transformation of vertices and per vertex lighting, which will make you application look like it’s from 2003. So I pity the hundreds of programmers you know that do not understand simple linear algebra. They can never program a sophisticated 3D application without that knowledge, and should therefore stick to real 3D middleware libraries, and leave OpenGL programming to dedicated professionals.

  • greggman

    Yep, Which is exactly the point. If you don’t know 3D use a 3D library. If you do then by all means do it yourself. If you don’t know 3D and someone tells you WebGL or OpenGL ES 2.0 is a 3D library you’ll have been sorely mislead.

  • Q-Guy

    Yes, I agree. But the same is true for OpenGL, not just ES 2.0

  • greggman

    I don’t agree. I can use OpenGL fixed function pipeline with zero 3d knowledge. That I need to call gluPerspective isn’t 3d knowledge since I don’t have to know what happens inside that function, only that I need to call it. Similarly I can draw objects by handing the API 3D data, giving it 3D positions, turning on flags for 3D lights. I need no knowledge of 3D math, perspective projection, lighting equations, etc to do this. Contrast to a shader only API where I need all that knowledge.

  • Q-Guy

    gluPerspective is a part of GLUT, not OpenGL! E.g. with ES 2.0 you could use GLM (OpenGL Mathematics lib) to avoid the math behind the projection matrix. Therefore you can use ES 2.0 with “zero 3d knowledge” in the same sense as OpenGL, thus proving my point that OpenGL and OpenGL ES 2.0 are in the same category.

  • greggman

    We’ll just have to agree to disagree. To me it doesn’t matter that gluPerspective is part of glut and not OpenGL. It’s included with every OpenGL. It’s used in nearly every OpenGL sample. It requires no knowledge of what it actually does to use it.

    That’s not true in shader land where you have no know what it does since you have to write the shaders to use it.

  • Q-Guy

    In that vein of arguing, 4,5,6,7 are irrelevant, because just like people use gluPerspective without understanding it, people use shaders without understanding them. Same thing.

    You are calling OpenGL ES 2.0 a 2D API, yet it does not draw 2D out of the box, so your “word processor” analogy does not add up.

    So I agree to disagree. The important thing is that fixed function OpenGL and programmable pipeline OpenGL DO belong in the “same broad category”. After several replies you still could not coherently explain why they don’t.

  • greggman

    I’ve fully explained it. Sorry it’s over your head

  • Q-Guy

    And I disproved all your arguments. Sorry that’s over your head.

    If you cannot comprehend what I’m talking about, here’s some final words: the Khronos Groups, which is the consortium that created WebGL calls it a “web standard for a low-level 3D graphics API based on OpenGL ES 2.0”. Go ahead and keep calling it a 2D-only API, while graphics programmers all over the world keep laughing at you.

    You’re obviously a beginner to OpenGL, your twisted view on fixed function vs programmable pipeline in regard to required math knowledge will straighten out, once you’ve written something that exceeds the level of a OpenGL tutorial sample. Good luck in learning 3D math, you’ll need it.

  • greggman

    Wow, You should probably do a little research before you stick your foot in your mouth. I implement WebGL in Chrome. I’m on the Khronos WebGL Working Group. I helped write the WebGL spec. I wrote 90% of the WebGL Conformance Tests. So no, I’m not a beginner to WebGL. I’m one of the principle architects of it.

    No graphics programmers are laughing at me. In fact these ideas were used in a talk by the implementors of WebGL for Firefox because they help make it clear how much extra knowledge is needed to use WebGL from scratch and why if you’re just getting started it’s often better to use a 3D library like Three.js rather than try to write your own 3D library on top of the non-3d WebGL.

    I’m sorry if you’re having trouble seeing the difference. Compare an OpenGL 1.1 book to a OpenGL ES 2.0 book. The 1.1 book will have lit cube on the screen in a couple of chapters. The ES 2.0 book will take 7 or 8 more chapters to get to that part because so much 3D knowledge that was encapsulated in the fixed function features is not in ES 2.0+

  • Spongman

    *sound of crickets*

    Nice article.

  • Stevensen Liu

    It is interesting WordPress blog themes