I'm having trouble using GLshort to represent Vertex and Normal

As my project is approaching the optimization stage, I notice that reducing Vertex metadata can significantly improve 3D rendering performance.

In the end, I searched very well and found the following tips from stackoverflow.

Using GL_SHORT instead of GL_FLOAT in an OpenGL ES vertex array

How do you represent a normal or texture coordinate using GLshorts?

Acceleration Tips for OpenGL ES 1.1 on iPhone

Simple experiments show that switching from “FLOAT” to “SHORT” for the vertex and normal is not hard, but what worries me is that you have to scale back to your original size (using glScalef), the normals are multiplied on a reciprocal scale. A natural remedy for this is to multiply the w / scale normals before you submit to the GPU. Then my short normals almost become 0, because the scale factor is usually less than 0. Duh!

How do you use short for vertices and normal at the same time? I tried this all day, but so far I could only use "float vertex w / byte normal" or "short vertex w / float normal".

Your help will be truly appreciated.

+3
2

, ?

glEnable( GL_NORMALIZE );

, , , , , GPU GPU. , , . , , , , , .

+1

:

  • , GL_NORMAL
  • .
  • , .
0

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


All Articles