Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Messages - bigsofty

#2551
Weird, but also using X_SPRITE after a X_DRAWAXES makes all the X_SPRITE textures go blue...?

Even with... X_SETTEXTURE -1, -1...

Hopes this helps nail down the bug.
#2552
GLBasic - en / Camera Vector
2007-Apr-19
Thanks Gernot, Ive already got this working but no information is wasted information... :D

Im back to trying to fix my alphablending problems with a 3d particle system...
#2553
GLBasic - en / options page
2007-Apr-18
Anyway to make it a command line option or a run once only command? This way it can be an option for the end user?

Just a suggestion.
#2554
I use X_PRINT and X_DRAWAXES to show some debug info on my 3D objects in my scene. But some of the Axis's have been disappearing after I use X_PRINT?


Code (glbasic) Select
WHILE TRUE
  X_MAKE3D 1,5500,45

    X_DRAWAXES 0,0,-100
   
//    X_PRINT "test",0,0,-50,0.3 // Unremark this line to see bug...

    X_DRAWAXES 10,10,-100


  SHOWSCREEN
WEND
#2555
Yep, all types should be treated the same (cept. array names and pointers).

Well at least I can go forward, Ill change it in the future if needed  :)
#2556
Why does this not work...

Code (glbasic) Select
TYPE Tmytype
foo$
ENDTYPE

GLOBAL testvar AS Tmytype

WHILE 1
myfunc(testvar)
WEND


FUNCTION myfunc: BYREF a AS Tmytype
a.foo$ = "Foo!"
ENDFUNCTION
... probably me doing something silly? I want to pass a custom type 'byref'...?
Code (glbasic) Select
*** Configuration: WIN32 ***
precompiling:
GPC - GLBasic Precompiler V.2007.095 - 3D, NET
"test.gbas"(14) error : wrong argument type : myfunc, arg no: 1
#2557
Yep, I've been doing that... thanks any ways Gernot, I hope you have luck with the update.
#2558
Quote from: GernotFrischGif meh zeh guhn!
LOL, I went to babelfish (As I do quite a bit) to translate this from German to English... then I realised what it said... haha... doh! :D
#2559
Code (glbasic) Select
*** Configuration: WIN32 ***
precompiling:
GPC - GLBasic Precompiler V.2007.095 - 3D, NET
"test.gbas"(12) error : wrong argument type : X_CAMERA, arg no: 1
TYPE  is not declared
Main program...

Code (glbasic) Select
// --------------------------------- //
// Project: TEST.GBAS
// Start: Saturday, April 14, 2007
// IDE Version: 4.154


foo()


WHILE TRUE
     X_MAKE3D 1,5500,45
X_CAMERA cameraPosition.x, cameraPosition.y, cameraPosition.z, cameraTarget.x, cameraTarget.y, cameraTarget.z
     SHOWSCREEN
WEND
Dummy library...

Code (glbasic) Select
// --------------------------------- //
// Project: CAMERA_LIB.GBAS
// Start: Saturday, April 14, 2007
// IDE Version: 4.154


// Types
TYPE Tvector
    x
    y
    z
    magnitude
ENDTYPE


// Globals
FUNCTION foo:
GLOBAL PI = 3.1415926535
  GLOBAL cameraPosition AS Tvector
  GLOBAL cameraTarget AS Tvector
  GLOBAL cameraUpVector AS Tvector
  GLOBAL radius = 1
  GLOBAL moveDist = 1
  GLOBAL hRadians
GLOBAL vRadians
ENDFUNCTION

//Functions
FUNCTION SetCamera: cPosition AS Tvector, h ,v
    hRadians = h
    vRadians = v
ENDFUNCTION
The above program does nothing but illustrate how I can not modularise types, globals and functions in the one file. I need this to post some stuff on the forums or use code between programs.
#2560
OK, Ill try and cut the code down and still show the error. As Arnold would say "I'll be Back!" :P
#2561
Im having a lot of trouble keeping my code in separate modules (files) together with there variables.

My library code is almost always the same.

Types
Global Variables
SubRoutines

I keep getting "TYPE  is not declared", Ive tried putting the variables in a function and calling it from the main program but Im still getting this error.

