why glGetIntegerv returns wrong

GLint Hits, Viewport[4];
glGetIntegerv(GL_VIEWPORT, Viewport);

I used these codes in my program, when I debug into the code
I found the value of Viewport[0] to Viewport[3] are always negtive

Viewport 0x0012fa5c
[0] -858993460
[1] -858993460
[2] -858993460
[3] -858993460

why does this occur? I can not figure out. Any suggestions?

Looks like you don’t have a context current at the time you call glGetIteger.
The number is 0xCCCCCCCC, which might be uninitialized data.
Test if the glGetInteger copies anything into the viewport array at all by initializing the array to {0,0,0,0} before.

Originally posted by Relic:
Looks like you don’t have a context current at the time you call glGetIteger.
The number is 0xCCCCCCCC, which might be uninitialized data.
Test if the glGetInteger copies anything into the viewport array at all by initializing the array to {0,0,0,0} before.

Many thanks first. I tried to initialize the array as u suggested, but still nothing changes. I did set the viewport in OnSize()
glViewport(0,0,width,height);
What is wrong with my code?

Another question:
Does OpenGL selection can select a single line?

I modified another program in Codeguru, which is used to select Quadric objects, however when I add a line in the rendering, I failed to select this line, but I can select other quadric object. Am I right?