开发者

glDrawElements with constant normal

开发者 https://www.devze.com 2023-02-03 00:05 出处:网络
I was just curious if you can specify constant normal when drawing with single call of DrawElements. I\'m using VAOs and VBOs so it\'s not that problem because I load them once for a开发者_JAVA百科ll

I was just curious if you can specify constant normal when drawing with single call of DrawElements. I'm using VAOs and VBOs so it's not that problem because I load them once for a开发者_JAVA百科ll vertices and just store VBO ID, but I could free some memory in graphic card..

this is the way you need to load data into graphics:

glBindBuffer(GL_ARRAY_BUFFER,VBO[Grid][Normals]);
glNormalPointer(GL_FLOAT, sizeof(vector3f), 0);
glEnableClientState(GL_NORMAL_ARRAY);

As I specify some 5x5x5 grid and then use indices to create cubic surphace, it's not much to deal with normals and using some constant would help :)


You can implementing the function using a vertex shader which specify always the same normal. So, it's only required to specify the normal as uniform, since it's the same for those vertices.

0

精彩评论

暂无评论...
验证码 换一张
取 消