nullspace2k
04-24-2012, 01:35 AM
Hi!
In advance, I am a really newbie concerning OpenGL but I've not found any documentation on my question. That's why I registered here. Hope you can help me out ;)
I am coding my first OpenGL programm and want to visualize some bending beams. I am using VBOs to construct my beams.
Currently I use
1 VBO for Vertex Positions
1 VBO for Colours
1 VBO for Indices
I use the VBO for Indices to minimize the amount of vertices. For example, I would draw a cube with only 8 vertices and use the index vbo for generating the triangle strip by using correct indices.
This works fine for me, in wireframe. Now i want to add lighnting and setup a new VBO with the normals. I filled it with the normal vectors for each face, however lightning is not correctly rendered.
For drawing I use
glDrawElements(GL_TRIANGLE_STRIP, 34*10+8, GL_UNSIGNED_INT, 0);
I have the feeling, that my normals are applied to the vertices, not the triangles.
- What can I do to use VBOs to apply the normals onto my triangles?
- I want to keep the amount of vertices minimal and still use my index VBO. Is this possible?
Thanks and kind regards,
roland
In advance, I am a really newbie concerning OpenGL but I've not found any documentation on my question. That's why I registered here. Hope you can help me out ;)
I am coding my first OpenGL programm and want to visualize some bending beams. I am using VBOs to construct my beams.
Currently I use
1 VBO for Vertex Positions
1 VBO for Colours
1 VBO for Indices
I use the VBO for Indices to minimize the amount of vertices. For example, I would draw a cube with only 8 vertices and use the index vbo for generating the triangle strip by using correct indices.
This works fine for me, in wireframe. Now i want to add lighnting and setup a new VBO with the normals. I filled it with the normal vectors for each face, however lightning is not correctly rendered.
For drawing I use
glDrawElements(GL_TRIANGLE_STRIP, 34*10+8, GL_UNSIGNED_INT, 0);
I have the feeling, that my normals are applied to the vertices, not the triangles.
- What can I do to use VBOs to apply the normals onto my triangles?
- I want to keep the amount of vertices minimal and still use my index VBO. Is this possible?
Thanks and kind regards,
roland