I am having problem while picking a line.
I am creating a display list for line by calling glGenLists(1) and inside the function
i am using gl calls to draw the lines, at the same time i am printing a character string to
identify the line. The code snippet is given below…
{
GLuint line;
line = glGenLists(1);
glNewList(line, GL_COMPILE_AND_EXECUTE);
glBegin(GL_LINE);
//COde for drawing line
…
…
glEnd();
//For printing the string
CString strString = “1”;
glRasterPos3f(GLfloat(1.0), GLfloat(1.0), GLfloat(1.0));
glPushAttribute(GL_LIST_BIT);
glListBase(1000);
glCallLists(strlen((LPSTR)(LPCTSTR)strString), GL_UNSIGNED_BYTE, (GLubyte *)((LPSTR)(LPCTSTR))strString);
glPopAttribute();
glEndList();
}
I have already created the font for printing the bitmap(character string) and necessary other things…
those are listed below…
void CGLStarter::RealizeFont()
{
CFont font;
if(!font.CreateFontIndirect(m_pLogFont))
{
AfxMessageBox(“Could not set the font. Default font will be used.”);
return;
}
if(m_hOldFont == NULL)
{
m_hOldFont = (HFONT)::SelectObject(m_hDC, (HFONT)font);
}
else
{
(HFONT)::SelectObject(m_hDC, (HFONT)font);
}
wglUseFontBitmaps(m_hDC, 0, 255, 1000);
}
My PixelDescribeFormat is below
PIXELFORMATDESCRIPTOR pfd =
{
sizeof(PIXELFORMATDESCRIPTOR), // size of this pfd
1, // version number
PFD_DRAW_TO_WINDOW | // support window
PFD_SUPPORT_OPENGL | // support OpenGL
PFD_GENERIC_ACCELERATED | // support accelerated //new
PFD_DOUBLEBUFFER | // double buffered
PFD_SWAP_COPY , // swap buffered //new
PFD_TYPE_RGBA, // RGBA type
24, // 24-bit color depth
0, 0, 0, 0, 0, 0, // color bits ignored
0, // no alpha buffer
0, // shift bit ignored
0, // no accumulation buffer
0, 0, 0, 0, // accum bits ignored
32, // 32-bit z-buffer
1, // stencil buffer
0, // no auxiliary buffer
PFD_MAIN_PLANE, // main layer
0, // reserved
0, 0, 0 // layer masks ignored
};
++++++++++++++++++++++++++++
++++++++++++++++++++++++++++
MY PROBLEM
I am doing necessary things for Namestacker etc. for picking purpose.
I want to pick this line. Now i have many other things on the screen.
So in LbuttonDown function I am calling all the displaylists i had created useing the code below
for(GLuint i=0; i<GetMaxGrelem(); i++)
{
if(glIsList(m_glList[i]))
glCallList(m_glList[i]);
}
Now let me tell you Graphics card details and other details
- Operating System : Windows NT
- Collor Palette 65536 or True Color (in settings)
- Display card- Intel® 82810 Graphics Controller
NOW WHEN I PICK THIS LINE ON THE character string i get a Access Violation error in
glCallList(m_glList[i]); where m_glList[i] denotes the displaylist for line.
What i observed is that if i pick somewhere else in the line (not on the string say “1”), there is absolutely no
problem and programs works fine.
One more thing i observed is if I change the Color palette to 256 then everything works fine.
This problem does not happen in other graphics card with any color palette like
a)AGP V6600
b)TNT2 Model64
Could you please look into the problem and reply me as early as possible.
I have some more doubts…
Sometime my program does not work in Windows 2000.
Is it because of graphics card? If that is the case please tell me what i should do for that.
Will GLSetup help me in this regard. Is there GLSetup.exe for Windows 2000 and NT. When should i use
GLSetup? How to solve this problem? I have gone throgh FAQ of your site, but i did not get any answer to
my problem.
What I should have ( like Hardware driver, OpenGl Driver, DLL’s ) and how to use those, so that my program will
work without any problem in any Windows Operating system( NT, 2K, ME, 9X).
It would be of great help if you answer me these question as soon as possible.
Thanking you…