PDA

View Full Version : Ripping out my hair - simple basic one?



joolz
03-25-2005, 04:14 AM
Guys

I am slowly going mad here.

Correction - quickly going mad.

Hopefully you can help.

I have now created a simple model to test things out and it just isn't working as I think it should.

Please see the following

www.cadfem.com/ogl4.gif (http://www.cadfem.com/ogl4.gif)

Basically when I turn on glEnable glcDepthTest the view is exactly "backward" to what it should be.

Its almost like the depth test is working the wrong way round.

The code below is basically all that I am doing (except for passing in the rotation ngle)

I have no views set up etc, but I assume that the default view is looking down the Z axis. I.E -Ve Z

Any ideas???

I KNOW its going to be a Homer Simpson - Doah! but I just cant see whats wrong

Many thanks for any help

Julian (going bald) Holt

================================================== ==============
'Basic OGL setup stuff

glClearColor 1, 1, 1, 0

glFrontFace ffCW 'Fwiz.wiz orders polygons as CW

================================================== ==============
\\pLOT A CUBOID
glNewList part_list2, lstCompile

glBegin bmQuads
For lngPolygon = 0 To glngNumPolygons

glColor3f 0, 0, 1: glVertex3f 0, 0, 0
glColor3f 0, 0, 1: glVertex3f 0, 0.5, 0
glColor3f 0, 0, 1: glVertex3f 0.5, 0.5, 0
glColor3f 0, 0, 1: glVertex3f 0.5, 0, 0

glColor3f 1, 0, 0: glVertex3f 0, 0.125, 0.5
glColor3f 1, 0, 0: glVertex3f 0, 0.375, 0.5
glColor3f 1, 0, 0: glVertex3f 0.25, 0.375, 0.5
glColor3f 1, 0, 0: glVertex3f 0.25, 0.125, 0.5

glColor3f 1, 1, 0: glVertex3f 0.25, 0.125, 0.5
glColor3f 1, 1, 0: glVertex3f 0.25, 0.375, 0.5
glColor3f 1, 1, 0: glVertex3f 0.5, 0.5, 0
glColor3f 1, 1, 0: glVertex3f 0.5, 0, 0

glColor3f 0, 1, 1: glVertex3f 0, 0.375, 0.5
glColor3f 0, 1, 1: glVertex3f 0, 0.5, 0
glColor3f 0, 1, 1: glVertex3f 0.5, 0.5, 0
glColor3f 0, 1, 1: glVertex3f 0.25, 0.375, 0.5

glColor3f 1, 0, 1: glVertex3f 0, 0.125, 0.5
glColor3f 1, 0, 1: glVertex3f 0.25, 0.125, 0.5
glColor3f 1, 0, 1: glVertex3f 0.5, 0, 0
glColor3f 1, 0, 1: glVertex3f 0, 0, 0

glColor3f 0.7, 0.7, 0.7: glVertex3f 0, 0.375, 0.5
glColor3f 0.7, 0.7, 0.7: glVertex3f 0, 0.125, 0.5
glColor3f 0.7, 0.7, 0.7: glVertex3f 0, 0, 0
glColor3f 0.7, 0.7, 0.7: glVertex3f 0, 0.5, 0

Next
glEnd

glEndList
================================================== =========================
\\RENDER

glClear GL_COLOR_BUFFER_BIT Or GL_DEPTH_BUFFER_BIT Or GL_STENCIL_BUFFER_BIT

glPolygonMode faceFront, pgmFILL

glPushMatrix
glRotatef angleY, 1, 0#, 0#
glRotatef angleX, 0#, 1, 0#
glCallList part_list2
glPopMatrix


SwapBuffers pbOGL.hDC
================================================== =============================

joolz
03-25-2005, 06:24 AM
Got it, AND its a Doah!!!

By default the viewing point is 0,0,0

All my polygons were +Z and therefore BEHIND the viewer.

Simple