PDA

View Full Version : glCreateShader generates exception



zakashe
04-22-2008, 10:01 AM
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.

yooyo
04-22-2008, 01:10 PM
You have to create opengl context before amny gl or glew call.

zakashe
04-23-2008, 09:26 AM
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

yooyo
04-23-2008, 11:30 AM
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);

zakashe
05-02-2008, 01:34 AM
Hei yooyo

thanks a lot!!! it helped.

zakashe.