OpenGL Hell

Just starting out? Need help? Post your questions and find answers here.
Raine3D
New User
New User
Posts: 8
Joined: Tue Sep 23, 2003 2:36 am

OpenGL Hell

Post 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?
Pupil
Enthusiast
Enthusiast
Posts: 715
Joined: Fri Apr 25, 2003 3:56 pm

Post by Pupil »

Those functions expect doubles as arguments, which PB doesn't have yet.
dmoc
Enthusiast
Enthusiast
Posts: 739
Joined: Sat Apr 26, 2003 12:40 am

Post by dmoc »

Soved several times already. Search is your friend :D
User avatar
NoahPhense
Addict
Addict
Posts: 1999
Joined: Thu Oct 16, 2003 8:30 pm
Location: North Florida

Re: OpenGL Hell

Post 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
traumatic
PureBasic Expert
PureBasic Expert
Posts: 1661
Joined: Sun Apr 27, 2003 4:41 pm
Location: Germany
Contact:

Re: OpenGL Hell

Post by traumatic »

you could also use this: viewtopic.php?t=9116
Good programmers don't comment their code. It was hard to write, should be hard to read.
Post Reply