View Full Version : Superposition
I have two solids of different colors in the same position.
What is the option to see just one and not the two superposated (one on the other)?
04-11-2001, 05:29 AM
You need to set GL_LESS and not GL_LEQUAL in the depth test function if I understand your problem correctly...
To explain my problem, I am going to take an example:
I have two cylinders which have the same dimensions and are in the same position, but which have different colors: one is blue, the other is yellow.
During the render, I can see a cylinder blue with some marks of yellow. It isn't very nice. So I would like to see during the render only one coulor.
I have tried each value of the comparison function to use with glDepthfunc.
With GL_NOTEQUAL and GL_ALWAYS, I would obtain what I want (only one color) but with this options my objects look like transparent. So I stay http://www.opengl.org/discussion_boards/ubb/frown.gif
04-11-2001, 12:26 PM
If you exactly know which one to draw, you can use glPolygonOffset
Your error is due to an inexact z-buffer test. Maybe you can use more z-bits, but that wouldn't be a good either. Normally the two cylinders should have the same z-values. Are you sure that one isn't rotated a little bit?
04-11-2001, 12:53 PM
I'm not sure what exactly you are doing, but you could always draw the first object, then do a-
and then draw the second object. Don't know how this would work for your application, but I have found it useful for drawing analglyphs (stereo red/blue pairs) in conjunction with a-
glColorMask(red as GL_BOOLEAN,green as GL_BOOLEAN, blue as GL_BOOLEAN,alpha as GL_BOOLEAN)
drawing the first object with a color mask with just red true, then clearing the depth buffer and drawing again with blue mask only.
I realize that that goes a bit off topic, but it may be useful to clear the depth buffer and redraw is basically what I'm getting at. http://www.opengl.org/discussion_boards/ubb/smile.gif
04-11-2001, 12:56 PM
pure waste of performance in this task... http://www.opengl.org/discussion_boards/ubb/smile.gif
Powered by vBulletin® Version 4.2.2 Copyright © 2015 vBulletin Solutions, Inc. All rights reserved.