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

#2596
This library shows a bug in the 'jumps' window of the IDE.

When a return type is defined in the function name "FUNCTION vector_add AS Tvector:" the jump window shows the function name as "Tvector"... so in the case of this library there are six jumps all called "Tvector"... the actual jump works fine though.
#2597
Announcements / Quantum
2007-Mar-29
Excellent, thank you Gernot. :)
#2598
Announcements / Quantum
2007-Mar-28
..\..\..\GeFr\Fun\DINGS\Samples\Common\qmath.gbas is missing, cant compile?
#2599
Could some kind soul add German language comments plz? :)

Code (glbasic) Select
// --------------------------------- //
// Project: VectorLIB
// Start: Wednesday, March 28, 2007
// IDE Version: 4.132


FUNCTION setup_veclib:
//used TO normalize vector
GLOBAL vector_tol = 0.0001
ENDFUNCTION

TYPE Tvector
x
y
z
magnitude
ENDTYPE

FUNCTION vector_calcMagnitude: vec AS Tvector
//calc the magnitude of a vector AND stor in vector
vec.magnitude=SQR(vec.x*vec.x + vec.y*vec.y + vec.z*vec.z)
ENDFUNCTION

FUNCTION vector_normalize: vec AS Tvector
    LOCAL m
//normalize a vector so it's length = 1 AND apply tolerance based on our constant tolerance value
m=SQR(SQR(vec.x*vec.x + vec.y*vec.y + vec.z*vec.z) )
IF m<= vector_tol THEN m=1
vec.x=vec.x/m
vec.y=vec.y/m
vec.z=vec.z/m
IF ABS(vec.x) IF ABS(vec.y) IF ABS(vec.z)ENDFUNCTION

FUNCTION vector_reverse: vec AS Tvector
//reverse a vector
vec.x=-vec.x
vec.y=-vec.y
vec.z=-vec.z
ENDFUNCTION

FUNCTION vector_add AS Tvector: vec1 AS Tvector, vec2 AS Tvector
//add two vectors together AND RETURN the resulting vector
LOCAL result AS Tvector
result.x=vec1.x+vec2.x
result.y=vec1.y+vec2.y
result.z=vec1.z+vec2.z
RETURN result
ENDFUNCTION

FUNCTION vector_subtract AS Tvector: vec1 AS Tvector, vec2 AS Tvector
//subtract vec1 from vec2 AND RETURN the resulting vector
LOCAL result AS Tvector
result.x=vec1.x-vec2.x
result.y=vec1.y-vec2.y
result.z=vec1.z-vec2.z
RETURN result
ENDFUNCTION

FUNCTION vector_scalarMultiply AS Tvector: vec1 AS Tvector, scale
//scalar multiplication of a vector with result returned AS new vector
//used TO scale a vector by 'scale'
LOCAL result AS Tvector
result.x=vec1.x*scale
result.y=vec1.y*scale
result.z=vec1.z*scale
RETURN result
ENDFUNCTION

FUNCTION vector_scalarDivision AS Tvector: vec1 AS Tvector, scale
//scalar division of a vector with result returned AS new vector
//used TO scale a vector
LOCAL result AS Tvector
result.x=vec1.x/scale
result.y=vec1.y/scale
result.z=vec1.z/scale
RETURN result
ENDFUNCTION

FUNCTION vector_conjugate AS Tvector: vec1 AS Tvector
//conjugate operator takes the negative of each vector component
//can be used when subtracting one vector from another OR FOR
//reversing the direction of a vector.
//applying conjugate is the same AS reversing a vector
//returns a new vector
LOCAL result AS Tvector
result.x=-vec1.x
result.y=-vec1.y
result.z=-vec1.z
RETURN result
ENDFUNCTION

FUNCTION vector_crossProduct AS Tvector: vec1 AS Tvector, vec2 AS Tvector
//takes vec1 AND vec2 AND returns the cross product vec1 X vec2
//the cross product is a vector perpendicular TO both vec1 AND vec2
//this is the normal of 2 vectors
LOCAL result AS Tvector
result.x=(vec1.y*vec2.z) - (vec1.z*vec2.y)
result.y=(vec1.z*vec2.x) - (vec1.x*vec2.z)
result.z=(vec1.x*vec2.y) - (vec1.y*vec2.x)
RETURN result
ENDFUNCTION

