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

Community Tip - Did you get an answer that solved your problem? Please mark it as an Accepted Solution so others with the same problem can find the answer 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.
1 REPLY 1

This may be better suited as a discussion >> so it can be better triaged

Announcements
NEW Creo+ Topics: PTC Control Center and Creo+ Portal


Top Tags