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 - matty47

#31
Hi,
sorry if I am hassling but has anyone got an idea if the inline does not work for osx?
Thanks greatly
Matthew
#32
Thanks , sorry for posting on the wrong forum. Clicked the wrong one  :noggin:
Matthew
#33
Hi, can anyone tell me what are the required frameworks on os x to run glbasic apps? I tried running an executable and found that it required SDL. I installed the SDL.Framework in my home directory and next time apparently libpng was needed. To save trial and error can anyone tell me what I need to install
Thanks greatly for any help you can give.
Matthew
#34
OK. Did a bit more testing and I think that the error is being generated by some Inline code included by someone to change the falloff of the light.
First bit
Code (glbasic) Select

INLINE
    };// namespace
    extern "C" void __stdcall glLightf(int, int, float);
    namespace __GLBASIC__ {
ENDINLINE

followed a bit later by
Code (glbasic) Select

IF o.constant > 0 OR o.linear > 0 OR o.quadratic > 0
INLINE
    #define GL_LIGHT0 0x4000
    #define GL_CONSTANT_ATTENUATION 0x1207
    #define GL_LINEAR_ATTENUATION             0x1208
    #define GL_QUADRATIC_ATTENUATION          0x1209
    glLightf(GL_LIGHT0+iLight, GL_CONSTANT_ATTENUATION,  o.constant);
    glLightf(GL_LIGHT0+iLight, GL_LINEAR_ATTENUATION, o.linear);
    glLightf(GL_LIGHT0+iLight, GL_QUADRATIC_ATTENUATION, o.quadratic);
ENDINLINE
ENDIF

If I comment out these sections the code compiles and links without errors although I have not tried the application on a mac yet.
Is Inline broken on the osx compiler? as the code compiled and executed ok when making a windows app.
Hope this is of some help
Thanks
Matthew
#35
Hi Gernot, I did some further testing. Other programs including 3d ones seem to compile OK however anything using the Entity code from the snippets forum produces the same error. The code for the Entity system is on the forum. I tried using the one straight from the forum. Made a project, added the Entity code file and main program was just [ DEBUG "Testing"]. Code failed to link with the errors above.
Thanks
Matthew
#36
I tried compiling a program using entity lib for osx ppc and got the following error
Code (glbasic) Select

*** Configuration: OS-X_UNI ***
precompiling:
GPC - GLBasic Precompiler V.2008.093 - 3D, NET
Wordcount:332 commands

compile+link:
/cygdrive/c/Program Files/GLBasic/Compiler/platform/Mac/Bin/../libexec/gcc/powerpc-apple-darwin8/4.0.1/ld: multiple definitions of symbol _glAttachObjectARB
/cygdrive/C/Program Files/GLBasic/Compiler/platform/Mac/SDKs/MacOSX10.4u.sdk/System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib(gll_api.o) definition of _glAttachObjectARB
/cygdrive/C/Program Files/GLBasic/Compiler/platform/Mac/OSX/Lib/libGLBasicUni.a(OpenGLRainbows.o) definition of _glAttachObjectARB in section (__DATA,__data)
/cygdrive/c/Program Files/GLBasic/Compiler/platform/Mac/Bin/../libexec/gcc/powerpc-apple-darwin8/4.0.1/ld: multiple definitions of symbol _glCompileShaderARB
/cygdrive/C/Program Files/GLBasic/Compiler/platform/Mac/SDKs/MacOSX10.4u.sdk/System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib(gll_api.o) definition of _glCompileShaderARB
/cygdrive/C/Program Files/GLBasic/Compiler/platform/Mac/OSX/Lib/libGLBasicUni.a(OpenGLRainbows.o) definition of _glCompileShaderARB in section (__DATA,__data)
/cygdrive/c/Program Files/GLBasic/Compiler/platform/Mac/Bin/../libexec/gcc/powerpc-apple-darwin8/4.0.1/ld: multiple definitions of symbol _glCreateProgramObjectARB
/cygdrive/C/Program Files/GLBasic/Compiler/platform/Mac/SDKs/MacOSX10.4u.sdk/System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib(gll_api.o) definition of _glCreateProgramObjectARB
/cygdrive/C/Program Files/GLBasic/Compiler/platform/Mac/OSX/Lib/libGLBasicUni.a(OpenGLRainbows.o) definition of _glCreateProgramObjectARB in section (__DATA,__data)
/cygdrive/c/Program Files/GLBasic/Compiler/platform/Mac/Bin/../libexec/gcc/powerpc-apple-darwin8/4.0.1/ld: multiple definitions of symbol _glCreateShaderObjectARB
/cygdrive/C/Program Files/GLBasic/Compiler/platform/Mac/SDKs/MacOSX10.4u.sdk/System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib(gll_api.o) definition of _glCreateShaderObjectARB
/cygdrive/C/Program Files/GLBasic/Compiler/platform/Mac/OSX/Lib/libGLBasicUni.a(OpenGLRainbows.o) definition of _glCreateShaderObjectARB in section (__DATA,__data)
/cygdrive/c/Program Files/GLBasic/Compiler/platform/Mac/Bin/../libexec/gcc/powerpc-apple-darwin8/4.0.1/ld: multiple definitions of symbol _glDeleteObjectARB
/cygdrive/C/Program Files/GLBasic/Compiler/platform/Mac/SDKs/MacOSX10.4u.sdk/System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib(gll_api.o) definition of _glDeleteObjectARB
/cygdrive/C/Program Files/GLBasic/Compiler/platform/Mac/OSX/Lib/libGLBasicUni.a(OpenGLRainbows.o) definition of _glDeleteObjectARB in section (__DATA,__data)
/cygdrive/c/Program Files/GLBasic/Compiler/platform/Mac/Bin/../libexec/gcc/powerpc-apple-darwin8/4.0.1/ld: multiple definitions of symbol _glGetBufferParameterivARB
/cygdrive/C/Program Files/GLBasic/Compiler/platform/Mac/SDKs/MacOSX10.4u.sdk/System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib(gll_api.o) definition of _glGetBufferParameterivARB
/cygdrive/C/Program Files/GLBasic/Compiler/platform/Mac/OSX/Lib/libGLBasicUni.a(OpenGLRainbows.o) definition of _glGetBufferParameterivARB in section (__DATA,__data)
/cygdrive/c/Program Files/GLBasic/Compiler/platform/Mac/Bin/../libexec/gcc/powerpc-apple-darwin8/4.0.1/ld: multiple definitions of symbol _glGetInfoLogARB
/cygdrive/C/Program Files/GLBasic/Compiler/platform/Mac/SDKs/MacOSX10.4u.sdk/System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib(gll_api.o) definition of _glGetInfoLogARB
/cygdrive/C/Program Files/GLBasic/Compiler/platform/Mac/OSX/Lib/libGLBasicUni.a(OpenGLRainbows.o) definition of _glGetInfoLogARB in section (__DATA,__data)
/cygdrive/c/Program Files/GLBasic/Compiler/platform/Mac/Bin/../libexec/gcc/powerpc-apple-darwin8/4.0.1/ld: multiple definitions of symbol _glGetObjectParameterivARB
/cygdrive/C/Program Files/GLBasic/Compiler/platform/Mac/SDKs/MacOSX10.4u.sdk/System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib(gll_api.o) definition of _glGetObjectParameterivARB
/cygdrive/C/Program Files/GLBasic/Compiler/platform/Mac/OSX/Lib/libGLBasicUni.a(OpenGLRainbows.o) definition of _glGetObjectParameterivARB in section (__DATA,__data)
/cygdrive/c/Program Files/GLBasic/Compiler/platform/Mac/Bin/../libexec/gcc/powerpc-apple-darwin8/4.0.1/ld: multiple definitions of symbol _glGetUniformLocationARB
/cygdrive/C/Program Files/GLBasic/Compiler/platform/Mac/SDKs/MacOSX10.4u.sdk/System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib(gll_api.o) definition of _glGetUniformLocationARB
/cygdrive/C/Program Files/GLBasic/Compiler/platform/Mac/OSX/Lib/libGLBasicUni.a(OpenGLRainbows.o) definition of _glGetUniformLocationARB in section (__DATA,__data)
/cygdrive/c/Program Files/GLBasic/Compiler/platform/Mac/Bin/../libexec/gcc/powerpc-apple-darwin8/4.0.1/ld: multiple definitions of symbol _glLinkProgramARB
/cygdrive/C/Program Files/GLBasic/Compiler/platform/Mac/SDKs/MacOSX10.4u.sdk/System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib(gll_api.o) definition of _glLinkProgramARB
/cygdrive/C/Program Files/GLBasic/Compiler/platform/Mac/OSX/Lib/libGLBasicUni.a(OpenGLRainbows.o) definition of _glLinkProgramARB in section (__DATA,__data)
/cygdrive/c/Program Files/GLBasic/Compiler/platform/Mac/Bin/../libexec/gcc/powerpc-apple-darwin8/4.0.1/ld: multiple definitions of symbol _glShaderSourceARB
/cygdrive/C/Program Files/GLBasic/Compiler/platform/Mac/SDKs/MacOSX10.4u.sdk/System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib(gll_api.o) definition of _glShaderSourceARB
/cygdrive/C/Program Files/GLBasic/Compiler/platform/Mac/OSX/Lib/libGLBasicUni.a(OpenGLRainbows.o) definition of _glShaderSourceARB in section (__DATA,__data)
/cygdrive/c/Program Files/GLBasic/Compiler/platform/Mac/Bin/../libexec/gcc/powerpc-apple-darwin8/4.0.1/ld: multiple definitions of symbol _glUniform1fARB
/cygdrive/C/Program Files/GLBasic/Compiler/platform/Mac/SDKs/MacOSX10.4u.sdk/System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib(gll_api.o) definition of _glUniform1fARB
/cygdrive/C/Program Files/GLBasic/Compiler/platform/Mac/OSX/Lib/libGLBasicUni.a(OpenGLRainbows.o) definition of _glUniform1fARB in section (__DATA,__data)
/cygdrive/c/Program Files/GLBasic/Compiler/platform/Mac/Bin/../libexec/gcc/powerpc-apple-darwin8/4.0.1/ld: multiple definitions of symbol _glUniform1iARB
/cygdrive/C/Program Files/GLBasic/Compiler/platform/Mac/SDKs/MacOSX10.4u.sdk/System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib(gll_api.o) definition of _glUniform1iARB
/cygdrive/C/Program Files/GLBasic/Compiler/platform/Mac/OSX/Lib/libGLBasicUni.a(OpenGLRainbows.o) definition of _glUniform1iARB in section (__DATA,__data)
/cygdrive/c/Program Files/GLBasic/Compiler/platform/Mac/Bin/../libexec/gcc/powerpc-apple-darwin8/4.0.1/ld: multiple definitions of symbol _glUseProgramObjectARB
/cygdrive/C/Program Files/GLBasic/Compiler/platform/Mac/SDKs/MacOSX10.4u.sdk/System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib(gll_api.o) definition of _glUseProgramObjectARB
/cygdrive/C/Program Files/GLBasic/Compiler/platform/Mac/OSX/Lib/libGLBasicUni.a(OpenGLRainbows.o) definition of _glUseProgramObjectARB in section (__DATA,__data)
collect2: ld returned 1 exit status
*** FATAL ERROR - Please post this output in the forum

Any idea??
THanks
Matthew
#37
Thanks mighty quick answer. Sort of fixed it I need to play with it some more.
Matthew
#38
Hi, I have been playing with the Entity System code but am having trouble with the light direction. The lights are drawn in the following code
Code (glbasic) Select
X_SPOT_LT iLight, o.color, o.Mg[12], o.Mg[13], o.Mg[14], _
o.Mg[12]+o.Mg[0], o.Mg[13]+o.Mg[1], o.Mg[14]+o.Mg[2], o.cutoff

and I know that the first three entries on the second line are supposed to give the vector of the light direction. Note that I have added a new field to the entity type (cutoff) with a couple of functions tha allow me to change the cutoff angle of the spotlight. My problem is that if I set the cutoff to say 45 to make a regular spotlight and then do an entity rotate in the main loop the light doesn't seem to rotate. I suspect this line as the camera uses the same code but with the camera you are specifying the point to which the camera is pointed whereas with the light I believe you are specifying a vector from the light (not a point). Before I go off writing separate light routines can anyone tell me the correct entries for the vector - or have I missed something again.
Thanks for any help
Matthew
#39
A few functions to extract the component values of a 32 colour and an example of how to use them. I have adapted the example code from a DarkbasicPro tutorial so if you feel this infringes any copyright please remove. Hopefully the code is commented enough to work out. You will need a 200 x 200 pixel image with a spectrum of colours for the sprite.
Code (glbasic) Select
// --------------------------------- //
// Project: RGB_Tute2
// Start: Thursday, February 28, 2008
// IDE Version: 5.179
//load our image
LOADSPRITE "rgb.png",1
//drawing to 2d screen
X_MAKE2D
//draw our base picture
DRAWSPRITE 1,0,0
LOCAL x=190
LOCAL y=190
LOCAL col,tx,ty,r,g,b,timer,TimeTaken
GLOBAL blue,green,red,alph
timer=GETTIMERALL()
FOR ty=0 TO y
FOR tx=0 TO x
col=GETPIXEL(tx,ty) //get the colour at tx,ty
//now split the colour into its components
r=rgbr(col)
g=rgbg(col)
b=rgbb(col)

//now use these to draw 3 images
SETPIXEL tx+200,ty,RGB(r,0,0)
SETPIXEL tx+400,ty,RGB(0,g,0)
SETPIXEL tx+600,ty,RGB(0,0,b)

//now draw another 3
SETPIXEL tx+200,ty+200,RGB(r,g,0)
SETPIXEL tx+400,ty+200,RGB(r,0,b)
SETPIXEL tx+600,ty+200,RGB(0,g,b)

//and finally another three
SETPIXEL tx+200,ty+400,RGB(r*2,g*2,b*2)
SETPIXEL tx+400,ty+400,RGB(r-tx,tx,b-tx)
SETPIXEL tx+600,ty+400,RGB(150,g/2,b/2)


NEXT
NEXT
TimeTaken=GETTIMERALL()-timer
PRINT "Time Taken = "+TimeTaken,10,550
SHOWSCREEN
KEYWAIT
END


//*************************************
//Function rgbr(col) - return the red component of a 32 bit colour
//*************************************
FUNCTION rgbr: col
red=bAND(col,0xff)
RETURN red
ENDFUNCTION
//*************************************
//Function rgbg(col) - return the green component of a  32 bit colour
//*************************************
FUNCTION rgbg: col
green=bAND(col/0x100,0xff)
RETURN green
ENDFUNCTION
//*************************************
//Function rgbb(col) - return the blue component of a  32 bit colour
//*************************************
FUNCTION rgbb: col
blue=bAND(col/0x10000,0xff)
RETURN blue
ENDFUNCTION
//*************************************
//Function rgba(col) - return the alpha component of a  32 bit colour
//*************************************
FUNCTION rgba: col
alph=bAND(col/0x1000000,0xff)
RETURN alph
ENDFUNCTION
The image I used had that transparent colour (pink) in it so the effect was a bit marred. (Is there a way to turn off the pink transparency??) You need to set the resolutuin to at least 800x600
I tested the speed in both DarkBasic Pro and GLBasic. - DBP 11.44secs, GLB - 1.84secs.
Hope this may be useful
M
#40
Thanks I will try this. As I said I probably missed something.
Thanks for your patience
#41
Bump??
#42
GLBasic supports the Newton phycis library and there is an include file and a few examples in the package.
#43
I just tried that. It has made a difference. There is now a difference in turning the light on and off. I have tried varying the cutoff and the distance from the plane and the lighting does not seem tovary smoothly but rather "jumps" between finite states. Eg leave the light at its start point and vary the cutoff. You will see what I mean. Similarly leave the cutoff at the start value and move the light toward the plane. For me the light switshes state when it is closer to the plane than the camera. I was expecting (hopong) that the cutoff would show a shrinking ring of illumination . Sorry to be a pain.
#44
I am not working with shadows at the moment. I just don't know if the lights are working in 3D. I have made two small examples. The first just draws a plane and puts the camera 10 units away from it. No lighting commands. The plane shows in the 3d view when the program is run.
Code (glbasic) Select
// --------------------------------- //
// Project: lights2
// Start: Sunday, February 17, 2008
// IDE Version: 5.173

//create a plane to catch the light
MakePlane(1)

//Main loop
WHILE TRUE

X_MAKE3D 0.1,500,90
X_CAMERA 0,0,15,0,0,0
X_DRAWOBJ 1,0

SHOWSCREEN
WEND




FUNCTION MakePlane:pn
X_OBJSTART pn
X_OBJADDVERTEX -10,-10,0,0,1,RGB(128,128,128)
X_OBJADDVERTEX -10,10,0,0,0,RGB(128,128,128)
X_OBJADDVERTEX 10,10,0,1,0,RGB(128,128,128)
X_OBJADDVERTEX 10,-10,0,1,1,RGB(128,128,128)
X_OBJADDVERTEX -10,-10,0,0,1,RGB(128,128,128)
X_OBJEND
ENDFUNCTION
Now I add a spot light to the scene and you can turn it on and off, change the cutoff angle and move it forwards and back along the z axis. I can't see any difference here to the first program. So what is the light doing??
Code (glbasic) Select
// --------------------------------- //
// Project: Lights
// Start: Sunday, February 17, 2008
// IDE Version: 5.173
//create a plane to catch the light
MakePlane(1)
//create a varaible to alter the cutoff
LOCAL cutoff=90
//and one to hold the z value of the light
LOCAL lightz=20
//a toggle for the light
LOCAL On=1
LIMITFPS 12
//Main loop
WHILE TRUE

X_MAKE3D 0.1,500,90
X_CAMERA 0,0,15,0,0,0
X_DRAWOBJ 1,0
IF On =1 THEN X_SPOT_LT 0,RGB(255,255,255),0,0,lightz,0,0,-1,cutoff

IF KEY(45)=1 THEN On=ABS(On-1)
IF KEY(37)=1
cutoff=cutoff-1
IF cutoff<5 THEN cutoff=5
ENDIF
IF KEY(38)=1
cutoff=cutoff+1
IF cutoff>180 THEN cutoff=180
ENDIF
IF KEY(30)=1 THEN lightz=lightz-1
IF KEY(44)=1 THEN lightz=lightz+1

X_MAKE2D
PRINT "Use K and L to change the cutoff angle",0,10
PRINT "Use A and Z to move the light on the Z axis",0,20
PRINT "Use X to toggle the light on and off",0,30
PRINT "The light is pointing into the screen always",0,40
PRINT "On Value: "+On,0,80
PRINT "Cutoff Angle: "+cutoff,0,100
PRINT "Light at 0,0,"+lightz,0,120



SHOWSCREEN
WEND




FUNCTION MakePlane:pn
X_OBJSTART pn
X_OBJADDVERTEX -10,-10,0,0,1,RGB(128,128,128)
X_OBJADDVERTEX -10,10,0,0,0,RGB(128,128,128)
X_OBJADDVERTEX 10,10,0,1,0,RGB(128,128,128)
X_OBJADDVERTEX 10,-10,0,1,1,RGB(128,128,128)
X_OBJADDVERTEX -10,-10,0,0,1,RGB(128,128,128)
X_OBJEND
ENDFUNCTION
So my question really is - have I just missed out doing something or are the lights not working. Any help would be greatly appreciated
Matthew
#45
Anyone tried the example? I just don't seem to be able to understand how to set up the lights. I assumed that if there were no lights then you should be unable to see anything. Is this a wrong assumption?

Anyone?
Thanks
Matthew