FUNCTION vector_dotProduct: vec1 AS Tvector, vec2 AS Tvector
//calculate AND RETURN the dot product of 2 vectors (distance)
LOCAL result
result=(vec1.x*vec2.x)+(vec1.y*vec2.y)+(vec1.z*vec2.z)
RETURN result
ENDFUNCTION

FUNCTION vector_tripleScalarProduct: vec1 AS Tvector, vec2 AS Tvector, vec3 AS Tvector
//calculate the triple scalar FUNCTION AND RETURN it
LOCAL result
result=           vec1.x * ( (vec2.y*vec3.z ) - (vec2.z * vec3.y) )
result=result + ( vec1.y * ( (-vec2.x*vec3.z) + (vec2.z * vec3.x) ) )
result=result + ( vec1.z * ( ( vec2.x*vec3.y) + (vec2.y * vec3.x) ) )
RETURN result
ENDFUNCTION
#2600
Code (glbasic) Select
// --------------------------------- //
// Project: VectorLIB
// Start: Wednesday, March 28, 2007
// IDE Version: 4.132


FUNCTION setup_veclib:
//used TO normalize vector
GLOBAL vector_tol = 0.0001
ENDFUNCTION

TYPE Tvector
x
y
z
magnitude
ENDTYPE

FUNCTION vector_calcMagnitude: vec AS Tvector
//calc the magnitude of a vector AND stor in vector
vec.magnitude=SQR(vec.x*vec.x + vec.y*vec.y + vec.z*vec.z)
ENDFUNCTION

FUNCTION vector_normalize: vec AS Tvector
    LOCAL m
//normalize a vector so it's length = 1 AND apply tolerance based on our constant tolerance value
m=SQR(SQR(vec.x*vec.x + vec.y*vec.y + vec.z*vec.z) )
IF m<= vector_tol THEN m=1
vec.x=vec.x/m
vec.y=vec.y/m
vec.z=vec.z/m
IF ABS(vec.x) IF ABS(vec.y) IF ABS(vec.z)ENDFUNCTION

FUNCTION vector_reverse: vec AS Tvector
//reverse a vector
vec.x=-vec.x
vec.y=-vec.y
vec.z=-vec.z
ENDFUNCTION

FUNCTION vector_add AS Tvector: vec1 AS Tvector, vec2 AS Tvector
//add two vectors together AND RETURN the resulting vector
LOCAL result AS Tvector
result.x=vec1.x+vec2.x
result.y=vec1.y+vec2.y
result.z=vec1.z+vec2.z
RETURN result
ENDFUNCTION

FUNCTION vector_subtract AS Tvector: vec1 AS Tvector, vec2 AS Tvector
//subtract vec1 from vec2 AND RETURN the resulting vector
LOCAL result AS Tvector
result.x=vec1.x-vec2.x
result.y=vec1.y-vec2.y
result.z=vec1.z-vec2.z
RETURN result
ENDFUNCTION

FUNCTION vector_scalarMultiply AS Tvector: vec1 AS Tvector, scale
//scalar multiplication of a vector with result returned AS new vector
//used TO scale a vector by 'scale'
LOCAL result AS Tvector
result.x=vec1.x*scale
result.y=vec1.y*scale
result.z=vec1.z*scale
RETURN result
ENDFUNCTION

FUNCTION vector_scalarDivision AS Tvector: vec1 AS Tvector, scale
//scalar division of a vector with result returned AS new vector
//used TO scale a vector
LOCAL result AS Tvector
result.x=vec1.x/scale
result.y=vec1.y/scale
result.z=vec1.z/scale
RETURN result
ENDFUNCTION

FUNCTION vector_conjugate AS Tvector: vec1 AS Tvector
//conjugate operator takes the negative of each vector component
//can be used when subtracting one vector from another OR FOR
//reversing the direction of a vector.
//applying conjugate is the same AS reversing a vector
//returns a new vector
LOCAL result AS Tvector
result.x=-vec1.x
result.y=-vec1.y
result.z=-vec1.z
RETURN result
ENDFUNCTION

FUNCTION vector_crossProduct AS Tvector: vec1 AS Tvector, vec2 AS Tvector
//takes vec1 AND vec2 AND returns the cross product vec1 X vec2
//the cross product is a vector perpendicular TO both vec1 AND vec2
//this is the normal of 2 vectors
LOCAL result AS Tvector
result.x=(vec1.y*vec2.z) - (vec1.z*vec2.y)
result.y=(vec1.z*vec2.x) - (vec1.x*vec2.z)
result.z=(vec1.x*vec2.y) - (vec1.y*vec2.x)
RETURN result
ENDFUNCTION

