Page 1 of 1

OpenGL Hell

Posted: Sun Apr 04, 2004 7:13 pm
by Raine3D
I noticed, some lines in c++ wont translate into PB (Notably the ones containing GLfloat or f)

------------------

C++ Code

Code: Select all

gluPerspective(45.0f,(GLfloat)width/(GLfloat)height,0.1f,100.0f);
PB Code

Code: Select all

gluPerspective_(45.0, width / height, 0.1, 100.0)
-----------------Also This:

C++ Code

Code: Select all

glClearDepth(1.0f);
PB Code

Code: Select all

glClearDepth_(1.0)
I clearly have the right number of parameters. Does this error have something to do with the variable type im using?

Posted: Sun Apr 04, 2004 7:32 pm
by Pupil
Those functions expect doubles as arguments, which PB doesn't have yet.

Posted: Sun Apr 04, 2004 7:48 pm
by dmoc
Soved several times already. Search is your friend :D

Re: OpenGL Hell

Posted: Sun Apr 04, 2004 10:31 pm
by NoahPhense
Don't know if this helps:

Code: Select all

Structure Double
  Hi.l
  Lo.l
EndStructure

Procedure MakeDouble(LONG.f, ADDRESS.l)
  !FLD dword [ Esp ]
  !MOV dword Eax, [ Esp + 4 ]
  !FSTP qword [ Eax ]
EndProcedure

Procedure.f CatchDoubleReturn(*x.Double)
  !MOV  dword EAX,[ESP]
  !FST  qword [EAX]
  !MOV  dword EAX,[ESP]
  !FLD  qword [EAX]
EndProcedure
example of MakeDouble:

Code: Select all

Procedure.l iSEDDrawImage(Left.f, Top.f, Width.f, Height.f)
  dLeft.Double
  dTop.Double
  dWidth.Double
  dHeight.Double
  MakeDouble(Left.f, @dLeft)
  MakeDouble(Top.f, @dTop)
  MakeDouble(Width.f, @dWidth)
  MakeDouble(Height.f, @dHeight)
  ProcedureReturn CallFunctionFast(FPDrawImage, dLeft\Hi, dLeft\Lo, dTop\Hi, dTop\Lo, dWidth\Hi, dWidth\Lo, dHeight\Hi, dHeight\Lo)
EndProcedure

pain in the ass, but it works great

- np

Re: OpenGL Hell

Posted: Mon Apr 05, 2004 9:42 am
by traumatic
you could also use this: viewtopic.php?t=9116