Questions tagged [vertex-array]
109 questions
143
votes
5 answers
What are Vertex Array Objects?
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:…

Patrick
- 1,894
- 3
- 15
- 17
24
votes
5 answers
VAO and element array buffer state
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…

the swine
- 10,713
- 7
- 58
- 100
18
votes
2 answers
OpenGL vertex buffer confusion
Would someone care to explain the difference to be between a VertexBuffer, a VertexArray, a VertexBufferObject, and a VertexArrayObject? I'm not even sure if these are all terms for different things, but I've seen all of them appear in the OpenGL…

Hannesh
- 7,256
- 7
- 46
- 80
13
votes
1 answer
OpenGL/JOGL: Multiple triangle fans in a vertex array
I'm working on making some moderately simple shapes with vertex arrays, and I'm making some good headway, but now I want to draw 2 (or more) triangle fan objects. Is there any way to only make one call to gl.glDrawArrays(GL.GL_TRIANGLE_FAN,... or…

dimo414
- 47,227
- 18
- 148
- 244
8
votes
2 answers
The best way to texture a cube in openGL
Which is the best way (lowest memory, fastest speed) to texture a cube? after a while i have find this solution:
data struct:
GLfloat Cube::vertices[] =
{-0.5f, 0.0f, 0.5f, 0.5f, 0.0f, 0.5f, 0.5f, 1.0f, 0.5f, -0.5f, 1.0f, 0.5f,
-0.5f, 1.0f,…

Luca
- 1,270
- 1
- 18
- 34
7
votes
1 answer
OpenGL Vertex buffer object, can I access the vertex data for other uses such as collision detection?
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,…

kbirk
- 3,906
- 7
- 48
- 72
6
votes
1 answer
Hard time understanding indices with glDrawElements
I'm trying to draw a terrain with GL_TRIANGLE_STRIP and glDrawElements but I'm having a really hard time understanding the indices thing behind glDrawElements...
Here's what I have so far:
void Terrain::GenerateVertexBufferObjects(float ox, float…

rfgamaral
- 16,546
- 57
- 163
- 275
6
votes
2 answers
android-ndk, glGenVertexArraysOES not found
I want to use VAO in my native-c application for Android.
The problem is, that GL_OES_vertex_array_object is supported and I can even get the addresses of glBindVertexArrayOES and glDeleteVertexArraysOES but glGenVertexArraysOES is not found.
Does…

Sergei Ivanov
- 103
- 1
- 9
5
votes
2 answers
Texturing each polygon in vertex array - OpenGL
I am trying to get my render function to work. I am using vertex arrays. Here is the my vertex structure.
struct Vertex
{
float x, y, z; // The x, y and z floating point values
float u, v; // The u - v…

Moniker Grantis
- 73
- 4
5
votes
1 answer
Best way to draw scatter plot with lots of data points in C++ using OpenGL
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.…

slayton
- 20,123
- 10
- 60
- 89
5
votes
2 answers
Understanding normals indices with Wavefront Obj
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…

linello
- 8,451
- 18
- 63
- 109
5
votes
1 answer
Triangle gradient on OpenGL
I'm trying to make a triangle like the one in the right in the following picture:
The problem is that what I want to achieve is a gradient of color from vertexes 1 and 2 proyected from C.
As far as I know this is not possible since vertex C must…

Leo
- 1,174
- 11
- 25
5
votes
1 answer
OpenGL VBO's in Haskell
Basing on this post, I was trying to figure out how to use VBO's in Haskell. I tried to fill in the bits that were not covered there:
data Sprite = Sprite { spriteImage :: Image
, spritePosition :: Position
…

Lanbo
- 15,118
- 16
- 70
- 147
5
votes
2 answers
Why does OpenGL's glDrawArrays() fail with GL_INVALID_OPERATION under Core Profile 3.2, but not 3.3 or 4.2?
I have OpenGL rendering code calling glDrawArrays that works flawlessly when the OpenGL context is (automatically / implicitly obtained) 4.2 but fails consistently (GL_INVALID_OPERATION) with an explicitly requested OpenGL core context 3.2. (Shaders…

metaleap
- 2,132
- 2
- 22
- 40
4
votes
1 answer
Rendering Optimization
I have heard that fewer drawing calls = faster
The implied lesson is to pack as much vertex data into as few arrays as possible to minimize the number of drawing calls.
I was thinking of writing a rendering framework on top of OpenGL to pack all…

Prime
- 4,081
- 9
- 47
- 64