Jump to content

  • Log In with Google      Sign In   
  • Create Account

glBindVertexBuffer, glVertexAttribFormat, & glVertexAttribBinding Questions/Issues


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
2 replies to this topic

#1 Racoonacoon   Members   -  Reputation: 443

Like
0Likes
Like

Posted 11 October 2012 - 06:58 PM

Hey all,

I've recently been in the process of moving from the DirectX/XNA camp to the OpenlGL side of things as of late. I've found the process very interesting and fun so far, but I keep running into an issue that has been irking me. Perhaps someone here can help.

I have been attempting to set up the Vertex Attribute Layout using the glBindVertexBuffer, glVertexAttribFormat, & glVertexAttribBinding commands, but I get a "0xC0000005: Access violation reading location 0x00000000" when glBindVertexBuffer is encountered. Are these commands supported in OpenGL 4.2? I tried to do some research to find what version these functions were introduced, but I haven't found anything specific as of yet.

In the case that they are supported in OpenGL 4.2, here is the setup code I am using:
[source lang="cpp"] //Interleave position, color, and UV data. const float vertexData[] = { //Vertex 0 -.50f, .50f, 0.0f, 1.0f, 1.0f, 0.0, 0.0, 1.0f, 0.0f, 0.0f, //Vertex 1 .50f, .50f, 0.0f, 1.0f, 0.0, .50, 0.0, 1.0f, 1.0f, 0.0f, //Vertex 2 .50f, -.50f, 0.0f, 1.0f, 0.0, 0.0, 1.0, 1.0f, 1.0f, 1.0f, //Vertex 3 -.50f, -.50f, 0.0f, 1.0f, .50, .50, 1.0, 1.0f, 0.0f, 1.0f }; //Build our 'vertex buffer' glGenBuffers(1, &bufferName); glBindBuffer(GL_ARRAY_BUFFER, bufferName); glBufferData(GL_ARRAY_BUFFER, sizeof(vertexData), vertexData, GL_STATIC_DRAW); //Create the 'IA Layout' //We crash right here glBindVertexBuffer(0, bufferName, 0, sizeof(float) * 10); glEnableVertexAttribArray(0); glVertexAttribFormat(0, 4, GL_FLOAT, GL_FALSE, 0); glVertexAttribBinding(0, 0); glEnableVertexAttribArray(1); glVertexAttribFormat(1, 4, GL_FLOAT, GL_FALSE, sizeof(float) * 4); glVertexAttribBinding(1, 0); glEnableVertexAttribArray(2); glVertexAttribFormat(1, 2, GL_FLOAT, GL_FALSE, sizeof(float) * 8); glVertexAttribBinding(2, 0); /* This will set up things fine */ //glEnableVertexAttribArray(0); //glVertexAttribPointer(0, 4, GL_FLOAT, false, sizeof(float) * 10, reinterpret_cast<void*>(0)); //glEnableVertexAttribArray(1); //glVertexAttribPointer(1, 4, GL_FLOAT, false, sizeof(float) * 10, reinterpret_cast<void*>(sizeof(float) * 4)); //glEnableVertexAttribArray(2); //glVertexAttribPointer(2, 2, GL_FLOAT, false, sizeof(float) * 10, reinterpret_cast<void*>(sizeof(float) * 8));[/source]


I'm using GLEW and I'm running Visual Studio 2010. I'm guessing that it may not be supported on 4.2, and thus GLEW is returning a null pointer to the function it can't find, but I want to be sure.

Sponsor:

#2 mhagain   Crossbones+   -  Reputation: 8277

Like
0Likes
Like

Posted 11 October 2012 - 07:26 PM

These are OpenGL 4.3; currently only NVIDIA have a GL4.3 driver available, and even that's just in beta.

Edited by mhagain, 11 October 2012 - 07:26 PM.

It appears that the gentleman thought C++ was extremely difficult and he was overjoyed that the machine was absorbing it; he understood that good C++ is difficult but the best C++ is well-nigh unintelligible.


#3 Racoonacoon   Members   -  Reputation: 443

Like
0Likes
Like

Posted 11 October 2012 - 07:38 PM

Ah, thank you mhagain




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS