PDA

View Full Version : Visualization problem.



05-29-2003, 03:56 AM
Hello,
I have a different appearance of 3-d objects when I start the project the first and the second time. When I turn ON Windows NT PC and start the project the first time the colors and blending are wrong. But when I run the program one more time everything becomes correct. However the colors never get right when I run the project on W98 laptop.
Thanks.

Leyder Dylan
05-29-2003, 04:47 AM
Have you correctly initiliased your params in the InitGL() function ?

05-29-2003, 04:57 AM
I canít understand what is missing:

Public Function Initialize() As Boolean
Dim pfd As PIXELFORMATDESCRIPTOR
Dim r&, pos!(0 To 3)
'set standard parameters
pfd.nSize = Len(pfd)
pfd.nVersion = 1
pfd.dwFlags = PFD_SUPPORT_OPENGL Or PFD_DRAW_TO_WINDOW Or PFD_DOUBLEBUFFER Or PFD_TYPE_RGBA
pfd.iPixelType = PFD_TYPE_RGBA
pfd.cColorBits = 24
pfd.cDepthBits = 16
pfd.iLayerType = PFD_MAIN_PLANE
r = ChoosePixelFormat(frm3D.hDC, pfd)
If r = 0 Then
MsgBox "ChoosePixelFormat failed"
Exit Function
End If
r = SetPixelFormat(frm3D.hDC, r, pfd)
'palette?
'
m_hGLRC = wglCreateContext(frm3D.hDC)
wglMakeCurrent frm3D.hDC, m_hGLRC

glClearColor BR, BG, BB, 1 'set color to clear the color buffer
glClearDepth 1# 'set value (1.0) to clear the depth buffer


Dim Light_position(2) As GLfloat
Light_position(0) = 0: Light_position(1) = 0: Light_position(2) = 20000
glLightfv ltLight0, lpmPosition, Light_position(0)
Dim temp(3) As GLfloat
temp(0) = 0.5: temp(1) = 0.5: temp(2) = 0.5: temp(3) = 1
glMaterialfv faceFrontAndBack, mprSpecular, temp(0)
glMaterialfv faceFrontAndBack, mprShininess, 50

glEnable glcColorMaterial

glEnable GL_DEPTH_TEST
glEnable glcLight0
glLightModeli lmTwoSide, GL_TRUE
m_AspectRatio = 1
m_FarPlane = 20000
m_NearPlane = -20000
Initialize = True
End Function