- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Windows 7 64bit VisualC/C++ 2010
Dear Sir,
I have a trouble on HD Graphics 4000.
If the following code is executed,
zero will be written to a selection buffer by PreparePick() function.
But zero is not written in other video cards.
What should I do for me to receive a value correctly?
(I am poor at English. Please answer with an easy word.)
Best regards.
******************************
# include
# include
# include "glut.h"
# define max(a,b) (((a) > (b)) ? (a) : (b))
void PreparePick( unsigned int size, unsigned int* buff )
{
::glSelectBuffer( size/4, buff );
::glRenderMode ( GL_SELECT );
::glInitNames ();
::glPushName (0);
::glMatrixMode (GL_PROJECTION);
::glPushMatrix ();
::glLoadIdentity();
}
int CleanupPick()
{
::glMatrixMode (GL_PROJECTION);
::glPopMatrix();
::glFlush();
int iR=::glRenderMode(GL_RENDER);
iR=max( iR, 0 );
return iR;
}
void TestBufferDepth()
{
int hits;
GLuint buff[4096];
::glMatrixMode(GL_MODELVIEW);
::glPushMatrix();
::glLoadIdentity();
PreparePick( 4000, buff );
::glOrtho( -100, 100, -100, 100, -1000, 1000 );
::glLoadName(1);
::glBegin( GL_QUADS );
const double z = 0.0;
double work[3];
work[0] = -100.0;
work[1] = 100.0;
work[2] = z;
::glVertex3dv( work );
work[0] = -100.0;
work[1] = -100.0;
work[2] = z;
::glVertex3dv( work );
work[0] = 100.0;
work[1] = -100.0;
work[2] = z;
::glVertex3dv( work );
work[0] = 100.0;
work[1] = 100.0;
work[2] = z;
::glVertex3dv( work );
::glEnd();
hits = CleanupPick();
::glMatrixMode(GL_MODELVIEW);
::glPopMatrix();
if( hits ){
unsigned int bit;
bit = buff[2];
std::cout << "hit bit = "<< bit << '\n';
}else{
std::cout << "no hit"<<'\n';
}
}
void GLUT_INIT()
{
glutInitDisplayMode(GLUT_RGBA| GLUT_DOUBLE | GLUT_DEPTH);
glutInitWindowSize(640,480);
glutCreateWindow("Depth Buffer");
}
int main(int argc, char **argv)
{
glutInit(&argc,argv);
GLUT_INIT();
TestBufferDepth();
return 0;
}
- Tags:
- Intel® HD Graphics
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi suzuki,
We do not specifically work on code, but can you tell us what it is exactly you are trying to do? We may or may not be able to help you.
Thank you,
-Nic
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi -Nic
Thank you for the answer.
The sample, the polygon was tried on one.
But I would like to know which polygon is in front,
when two or more polygons exist.
Then, I watched the "buff[2]".
It means distance of the depth direction on 3D-space.
HD graphics 4000 returned zero,
however other video cards returned non-zero.
In the case of zero value,
It won't know the positional relation on 3D-space of two or more polygons.
Best regards.
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page