Hello,
I'm trying to plot some cylinders
using the GLU library:
Q=gluNewQuadric();
glColorf(1.0f,0.0f,0.0f);
gluCylinder(Q,0.2f,0.2f,2.0f,20,10);
gluDisk(Q,0.0f,0.2f,20,1);
glTranslatef(...);
glColorf(0.0f,1.0f,0.0f);
gluCylinder(Q,0.2f,0.2f,2.0f,20,10);
gluDisk(Q,0.0f,0.2f,20,1);
glTranslatef(...);
glColorf(0.0f,0.0f,1.0f);
gluCylinder(Q,0.2f,0.2f,2.0f,20,10);
gluDisk(Q,0.0f,0.2f,20,1);
The objects are correctly drawn but I see
strange behaviours when a cylinder should hide
another: rotating the whole scene with
a glRotate preceding the command list,
I see the cylinder behind and not that
before...I don't know if I'm clear enough:
the cylinder closer to the camera disappears
in that portions that should hide the
cylinder in the background.
What may be the cause of this?
Thanks!
|
|
0
|
|
|
|
Reply
|
patrick
|
12/4/2004 7:32:50 PM |
|
enable depth-testing
glEnable(GL_DEPTH_TEST);
use a appropriate depth-comparision function
e.g. glDepthFunc(GL_LEQUAL);
and make sure that your drawing context supports z-buffering/depthbuffering
hth psy
|
|
0
|
|
|
|
Reply
|
Sebastian
|
12/5/2004 7:16:10 AM
|
|
Yes. Whenever it is possible for an object to obscure another you have
to make sure that your z-plane is sorted and handled correctly. Don't
feel bad, this is the first mistake I made, it is one I still often
make.
|
|
0
|
|
|
|
Reply
|
donoteatmikezila
|
12/6/2004 8:34:32 PM
|
|
On Mon, 06 Dec 2004 12:34:32 -0800, donoteatmikezil wrote:
> Yes. Whenever it is possible for an object to obscure another you have
> to make sure that your z-plane is sorted and handled correctly. Don't
> feel bad, this is the first mistake I made, it is one I still often
> make.
I tryed with:
glClearDepth(1.0f);
glDepthFunc(GL_LEQUAL);
glEnable(GL_DEPTH_TEST);
in the gl-init function; but all objects
disappeared in a black window...
I'm reading the opengl 2.0 specifications,
I find it very hard...
Thanks for your attention.
Patrick
|
|
0
|
|
|
|
Reply
|
patrick
|
12/6/2004 8:58:28 PM
|
|
patrick carosso wrote:
> I tryed with:
> glClearDepth(1.0f);
> glDepthFunc(GL_LEQUAL);
> glEnable(GL_DEPTH_TEST);
> in the gl-init function; but all objects
> disappeared in a black window...
Make sure, your rendering context also has an associated depth
buffer. Otherwise the behaviour with enabled depth test is
undefined.
> I'm reading the opengl 2.0 specifications,
> I find it very hard...
Well, the spec is not the best resource for learning OpenGL.
Better go for the "OpenGL Programming Guide" aka "Red Book".
--
Wolfgang Draxinger
|
|
0
|
|
|
|
Reply
|
Wolfgang
|
12/6/2004 9:44:48 PM
|
|
"Wolfgang Draxinger" <wdraxinger@darkstargames.de> wrote in message
news:cp2jsd$5tm$1@svr7.m-online.net...
> patrick carosso wrote:
>
> > I tryed with:
> > glClearDepth(1.0f);
> > glDepthFunc(GL_LEQUAL);
> > glEnable(GL_DEPTH_TEST);
> > in the gl-init function; but all objects
> > disappeared in a black window...
>
> Make sure, your rendering context also has an associated depth
> buffer. Otherwise the behaviour with enabled depth test is
> undefined.
>
> > I'm reading the opengl 2.0 specifications,
> > I find it very hard...
>
> Well, the spec is not the best resource for learning OpenGL.
> Better go for the "OpenGL Programming Guide" aka "Red Book".
>
> --
> Wolfgang Draxinger
>
And make sure you "near" and "far" are reasonable and "near" is strictly >
0.0 for your
viewing setup.
jbw
|
|
0
|
|
|
|
Reply
|
JB
|
12/7/2004 5:22:00 AM
|
|
I didn'd clear the depth buffer!
glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
And now it works!
Thank you all!
|
|
0
|
|
|
|
Reply
|
patrick
|
12/7/2004 8:45:38 PM
|
|
|
6 Replies
370 Views
(page loaded in 0.362 seconds)
Similiar Articles: [NEWBIE]Strange problem: I can see through objects! - comp ...Hello, I'm trying to plot some cylinders using the GLU library: Q=gluNewQuadric(); glColorf(1.0f,0.0f,0.0f); gluCylinder(Q,0.2f,0.2f,2.0f,20,10)... renderbuffer objects - comp.graphics.api.opengl[NEWBIE]Strange problem: I can see through objects! - comp ... renderbuffer objects - comp.graphics.api.opengl You can access the texture through a sampler ... Looping through Web Service results - comp.lang.php[NEWBIE]Strange problem: I can see through objects! - comp ... Use MPI inside a for loop - comp.parallel.mpi Loop through 1 -> M a. ... api.opengl ..... give much better ... XML namespace problem - comp.databases.oracle.tools[NEWBIE]Strange problem: I can see through objects! - comp ... XML namespace problem - comp.databases.oracle.tools [NEWBIE]Strange problem: I can see through objects! - comp ... Shading problem - comp.graphics.api.opengl[NEWBIE]Strange problem: I can see through objects! - comp ... problem: link file under /dev/dsk/ - comp.unix.solaris... my situation: 2 local scsi drive, one SAN drive ... Disabling Gui Components - comp.soft-sys.matlabThe problem I'm having is that I can get the panel to disappear, but none of the objects located inside it ... I have looked through guide and ... Newbie: Prevent stretching of ... RS-232 problems - comp.soft-sys.matlab... fprintf(s,'ABCD') Then a strange happens On oscilloscope i see ... working Ok, I tried to send through ... of hardware signals can be important to find problems. Fixed length records containing 2 different records types with ...Strange. Getting close, I just can't see what I'm doing wrong. ... my handle from "Rookie Card" to "Lame Newbie ... controls that but I've only seen this problem ... still struggling with FBOs and depth texture (for shadow map ...... of a depth attachment to see what happens on the first pass. My objects ... Strange, that the render-to ... I tracked down the problem with pbuffers by stepping through my ... Extract a bordered, skewed rectangle from an image - comp.lang ...You can see the project here ... How to do this through Python into openCV? I am a newbie to ... image tracking and object identification in Python with OpenCV so can ... [NEWBIE]Strange problem: I can see through objects! - comp ...Hello, I'm trying to plot some cylinders using the GLU library: Q=gluNewQuadric(); glColorf(1.0f,0.0f,0.0f); gluCylinder(Q,0.2f,0.2f,2.0f,20,10)... Strange Objects in stool - Digestive Disorders / Gastroenterology ...I have found some strange objects in my ... done to rule out colon problems ... foods we eat can pass through and give a strange appearance. The white round things you see ... 7/24/2012 5:18:10 AM
|