Confusedly, what order should I give the 3D coordinates for openGL

I hope someone can shed light on this issue for me. If I'm given a point (i, j, k), I can make the following cube:

8______K_______7 1 = i , j , k /| /| 2 = i+1, j , k L/ | J/ | 3 = i+1, j+1, k / |H / | 4 = i , j+1, k 5/______I_____/6 |G 5 = i , j , k+1 | | | | 6 = i+1, j , k+1 | | | | 7 = i+1, j+1, k+1 E| 4|________|F__|3 8 = i , j+1, k+1 | / c | / | /D | /B |/___________|/ 1 A 2 

where the numbers 1-8 are each of the vertices of the cube, and the letters AL are the midpoints of each edge of the cube.

I am trying to implement a marching cube algorithm, but I don’t know what order to give points for each triangular plane that I find. For example, if vertex 1 is marked, I will need to draw a plane from EDA. Similarly, if vertex 7 is marked, I will need to draw a plane from KJG. Is there a rule so that the order gives the coordinates in the 3D space for openGL?

+4
source share
1 answer

Is there a rule for ordering to give coordinates in 3D space for openGL?

OpenGL defines the front and back sides of the face by winding vertices in the screen space. If the vertices of the face in the screen space are in counterclockwise order, the front side is considered visible. Clockwise => Reverse. Normals should indicate the direction of the front.

+1
source

Source: https://habr.com/ru/post/1379256/


All Articles