cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - You can Bookmark boards, posts or articles that you'd like to access again easily! X

Why the following codes did not work?

ptc-4458421
1-Visitor

Why the following codes did not work?

The following codes were used to read the color and depth of a pixel in Pro/E model window by using openGL functions to perfom some simulation. All the other opengl functions worked properly except depth reading function. I don't know why. Any kind of helps are welcome.

Now given a model displayed in Pro/E window, as shown in this fig. When I tried to run the following codes, the results are shown in the comments.

BYTE btRGB[3];

GLfloat fZBuffer[1];

//go to the center of the view

int cw = winWidth/2; //width and height of the view are gotten in advance
int ch = winHeight/2;

glReadPixels(cw, ch, 1, 1, GL_RGB, GL_UNSIGNED_BYTE, btRGB);//It works, color information is read correctly
glReadPixels(cw, ch, 1, 1, GL_DEPTH_COMPONENT, GL_FLOAT, fZBuffer); //this dosn't work, always get fZBuffer[0]=1.0 even when we go to elsewhere

Actually the depth of every pixel of the model surface should be different value, but here it kept 1.0 for all pixels. This problem have troubled me for quite a long time. I really appreciate any kind of your help.


This thread is inactive and closed by the PTC Community Management Team. If you would like to provide a reply and re-open this thread, please notify the moderator and reference the thread. You may also use "Start a topic" button to ask a new question. Please be sure to include what version of the PTC product you are using so another community member knowledgeable about your version may be able to assist.
0 REPLIES 0
Announcements


Top Tags