Questions tagged [vertex-array]

109 questions
4
votes
2 answers

OpenGL: How to design efficient rendering system using vertex arrays with depth sorting?

People constantly tell me to use at least Vertex Arrays. But i think its not a good idea since i'm using glPushMatrix() with glTranslatef/glRotatef to position an object in the 3d world. So, should i stop using glPushMatrix() and calculate the…
Newbie
  • 1,143
  • 5
  • 20
  • 30
4
votes
1 answer

Generic vertex attribute buffer doesn't seem to work without glVertexPointer

I'm drawing an interleaved buffer - it is a generic vertex attribute buffer. The layout consists of three floats as a vertex coordinate, and two other float attributes, interleaved thus: | float | float | float | float | float | |…
Riot
  • 15,723
  • 4
  • 60
  • 67
4
votes
2 answers

Should I use several glDrawArrays() or gather all the vertices to one big glDrawArrays-call?

I'm working on a personal Java OpenGL (JOGL) project and I'm using some custom objects with separate draw functions and vertices. public class Cube extends PhysicalObject { public void draw(GL gl) { gl.glColor3f(1.0f, 1.0f, 0.0f); …
3
votes
1 answer

Rendering different models (with their own ELEMENT_ARRAY_BUFFER) without changing which VAO is used

I am trying to render multiple models sharing the same VAO and vertex format (following top answer on this post Render one VAO containing two VBOs), however I cannot get it to work with GL_ELEMENT_ARRAY_BUFFER nor can I find any resource/example to…
Victor Drouin
  • 597
  • 2
  • 15
3
votes
2 answers

A question about GL_VERTEX_ARRAY

This is just out of mere interest, but is there a limit to the amount of vertecies GL_VERTEX_ARRAY will 'hold' and render through something like drawArrays()? Or could I theoretically pass through a few million vertexes and still be able to call…
MPainter
  • 79
  • 1
  • 1
  • 7
3
votes
1 answer

glDrawArrays: when has it finished?

Pseudocode: void draw() { Vertex* vertices = scene.GetVertexArray(); glEnableClientState(...); glVertexPointer(..., vertices); glDrawArrays(...); glDisableClientState(...); delete vertices; } I'm not using VBO since I want…
coder123
  • 81
  • 1
  • 8
3
votes
1 answer

Converting OpenGL draw lists to vertex arrays or VBOs

I'm trying to convert a program using draw lists, which are deprecated in OpenGL 3.0+, to use either vertex arrays or VBOs, but I'm not finding any examples of how to do the conversion. What's in the program now is this (happens to be Python, but…
uckelman
  • 25,298
  • 8
  • 64
  • 82
3
votes
2 answers

Fastest way to load arrays of vertices and face indices into OpenGL-ES?

I'm trying to load .obj files that I've formatted into: vertexX vertexY vertexZ normalX normalY normalZ and: index1 index2 index3 format into vector and vector arrays, which I then directly render in Opengl-ES. My problem is, when I try to load…
Davido
  • 2,913
  • 24
  • 38
3
votes
1 answer

NDK OpenGL undefined reference to glVertexPointer

When compiling the following C code with ndk-build in Terminal (I'm running Ubuntu): #include #include #include #include "org_opengldrawinjni_DrawinJNI.h" JNIEXPORT void JNICALL…
Prime
  • 4,081
  • 9
  • 47
  • 64
3
votes
1 answer

Opengl: How do I texture a model made with a vertex array?

I'm trying to get away from immediate mode because I keep getting told that it really isn't the best way to program in Opengl. I found a tutorial that will make a cube and colour it, but it doesn't cover texturing. This is the code I have: GLfloat…
WhyYouNoWork
  • 273
  • 5
  • 18
3
votes
2 answers

Can I delete OpenGL vertex arrays after calling glDrawArrays?

I am generating the vertex arrays on the fly on each render and I want to delete the arrays afterwards. Does glDrawArrays immediately copy the vertex arrays to the server? Hence is it safe to delete the vertex arrays after calling glDrawArrays?…
Ozgur Ozcitak
  • 10,409
  • 8
  • 46
  • 56
3
votes
1 answer

Trouble catching mistake with OpenGL and Vertex Array Objects

I am having trouble spotting my mistake with this OpenGL implementation. When I run the program the only thing I get is a black screen. I should be seeing a cube. I am not getting any sort of errors. I have suspicion the culprit may lye with the…
xBACP
  • 531
  • 1
  • 3
  • 17
3
votes
1 answer

OpenGL ES - How to Batch Render 500+ particles w/ different alphas, rotations, and scales?

I am developing an iOS game that will need to render 500-800 particles at a time. I have learned that it is a good idea to batch render many sprites in OpenGL ES instead of calling glDrawArrays(..) on every sprite in the game in order to be able to…
BigSauce
  • 1,830
  • 3
  • 21
  • 27
2
votes
1 answer

Plane geometry, each segment different color, some of them transparent

I am using three.js and I want to create geometry 16x16 size. I want that each segment is different color and some of them is transparent. What is the best solution for this problem? Should i render each pixel as a single plane geometry? Or there is…
2
votes
1 answer

OpenGL instanced array drawing

I have a simple OpenGL program and trying to draw an instanced array that stored in a vertex shader. I'm using two follow shaders for rendering: Vertex Shader: #version 330 core uniform mat4 MVP; const int VertexCount = 4; const vec2…
shadeglare
  • 7,006
  • 7
  • 47
  • 59