I mainly get this error if I try and read (from the main program)  a globally declared variable from a library

Any ideas?
#2562
GLBasic - en / Camera Vector
2007-Apr-15
Put a halt to this approach, saw a nice article on polar co-ordinates, Ill give that a bash instead ;)
#2563
GLBasic - en / Camera Vector
2007-Apr-14
Yes, that's the problem, the camera vector seems to be based on a fixed set of axis and its not relative to the current camera vector... hmmm, knowing the problem does not help with the solution though. :(
#2564
GLBasic - en / Camera Vector
2007-Apr-14
Hmm, looking at it, It looks like the camera axis is rotating on a fixed axis, as opposed to an already rotated one (camera already moved...)... this is all very confusing, hehe :P
#2565
GLBasic - en / Camera Vector
2007-Apr-14
No luck Gernot.

Heres a little test program to illustrate the problem...

Code (glbasic) Select
// --------------------------------- //
// Project: particles_test (800x600 res.)
// Start: Saturday, April 14, 2007
// IDE Version: 4.154

TYPE Tvector
x
y
z
magnitude
ENDTYPE

GLOBAL cam_pos AS Tvector; cam_pos.x = 0; cam_pos.y = 0; cam_pos.z = 0
GLOBAL cam_vec AS Tvector; cam_vec.x = 0; cam_vec.y = 0; cam_vec.z = 0.1

WHILE TRUE
  X_MAKE3D 1,5500,45

  MOUSESTATE mx, my, b1, b2
// mx = MOD(GETTIMERALL()/10,3600) // Unremark these 1 at a time, to see the problem more clearly
// my = MOD(GETTIMERALL()/10,3600) // Look out for camera axis flipping at Y 0 or 180

  cam_vec.x = 0; cam_vec.y = 0; cam_vec.z = -1
mx=(mx/800)*3600
my=(my/600)*3600
cam_vec = Vector_RotateAroundY(cam_vec, mx/10)
  cam_vec = Vector_RotateAroundX(cam_vec, my/10)
 
    X_CAMERAUP 0,1,0
    X_CAMERA cam_pos.x, cam_pos.y, cam_pos.z, cam_vec.x, cam_vec.y, cam_vec.z

    X_DRAWAXES 100,0,0
    X_DRAWAXES -100,0,0
    X_DRAWAXES 0,100,0
    X_DRAWAXES 0,-100,0
    X_DRAWAXES 0,0,100
    X_DRAWAXES 0,0,-100
    X_PRINT "Right X+",100,0,0,0.3
    X_PRINT "Left X-",-100,0,0,0.3
    X_PRINT "Up Y+",0,100,0,0.3
    X_PRINT "Down Y-",0,-100,0,0.3
    X_PRINT "Out Z+",0,0,100,0.3
    X_PRINT "In Z-",0,0,-100,0.3
   
X_MAKE2D
PRINT "CX: "+cam_vec.x,10,20
PRINT "CY: "+cam_vec.y,10,30
PRINT "CZ: "+cam_vec.z,10,40
PRINT "MX: "+mx/10,10,50
PRINT "MY: "+my/10,10,60
  SHOWSCREEN
WEND


FUNCTION Vector_RotateAroundX AS Tvector: vec1 AS Tvector, angle
LOCAL result AS Tvector
result.x = vec1.x
result.y = COS(angle) * vec1.y - SIN(angle) * vec1.z
result.z = SIN(angle) * vec1.y + COS(angle) * vec1.z
RETURN result
ENDFUNCTION

FUNCTION Vector_RotateAroundY AS Tvector: vec1 AS Tvector, angle
LOCAL result AS Tvector
result.x  = COS(angle) * vec1.x + SIN(angle) * vec1.z
result.y = vec1.y
result.z = -SIN(angle) * vec1.x + COS(angle) * vec1.z
RETURN result
ENDFUNCTION

FUNCTION Vector_RotateAroundZ AS Tvector: vec1 AS Tvector, angle
LOCAL result AS Tvector
result.x = COS(angle) * vec1.x - SIN(angle) * vec1.y
result.y = SIN(angle) * vec1.x + COS(angle) * vec1.y
result.z = vec1.z
RETURN result
ENDFUNCTION