How can offsetting be done??

General FreeBASIC programming questions.
Post Reply
Powo
Posts: 4
Joined: May 27, 2005 6:11

How can offsetting be done??

Post by Powo »

Besides using gltranslate but I am looking for a way to get the X,Y,Z offset from obtaining, the original position, the orientation, and the offset coordination.

(notice I also posted the same thing from a different forum but wanted to see how this can be done in Freebasic way)

Example, I want to offset my gunpoints as in (-2,0,1) and (2,0,1), I would actually need 6 return varaibles.

Like, GetOffsetX(NormalX,NormalY,NormalZ,AngleX,AngleY,AngleZ,OffsetX,OffsetY,OffsetZ)
Would be like:
GunPointX(1) = GetOffsetX(0,100,1000,0,90,45,-2,0,1)
GunPointY(1) = GetOffsetY(0,100,1000,0,90,45,-2,0,1)
GunPointZ(1) = GetOffsetZ(0,100,1000,0,90,45,-2,0,1)

GunPointX(2) = GetOffsetZ(0,100,1000,0,90,45,2,0,1)
GunPointY(2) = GetOffsetZ(0,100,1000,0,90,45,2,0,1)
GunPointZ(2) = GetOffsetZ(0,100,1000,0,90,45,2,0,1)


How hard would this be?
relsoft
Posts: 1767
Joined: May 27, 2005 10:34
Location: Philippines
Contact:

Post by relsoft »

glGetfloatv

I think that's what you need. :*)
Powo
Posts: 4
Joined: May 27, 2005 6:11

Post by Powo »

Can I see an example code for this.

Obviously I don't have much time to do a research for it since I have to goto work in a few minutes.
Dr_D
Posts: 2451
Joined: May 27, 2005 4:59
Contact:

Post by Dr_D »

Code: Select all

Dim glMatrix(15) as Single 

'You can also load it into a 2 dimensional array....
'glMatrix(3,3) or glMatrix(1 to 4, 1 to 4)

'Do Translation
'Do Rotation

glGetFloatV GL_MODELVIEW_MATRIX @glMatrix(0)
The last matrix that OpenGL used will be poked into glMatrix(). It's just like if you did the translation/rotation with your own matrix routine.
Post Reply