View Full Version : 256 cube help plz

11-05-2004, 12:30 AM
ok. im extremely new to openGL so please be as "layman" as possible when it comes to help. any help however is much appreciated

im creating a 16x16x16 cube filled with smaler cubes. ivew managed to do this. ive also implemented a zoom and rotate feature. my problem is this.
i need to be able to draw a plane through any point and set everything in front of that as either transparent or as background so it becomes invisible.
if need be i will show my code for the cube.
please help me as im rubbish.
kind regards

11-05-2004, 11:39 AM

SOunds like you need a clip-plane. Basically, you can define a plane that will not allow anything drawn behind it (plane direction is defined by the normal vector).


void glClipPlane(GLenum plane, const GLdouble *equation);

Defines a clipping plane. The equation argument points to the four coefficients of the plane equation, Ax+By+Cz+D = 0. All points with eye coordinates (xe, ye, ze, we) that satisfy (A B C D)M-1 (xe ye ze we)T >= 0 lie in the half-space defined by the plane, where M is the current modelview matrix at the time glClipPlane() is called. All points not in this half-space are clipped away. The plane argument is GL_CLIP_PLANEi, where i is an integer between 0 and 5, specifying which of the six clipping planes to define.

So, the trickiest part is determining the coefficients for the plane. A simple example would to clip fragments with a negative X would be:

GLdouble coefs[4] = { 1.0, 0.0, 0.0, 0.0 };

glClipPlane( GL_CLIP_PLANE0, coefs );
glEnable( GL_CLIP_PLANE0 );
// Draw geometry to clip
glDisable( GL_CLIP_PLANE0 );Hope that helps!

11-05-2004, 01:22 PM
ok ill try that during the weekend
thanks for help ill let you know how it goes

11-07-2004, 12:38 PM
ok so how would i go about setting an input in my interface to handle any arguments? would i have an x, y, z input and have it draw the normal at those coordinates then clip it? what sort of code would i be looking at to do that for me if thats the case?

11-08-2004, 01:04 AM
ok that methos wasn't so good since the view of the cube is changing with rotate etc. heres what i think should work..any ideas?

given 3 cubes in tesseral form, plot a plane through these and determine what is displayed. thats to say everything in front of it is displayed as background (black)

help plz

11-08-2004, 12:20 PM

11-09-2004, 12:57 AM
please can someone help..ive found some info on other posts but cant tell if its relevant or not. i just want my interface to be able to input 3 sets of coordinates, draw a plane through all of them and set all in front as background. please help
thanks in advance

11-09-2004, 01:19 PM
bumpety bump

11-09-2004, 11:33 PM
please help?

11-10-2004, 02:22 AM
Stop bumping with silly posts.

1) You have been answered correctly : use clip planes.
2) A problem with rotation/scaling ? Read the docs better.
3) ... and stop bumping with silly posts. If you don't show you make some work, why would one want to help you again ?

I really hope it will help you.

11-10-2004, 11:17 PM
erm...wot? firstly i told everyone that clipping planes isnt the way since the orientation of the cube renders that impossible..secdondly ive done a lot of coding which would take up a lot of room. if someone wants to see the code then all they need do is ask. stop wasting my time please. if ure not gonna answer dont post

11-11-2004, 03:59 AM
if you post your code Maybe I can look at it. If it is really long then e mail it too me i will see what can be done. e mail plokeswa@mailcity.com

11-14-2004, 04:02 AM
hmmm i did a similar thing with clip planes