FUNCTION vector_dotProduct: vec1 AS Tvector, vec2 AS Tvector
//calculate AND RETURN the dot product of 2 vectors (distance)
LOCAL result
result=(vec1.x*vec2.x)+(vec1.y*vec2.y)+(vec1.z*vec2.z)
RETURN result
ENDFUNCTION

FUNCTION vector_tripleScalarProduct: vec1 AS Tvector, vec2 AS Tvector, vec3 AS Tvector
//calculate the triple scalar FUNCTION AND RETURN it
LOCAL result
result=           vec1.x * ( (vec2.y*vec3.z ) - (vec2.z * vec3.y) )
result=result + ( vec1.y * ( (-vec2.x*vec3.z) + (vec2.z * vec3.x) ) )
result=result + ( vec1.z * ( ( vec2.x*vec3.y) + (vec2.y * vec3.x) ) )
RETURN result
ENDFUNCTION
#2601
GLBasic - en / Type error?
2007-Mar-28
OK, that seemed to fix the compile... do I need to call the new function to initialise the Global Gernot?
#2602
GLBasic - en / Type error?
2007-Mar-28
OK, heres the code... this is a library, not a standalone program...

Code (glbasic) Select
// --------------------------------- //
// Project: VectorLIB
// Start: Wednesday, March 28, 2007
// IDE Version: 4.132

//used TO normalize vector
GLOBAL vector_tol = 0.0001

TYPE Tvector
x
y
z
magnitude
ENDTYPE

FUNCTION vector_calcMagnitude: vec AS Tvector
//calc the magnitude of a vector AND stor in vector
vec.magnitude=SQR(vec.x*vec.x + vec.y*vec.y + vec.z*vec.z)
ENDFUNCTION

FUNCTION vector_normalize: vec AS Tvector
    LOCAL m
//normalize a vector so it's length = 1 AND apply tolerance based on our constant tolerance value
m=SQR(SQR(vec.x*vec.x + vec.y*vec.y + vec.z*vec.z) )
IF m<= vector_tol THEN m=1
vec.x=vec.x/m
vec.y=vec.y/m
vec.z=vec.z/m
IF ABS(vec.x) IF ABS(vec.y) IF ABS(vec.z)ENDFUNCTION

FUNCTION vector_reverse: vec AS Tvector
//reverse a vector
vec.x=-vec.x
vec.y=-vec.y
vec.z=-vec.z
ENDFUNCTION

FUNCTION vector_add AS Tvector: vec1 AS Tvector, vec2 AS Tvector
//add two vectors together AND RETURN the resulting vector
LOCAL result AS Tvector
result.x=vec1.x+vec2.x
result.y=vec1.y+vec2.y
result.z=vec1.z+vec2.z
RETURN result
ENDFUNCTION

FUNCTION vector_subtract AS Tvector: vec1 AS Tvector, vec2 AS Tvector
//subtract vec1 from vec2 AND RETURN the resulting vector
LOCAL result AS Tvector
result.x=vec1.x-vec2.x
result.y=vec1.y-vec2.y
result.z=vec1.z-vec2.z
RETURN result
ENDFUNCTION

FUNCTION vector_scalarMultiply AS Tvector: vec1 AS Tvector, scale
//scalar multiplication of a vector with result returned AS new vector
//used TO scale a vector by 'scale'
LOCAL result AS Tvector
result.x=vec1.x*scale
result.y=vec1.y*scale
result.z=vec1.z*scale
RETURN result
ENDFUNCTION

FUNCTION vector_scalarDivision AS Tvector: vec1 AS Tvector, scale
//scalar division of a vector with result returned AS new vector
//used TO scale a vector
LOCAL result AS Tvector
result.x=vec1.x/scale
result.y=vec1.y/scale
result.z=vec1.z/scale
RETURN result
ENDFUNCTION

FUNCTION vector_conjugate AS Tvector: vec1 AS Tvector
//conjugate operator takes the negative of each vector component
//can be used when subtracting one vector from another OR FOR
//reversing the direction of a vector.
//applying conjugate is the same AS reversing a vector
//returns a new vector
LOCAL result AS Tvector
result.x=-vec1.x
result.y=-vec1.y
result.z=-vec1.z
RETURN result
ENDFUNCTION

