Jump to content
  • Advertisement
Sign in to follow this  
ArgusMaker

OpenGL OpenGL Buffer Problem - RESOLVED

This topic is 2283 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

[spoiler]
Hi there!
I migrated from Direct3D to OpenGL a few days ago, i'm trying to obtain my first rendering.
I already have a problem around using VBOs.

GLuint VertexBuffer;
glGenBuffers(1,&VertexBuffer);


Visual C++ generates this error:

First-chance exception at 0x00000000 in myprogr.exe:
0xC00000005: Access violation execeuting location 0x00000000

within "glGenBuffers" line.

The entire source is:


void InitOpenGL()
{
hDC = GetDC(GameWindow);

PIXELFORMATDESCRIPTOR pfd;
ZeroMemory(&pfd,sizeof(pfd));
pfd.nSize = sizeof(pfd);
pfd.dwFlags = PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL | PFD_DOUBLEBUFFER;
pfd.nVersion = 1;
pfd.iPixelType = PFD_TYPE_RGBA;
pfd.cColorBits = 32;
pfd.cDepthBits = 24;
pfd.iLayerType = PFD_MAIN_PLANE;
int pixelFormat = ChoosePixelFormat(hDC,&pfd);
SetPixelFormat(hDC,pixelFormat,&pfd);

hRC = wglCreateContext(hDC);
wglMakeCurrent(hDC,hRC);

GLuint VertexBuffer;
glGenBuffers(1,&VertexBuffer);
}

InitOpenGL is called inside WinMain, just before the beginning of the main loop
(while(1) {...} ) where windows messages are controlled and rendering is processed.

I've already checked my OpenGL version (glGetString(GL_VERSION) returns "2.1.8395 Release") against OpenGL specifications and
glGenBuffers should be supported..[/spoiler]
edit: Never mind! I had to place glewInit() after the activation of OpenGL.

Share this post


Link to post
Share on other sites
Advertisement
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!