vertex-array

Understanding normals indices with Wavefront Obj

徘徊边缘 提交于 2019-12-04 13:03:51
I've written a C++ Obj file loader that I can't get to work correctly. The problem is that while parsing a simple obj file like the following: # Blender v2.62 (sub 0) OBJ File: '' # www.blender.org mtllib cube.mtl o Cube v 1.000000 -1.000000 -1.000000 v 1.000000 -1.000000 1.000000 v -1.000000 -1.000000 1.000000 v -1.000000 -1.000000 -1.000000 v 1.000000 1.000000 -0.999999 v 0.999999 1.000000 1.000001 v -1.000000 1.000000 1.000000 v -1.000000 1.000000 -1.000000 vn 0.000000 0.000000 -1.000000 vn -1.000000 -0.000000 -0.000000 vn -0.000000 -0.000000 1.000000 vn 1.000000 -0.000000 0.000000 vn 1

Best way to draw scatter plot with lots of data points in C++ using OpenGL

笑着哭i 提交于 2019-12-04 07:47:34
I'm writing a program in C++ that acquires 4 dimensional points data over a UDP socket and then plots the data in 6 separate 2D scatter plots. For example if we name the dimensions: A,B,C,D the six 2d plots would be AxB, AxC, AxD, BxC, BxD, and CxD. Over the course of a few hours the program accrues ~50K points. Currently I plot each point once, using immediate mode. I don't clear the buffer between draw calls so previously plotted points persist until the buffer is cleared. I'm not happy with this method as immediate mode is slow and deprecated. When I have to clear the buffer, as when a

OpenGL Vertex buffer object, can I access the vertex data for other uses such as collision detection?

时光总嘲笑我的痴心妄想 提交于 2019-12-03 14:34:11
I'm currently using the GLTools classes that come along with the Superbible 5th edition. I'm looking in the GLTriangleBatch class and it has the following code: // Create the master vertex array object glGenVertexArrays(1, &vertexArrayBufferObject); glBindVertexArray(vertexArrayBufferObject); // Create the buffer objects glGenBuffers(4, bufferObjects); #define VERTEX_DATA 0 #define NORMAL_DATA 1 #define TEXTURE_DATA 2 #define INDEX_DATA 3 // Copy data to video memory // Vertex data glBindBuffer(GL_ARRAY_BUFFER, bufferObjects[VERTEX_DATA]); glEnableVertexAttribArray(GLT_ATTRIBUTE_VERTEX);

VAO and element array buffer state

こ雲淡風輕ζ 提交于 2019-11-30 11:24:27
问题 I was recently writing some OpenGL 3.3 code with Vertex Array Objects (VAO) and tested it later on Intel graphics adapter where I found, to my disappointment, that element array buffer binding is evidently not part of VAO state, as calling: glBindVertexArray(my_vao); glDrawElements(GL_TRIANGLE_STRIP, count, GL_UNSIGNED_INTEGER, 0); had no effect, while: glBindVertexArray(my_vao); glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, my_index_buffer); // ? glDrawElements(GL_TRIANGLE_STRIP, count, GL_UNSIGNED

how to order vertices in a simple, non-convex polygon

て烟熏妆下的殇ゞ 提交于 2019-11-30 09:47:52
问题 I have a problem where I have a series of points for a simple, non-convex polygon (I hope I have the terminology correct). But the points are not necessarily in order (ie, clockwise or counterclockwise). For Flash's drawing API to correctly draw a fill area, I need to have these points progress in order around the edge (to finally connect with the starting point). Is there some way I can sort my list of Cartesian coordinates in either clockwise or counterclockwise direction so I can draw my

VAO and element array buffer state

杀马特。学长 韩版系。学妹 提交于 2019-11-30 00:09:37
I was recently writing some OpenGL 3.3 code with Vertex Array Objects (VAO) and tested it later on Intel graphics adapter where I found, to my disappointment, that element array buffer binding is evidently not part of VAO state, as calling: glBindVertexArray(my_vao); glDrawElements(GL_TRIANGLE_STRIP, count, GL_UNSIGNED_INTEGER, 0); had no effect, while: glBindVertexArray(my_vao); glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, my_index_buffer); // ? glDrawElements(GL_TRIANGLE_STRIP, count, GL_UNSIGNED_INTEGER, 0); rendered the geometry. I thought it was a mere bug in Intel implementation of OpenGL

how to order vertices in a simple, non-convex polygon

给你一囗甜甜゛ 提交于 2019-11-29 17:30:21
I have a problem where I have a series of points for a simple, non-convex polygon (I hope I have the terminology correct). But the points are not necessarily in order (ie, clockwise or counterclockwise). For Flash's drawing API to correctly draw a fill area, I need to have these points progress in order around the edge (to finally connect with the starting point). Is there some way I can sort my list of Cartesian coordinates in either clockwise or counterclockwise direction so I can draw my shape from point to point without "lifting the pen"? I saw one post for sorting 4-points of a polygon,

What are Vertex Array Objects?

北城以北 提交于 2019-11-27 17:09:04
I am just starting to learn OpenGL today from this tutorial: http://openglbook.com/the-book/ I got to chapter 2, where I draw a triangle, and I understand everything except VAOs (is this acronym OK?). The tutorial has this code: glGenVertexArrays(1, &VaoId); glBindVertexArray(VaoId); While I understand that the code is necessary, I have no clue what it does. Although I never use VaoId past this point (except to destroy it), the code does not function without it. I am assuming this is because it is required to be bound, but I don't know why. Does this exact code just need to be part of every

What are Vertex Array Objects?

一个人想着一个人 提交于 2019-11-26 18:50:43
问题 I am just starting to learn OpenGL today from this tutorial: http://openglbook.com/the-book/ I got to chapter 2, where I draw a triangle, and I understand everything except VAOs (is this acronym OK?). The tutorial has this code: glGenVertexArrays(1, &VaoId); glBindVertexArray(VaoId); While I understand that the code is necessary, I have no clue what it does. Although I never use VaoId past this point (except to destroy it), the code does not function without it. I am assuming this is because