FUNCTION vector_crossProduct AS Tvector: vec1 AS Tvector, vec2 AS Tvector
//takes vec1 AND vec2 AND returns the cross product vec1 X vec2
//the cross product is a vector perpendicular TO both vec1 AND vec2
//this is the normal of 2 vectors
LOCAL result AS Tvector
result.x=(vec1.y*vec2.z) - (vec1.z*vec2.y)
result.y=(vec1.z*vec2.x) - (vec1.x*vec2.z)
result.z=(vec1.x*vec2.y) - (vec1.y*vec2.x)
RETURN result
ENDFUNCTION

FUNCTION vector_dotProduct: vec1 AS Tvector, vec2 AS Tvector
//calculate AND RETURN the dot product of 2 vectors (distance)
LOCAL result
result=(vec1.x*vec2.x)+(vec1.y*vec2.y)+(vec1.z*vec2.z)
RETURN result
ENDFUNCTION

FUNCTION vector_tripleScalarProduct: vec1 AS Tvector, vec2 AS Tvector, vec3 AS Tvector
//calculate the triple scalar FUNCTION AND RETURN it
LOCAL result
result=           vec1.x * ( (vec2.y*vec3.z ) - (vec2.z * vec3.y) )
result=result + ( vec1.y * ( (-vec2.x*vec3.z) + (vec2.z * vec3.x) ) )
result=result + ( vec1.z * ( ( vec2.x*vec3.y) + (vec2.y * vec3.x) ) )
RETURN result
ENDFUNCTION
#2603
GLBasic - en / Type error?
2007-Mar-28
Using types as parameter and return values for a small function library and Im getting this error...

Code (glbasic) Select
_______________________________________
*** Configuration: WIN32 ***
precompiling:
GPC - GLBasic Precompiler V.2007.050 - 3D, NET

Wordcount:215 commands

compiling:
C:/DOCUME~1/Dad/LOCALS~1/Temp/glbasic/gpc_temp5.cpp:9: error: expected constructor, destructor, or type conversion before '=' token
C:/DOCUME~1/Dad/LOCALS~1/Temp/glbasic/gpc_temp5.cpp:9: error: expected `,' or `;' before '=' token
*** FATAL ERROR - Please post this output in the forum
_______________________________________
*** Finished ***
Time: 3.3 sec
Build: 0 succeeded
*** 1 FAILED ***
#2604
Code Snippets / OpenGL calls
2007-Mar-24
Just had a wee play with this... this is incredibly powerful for adding your own OpenGL features that GLBasic does not natively support...! :D
#2605
Nice. :)
#2606
Code Snippets / OpenGL calls
2007-Mar-24
Ah, I see. OK, not a biggie then, thank you Gernot.
#2607
Code Snippets / OpenGL calls
2007-Mar-24
:(

Code (glbasic) Select
_______________________________________
*** Configuration: WIN32 ***
precompiling:
GPC - GLBasic Precompiler V.2007.050 - 3D, NET
Wordcount:18 commands

compiling:
C:/DOCUME~1/Dad/LOCALS~1/Temp/glbasic/gpc_temp0.cpp: In function `DGInt __GLBASIC__::glbBuildTexture(DGInt, DGInt)':
C:/DOCUME~1/Dad/LOCALS~1/Temp/glbasic/gpc_temp0.cpp:221: error: expected primary-expression before "int"
C:/DOCUME~1/Dad/LOCALS~1/Temp/glbasic/gpc_temp0.cpp:221: error: `i' undeclared (first use this function)
C:/DOCUME~1/Dad/LOCALS~1/Temp/glbasic/gpc_temp0.cpp:221: error: (Each undeclared identifier is reported only once for each function it appears in.)
C:/DOCUME~1/Dad/LOCALS~1/Temp/glbasic/gpc_temp0.cpp:221: error: expected `;' before ')' token
C:/DOCUME~1/Dad/LOCALS~1/Temp/glbasic/gpc_temp0.cpp:239: error: `RETURN' undeclared (first use this function)
C:/DOCUME~1/Dad/LOCALS~1/Temp/glbasic/gpc_temp0.cpp:239: error: expected `;' before "TextureID"
*** FATAL ERROR - Please post this output in the forum
_______________________________________
*** Finished ***
Time: 0.8 sec
Build: 0 succeeded
*** 1 FAILED ***
When I try and compile the top demo?
#2608
Code Snippets / OpenGL calls
2007-Mar-23
Ah thank you, so any up to date OpenGL API Header will do?
#2609
Code Snippets / OpenGL calls
2007-Mar-23
#2610
Excellent! I'll give the Inline call a go... :)

And question one?