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
0
votes
2 answers

Triangle not drawing in OpenGL 2.1 on OSX

I'm following a tutorial on creating a Game Engine in Java using OpenGL. I'm trying to render a triangle on the screen. Everything is running fine and I can change the background color but the triangle won't show. I've also tried running the code…
0
votes
1 answer

glDrawElements not working in the other machine

I'm using OpenGL with g++. This simple code works fine in my system. It draws a rectangle as expected. GLfloat vertices[] = { 0,0,0, //0 0,6,0, //1 6,6,0, //2 6,0,0, //3 }; GLint indices[] =…
Shashwat
  • 2,538
  • 7
  • 37
  • 56
0
votes
1 answer

cocos2d V3 glDrawArrays not working

Converting to cocos2d V3 and this code produces no drawing: [_shaderProgram use]; //for V2 this was [shaderProgram_ use]; ccGLEnableVertexAttribs(kCCVertexAttribFlag_Position |…
0
votes
1 answer

Calling multiple glReadPixels & glDrawArrays on a FBO, in Opengl ES

In OpenGL ES, is it possible to call glReadPixels and glDrawArrays on a FBO several times one after the other? The issue I'm facing is that I'm getting the image all garbled. Sample Code: // Activate Off-Screen FBO glBindFramebuffer(GL_FRAMEBUFFER,…
PerracoLabs
  • 16,449
  • 15
  • 74
  • 127
-1
votes
1 answer

c++ opengl drawing only 1 point instead of grid

I am solving some drawing wrapper for my DLL which is calculating some array. In this code I need it to draw, but I dont understand, why when I bind it only once, it draws only 1 point. But when I am binding it(as I know, I should not do that…
-2
votes
1 answer

Draw triangle with glDrawArray function

I want to draw an triangle in opengl with glDrawArrays() function. Following is my code: .cpp file: void linedr2::initializeGL() { glClearColor(0, 0, 0, 1.0); glMatrixMode(GL_PROJECTION); …
Yashu
  • 49
  • 12
-2
votes
1 answer

OpenGL: glDrawArrays() throws exception (nvoglv32.dll) Access violation reading location 0x00000000

So I've made a basic OpenGL application and everything was fine until I implemented a Geometry shader. The error im getting is Exception thrown at 0x6A67F00A (nvoglv32.dll) in Demo.exe: 0xC0000005: Access violation reading location 0x00000000.…
Elias Finoli
  • 121
  • 9
-2
votes
1 answer

OpenGL: glDrawArrays and glReadPixels in VBO

I am trying to implement a VBO in which I use glDrawArrays to draw a list of triangles and glReadPixels to read the output. The glReadPixels function is throwing a segmentation fault error. This is the code that initializes and uses the VBO: void…
jpaguerre
  • 1,130
  • 1
  • 13
  • 20
1 2
3