OpenGL Point Functionality in WebGL

前端 未结 2 1537
天涯浪人
天涯浪人 2021-02-10 15:17

In OpenGL you can draw define points like this:

glBegin(GL_POINTS);
for(float theta=0, radius=60.0; radius>1.0; theta+=0.1, radius-=0.3){
            


        
2条回答
  •  攒了一身酷
    2021-02-10 15:47

    WebGL is based on OpenGL ES 2.0 (see here), which dropped immediate-mode support.

    This specification describes an additional rendering context and support objects for the HTML 5 canvas element [CANVAS]. This context allows rendering using an API that conforms closely to the OpenGL ES 2.0 API.

    You'll need to use vertex buffers to store vertex data. See here1 for a good explanation of how things work in retained mode. And there for a nice small example to get you started.

    1: Kudos to whoever posted this here.

提交回复
热议问题