Jump to content
  • Advertisement
Sign in to follow this  
Gumgo

glGenBuffersARB problem

This topic is 3750 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello. I'm having a problem with the function glGenBuffersARB. For some reason, it doesn't seem to assign an ID to the variable in the second parameter. Here is what I have:
struct VBO
{
	UINT id; // <- the ID of the vbo
	std::vector <vbochunk> DataChunk;
	int size;
	VBO();
	~VBO();
};

VBO::VBO() : size( 0 )
{
	glGenBuffersARB( 1, &id ); // <- this doesn't assign "id" with anything
	glBindBufferARB( GL_ARRAY_BUFFER, id );
	glBufferDataARB( GL_ARRAY_BUFFER, VBO_SIZE, NULL, GL_STATIC_DRAW );

	...
}

id remains uninitialized even after the glGenBuffersARB call (something like 0xCCCCCCCC). Any ideas as to why this function might not be working?

Share this post


Link to post
Share on other sites
Advertisement
It reports GL_INVALID_OPERATION but I don't think I can rely on that because the error reporting function seems to always report GL_INVALID_OPERATION, even before OpenGL has been initialized.

Share this post


Link to post
Share on other sites
Quote:
Original post by Gumgo
It reports GL_INVALID_OPERATION but I don't think I can rely on that because the error reporting function seems to always report GL_INVALID_OPERATION, even before OpenGL has been initialized.

So you're saying it's an error in OpenGL that somehow no one else have ever noticed?

I think it's slightly more likely that you simply have a problem in your code which *causes* it to always report GL_INVALID_OPERATION

Share this post


Link to post
Share on other sites
I'm not saying it is an error with OpenGL, but there is something weird with my setup/system/drivers that causes it to report that error even before I've initialized OpenGL or called any OpenGL related functions.

Anyway, thanks V-man, that turned out to be the problem! I had OpenGL initializing after the VBOs.

Share this post


Link to post
Share on other sites
Quote:
Original post by Gumgo
I'm not saying it is an error with OpenGL, but there is something weird with my setup/system/drivers that causes it to report that error even before I've initialized OpenGL or called any OpenGL related functions.


And.. what behavior are you expecting ? A crash ? A GL_NO_ERROR return ? No thanks, I'll take a GL_INVALID_OPERATION any day over those :)

Y.

Share this post


Link to post
Share on other sites
Quote:
Original post by Gumgo
It reports GL_INVALID_OPERATION but I don't think I can rely on that because the error reporting function seems to always report GL_INVALID_OPERATION, even before OpenGL has been initialized.


You're probably using the VBO class before initializing OpenGL, and i'm pretty sure you cant use extensions without initializing OpenGL...

Share this post


Link to post
Share on other sites
Yep, as I mentioned, that did turn out to be the issue (I accidentally called the function to initialize OpenGL after the one to initialize the VBOs).

About the error thing... okay, so it does make sense that it would return GL_INVALID_OPERATION when called before initialization. But I read that calling glGetError() until all errors have been returned will reset the error flags. This code:
while (1)
{
if (glGetError() == GL_NO_ERROR)
break;
}
Loops infinitely (always returning GL_INVALID_OPERATION) no matter where I put it in the program. If I understand, the GL_INVALID_OPERATION flag should be reset once it is returned. So I'm either doing something weird with glGetError() and THAT function is causing an error, or there is something wrong with my setup/system/drivers/etc.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!