Questions tagged [gldrawarrays]

render primitives from array data

glDrawArrays specifies multiple geometric primitives with very few subroutine calls. Instead of calling a GL procedure to pass each individual vertex, normal, texture coordinate, edge flag, or color, you can prespecify separate arrays of vertices, normals, and colors and use them to construct a sequence of primitives with a single call to glDrawArrays.

When glDrawArrays is called, it uses count sequential elements from each enabled array to construct a sequence of geometric primitives, beginning with element first. mode specifies what kind of primitives are constructed, and how the array elements construct those primitives. If GL_VERTEX_ARRAY is not enabled, no geometric primitives are generated.

Vertex attributes that are modified by glDrawArrays have an unspecified value after glDrawArrays returns. For example, if GL_COLOR_ARRAY is enabled, the value of the current color is undefined after glDrawArrays executes. Attributes that aren't modified remain well defined.

38 questions
6
votes
2 answers

Line graph with glDrawArrays and GL_LINE_STRIP from vector

How can I draw many lines with GL_LINE_STRIP, but not to draw a extra line between these lines, because it jumps to next value? See image Now the red lines are the actual values for the lines in the graph but the yellow ones are because it…
Kahin
  • 455
  • 2
  • 9
  • 21
4
votes
1 answer

Android 5.1 crash -- glDrawArrays GL_POINTS -- Fatal signal 7 (SIGBUS), code 2

A couple months ago, after I update my Nexus 4 to Android 5.1 (now 5.1.1 -- both stock factory images from Google), one of my games started crashing while drawing particles using glDrawArrays with GL_POINTS. I've simplified, reimplemented the code…
3
votes
2 answers

drawing several triangles with different colours with one glDrawArrays command

I'm trying to write something in OpenGL, and I'm a beginner so sorry for any mistakes I make. in general I just wanted to draw two triangles with different colours and I did using the following code: float vertices[] = { -0.5f, -0.6f, 0.0f, …
ufk
  • 30,912
  • 70
  • 235
  • 386
3
votes
2 answers

glDrawArrays access violation writing location

I'm trying to visualize very large point cloud (700 mln points) and on glDrawArrays call debugger throws access violation writing location exception. I'm using the same code to render smaller clouds (100 mln) and everything works fine. I also have…
Amadeusz
  • 1,488
  • 14
  • 21
3
votes
1 answer

OpenGL: optimal way to draw environment from height array?

So I am writing a openGL program with height-mapping to make a 3D out-door environment. As with all height-mapping each point is the same distance from its neighbor in the x&z axis, but the y axis differs for each vertex depending on the heightmap…
danglingPointer
  • 882
  • 8
  • 32
2
votes
1 answer

how to color each triangle differently using vbo

I already draw my triangles with glDrawArrays with vbo. Now i wanna color each triangle with a different color. I tried to follow the way i used to make the vertex, but in vain. I need your help. Here what ii tried for drawing the triangles without…
Joelle
  • 33
  • 6
2
votes
3 answers

glDrawArrays Access Violation

I am trying to follow [this][1] simple tutorial, but I am getting the following error upon reaching 'glDrawArrays': Unhandled exception at 0x03D7598E (nvoglv32.dll) in openGLTest.exe: 0xC0000005: Access violation reading location 0x00000000. void…
Calco
  • 1,420
  • 1
  • 17
  • 31
2
votes
1 answer

Why does using glDrawElements() causes a Segmentation Fault?

im learning about OpenGL and i wrote the following code in C++ using this guide and this video. Also i am using GLFW for context creation and GLEW for GL functions Most of the Shader class is copied from the video up linked, The problem is that…
2
votes
2 answers

How to use glDrawArrays with a Texture Array without shaders

Im trying to optimise my code by combining my textures into array textures (I realised I can't use texture atlases because most textures are repeated (over ground etc.)). I am working in PyGame and PyOpenGL, and I have never used shaders before. Is…
Matt Majic
  • 381
  • 9
  • 18
1
vote
1 answer

OpenGL Indexed Draw

I was trying to draw a Triangle with a custom FragmentShader for a gradient effect on the triangle. I was trying to use Indexed-Drawing instead of Drawing Arrays. Although glDrawArrays(...) works just fine, glDrawElements(...) doesn't work for me. I…
Siddharth
  • 13
  • 2
1
vote
1 answer

How to bind texture just to one object in OpenGLES?

I am activating the texture just before the object to draw. But the texture is showing on both objects. Why is that so? Should I unbind the texture before the first object to draw? - I tried with glDisable and glBindTexture but it did not help. Here…
1
vote
1 answer

glDrawArrays won't work draw dynamic array

I'm trying to render a tetrahedron that I could expand to other objects. Using static arrays works fine, draws the tetrahedron. But when I read in an OFF file into a dynamic array, nothing appears. No errors appear when I compile. GLfloat…
The_Fiz
  • 19
  • 1
1
vote
0 answers

OpenGL ES - instancing - different uv-coord one drawcall

I have the following problem in OpenGL ES3 concerning instancing I draw 64 shapes in one drawcall - triangles. OK! Then I want to give the shapes individual eyes and they are "blinking". The blinking means different offsets in the atlas (i.e.…
java
  • 1,165
  • 1
  • 25
  • 50
1
vote
1 answer

OpenGL ES: Should I use DrawElements for a TRIANGLE_STRIP array?

I'm trying to draw a simple array of triangles. They are all connected, so I'm currently using DrawArrays and GL_TRIANGLE_STRIP. However, when checking the XCode profiler, it suggests using DrawElements and an indexed array instead. Should I…
MysteryPancake
  • 1,365
  • 1
  • 18
  • 47
1
vote
0 answers

Switching from glDrawElements to glDrawArrays

I'm using LWJGL and an icosahedron-subdivide-algorithm to create icosphere meshes. I was using glDrawElements to render the spheres and they looked like this , but I was hoping for a more low-poly look. After some research I found that glDrawArrays…
haji beats
  • 11
  • 2
1
2 3