glCreateShader generates exception

Hi,

I am really new to openGL and SL. and I tried to write a really short and basic program. (I am using XP and ATI Radeon 1550)

Everything compiles just fine but unfortunately glCreateShader function generates an exception (Access violation reading location 0x00000000.).

I reinstalled catalyst and all my GPU related SW. Then I verified I have the latest glew version.

If before glCreateShader I call glewInit function its return value is always GLEW_ERROR_NO_GL_VERSION .

What does that mean? How can I fix this?

10x a lot,
zakashe.

You have to create opengl context before amny gl or glew call.

hi,

thanks a lot for helping but it does not seem to solve the problem,

the relevant code looks like this :

HDC hDC = GetDC(g_hWnd);
HGLRC hRC = wglCreateContext( hDC );
wglMakeCurrent( hDC, hRC );
GLuint glShaderID = glCreateShader(GL_FRAGMENT_SHADER);

Is there anything else i should add ? (sorfor the ignorance i am really new at it)

10x a lot,
zakashe

Try this…

 
HDC hDC = GetDC(g_hWnd);

// Add Choose & Select pixelformat code here

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

// add glew initialisation here

GLuint glShaderID = glCreateShader(GL_FRAGMENT_SHADER);

Hei yooyo

thanks a lot!!! it helped.

zakashe.

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.