I'm having an issue to use GLshort for representing Vertex, and Normal.

Posted by Xylopia on Stack Overflow See other posts from Stack Overflow or by Xylopia
Published on 2010-05-14T06:42:06Z Indexed on 2010/05/14 8:24 UTC
Read the original article Hit count: 217

Filed under:
|
|
|
|

As my project gets close to optimization stage, I notice that reducing Vertex Metadata could vastly improve the performance of 3D rendering.

Eventually, I've dearly searched around and have found following advices 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?

Advice on speeding up OpenGL ES 1.1 on the iPhone

Simple experiments show that switching from "FLOAT" to "SHORT" for vertex and normal isn't tough, but what troubles me is when you're to scale back verticies to their original size (with glScalef), normals are multiplied by the reciprocal of the scale. Natural remedy for this is to multiply the normals w/ scale before you submit to GPU. Then, my short normals almost become 0, because the scale factor is usually smaller than 0. Duh!

How do you use "short" for both vertex and normal at the same time? I've been trying this and that for about a full day, but I could only go for "float vertex w/ byte normal" or "short vertex w/ float normal" so far.

Your help would be truly appreciated.

© Stack Overflow or respective owner

Related posts about opengl

Related posts about iphone