Jump to content
  • Advertisement
Sign in to follow this  
liusuxing

Why Quadro FX4500 does not support" StencilFunc "?

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

Hellow everyone! I am new here! I have programed such codes as is shown below. I want use stencil buffer to drawing another image in the rectgular region in the original image. I have tested my codes in a PC with cheap ATI graphcard. It works well.However, it fails in another PC with Nividia Quadro FX4500. I am so confused that why Why Quadro FX4500 does not support" StencilFunc "? or maybe some configure steps are needed? int DrawGLScene(GLvoid) { glClearColor(0.0f, 0.0f, 0.0f, 0.0f); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); /////////////////////////////////掩模成功 绘制不同图像 glEnable(GL_STENCIL_TEST); glClearColor(0.0f, 0.0f, 0.0f, 0.0f); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT); ////////////Stencil Making glStencilFunc(GL_NEVER, 1, 1); glStencilOp(GL_REPLACE,GL_KEEP, GL_KEEP); glBegin(GL_QUADS); // 开始绘制四边形 glNormal3d(0.0, 0.0, 1.0); // 法线指向观察者 glVertex3d(-2.0, -5.0, 1.0); // Point 1 (Front) glVertex3d(2.0, -5.0, 1.0); // Point 2 (Front) glVertex3d(2.0, 5.0, 1.0); // Point 3 (Front) glVertex3d(-2.0, 5.0, 1.0); // Point 4 (Front) glEnd(); glStencilMask(GL_FALSE); glClearColor(0.0f, 0.0f, 0.0f, 0.0f); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glStencilFunc(GL_EQUAL, 0, 1); glColorMask(GL_TRUE, GL_TRUE,GL_TRUE, GL_TRUE); // glColor3d(0.0,0.0,1.0); // auxSolidTeapot(2.0); glDrawPixels(BitmapInfo->bmiHeader.biWidth,BitmapInfo->bmiHeader.biHeight,GL_BGR_EXT, GL_UNSIGNED_BYTE, ImageA); glStencilFunc(GL_EQUAL, 1, 1); // glColor3d(0.0,1.0,0.0); // auxSolidCube(1.0); glDrawPixels(BitmapInfo->bmiHeader.biWidth,BitmapInfo->bmiHeader.biHeight,GL_BGR_EXT, GL_UNSIGNED_BYTE, ImageB); glDisable(GL_STENCIL_TEST); // glFlush(); return TRUE; // Keep Going }

Share this post


Link to post
Share on other sites
Advertisement
Are you sure you are asking for a pixel format with 8 bits of stencil, when creating the OpenGL context ? That would explain the observed difference: on the ATI card, the "default" format you get already has 8 bits of stencil, while on the Quadro, since you didn't explicitely ask it, you got another format without stencil bits ?

Y.

Share this post


Link to post
Share on other sites
Thanks Ysaneya very much, I have fixed the problem.
As u said, when setting up the pixel format, the stencil function and bits are closed in my former codes.
After chage it to "1" in corresponding bit, the program runs well in both ATI and Nividia Quadro .

Share this post


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