Author Topic: Introducin' Meself  (Read 3904 times)

Offline Yodaman Jer

  • Mc. Print
  • *
  • Posts: 47
  • Codin' the Day Away!
    • View Profile
Introducin' Meself
« on: 2011-Sep-24 »
Hi everybody!

I just discovered GLBasic last night, and I must say that I'm very, very impressed by it!  I looked through all of the samples on the website and the Sphere Mapping one is what got me convinced to try this thing out. 

I'm not new to programming, I was previously using DarkBASIC for my game programming (and that was a nightmare on Windows 7), and I was just looking into Blitz3D when someone told me about GLBasic.  So glad I checked it out!

Has anyone made 3D games with it run on Linux, specifically Ubuntu?  If I can program my 3D game to run on Windows, Mac and Linux (and so far it looks like I can most definitely do that), I will be the happiest geek on earth! :D

Click the pic to go to my development blog!

Offline ampos

  • Prof. Inline
  • *****
  • Posts: 1594
    • View Profile
    • AMpostata Website
Re: Introducin' Meself
« Reply #1 on: 2011-Sep-24 »
...and iPhone, HP/Palm WebOS, Android, Caanoo, WinCE, GP2X, Pandora,... sure I miss more.

The same source can do all this.
check my web and/or my blog :D
http://diniplay.blogspot.com (devblog)
http://www.ampostata.org
http://ampostata.blogspot.com
I own PC-Win, MacBook 13", iPhone 3G/3GS/4G and iPAC-WinCE

MrTAToad

  • Guest
Re: Introducin' Meself
« Reply #2 on: 2011-Sep-25 »
I've got a 3D game up and running, but I never bothered compiling it for Linux :)

Offline Moru

  • Administrator
  • Prof. Inline
  • *******
  • Posts: 1774
    • View Profile
    • Homepage
Re: Introducin' Meself
« Reply #3 on: 2011-Sep-25 »
Long time ago I did some 3D test and it worked just fine in Ubuntu too.

Offline Yodaman Jer

  • Mc. Print
  • *
  • Posts: 47
  • Codin' the Day Away!
    • View Profile
Re: Introducin' Meself
« Reply #4 on: 2011-Sep-25 »
Nice. :)


Can anyone link me to some decent 3D tutorials?  I'd like to see how to use the shaders in particular, and some of the collision detection commands in action, although I won't be able to run it since I don't have the premium version. :P
Click the pic to go to my development blog!

Offline Falstaff

  • Mr. Polyvector
  • ***
  • Posts: 148
    • View Profile
Re: Introducin' Meself
« Reply #5 on: 2011-Sep-25 »
Welcome aboard :)

I'm new to GLB as well, just found out about it a little over a month ago.. Really glad I did though! Started working on a simple match-3 game with an artist friend of mine and we've already made tons of progress. Aside from a few minor gotcha's with the editor, and some Android compatibility concerns with key graphics commands (ie CREATESCREEN and/or I've heard tales of STRETCHSPRITE woes..), I've been very happy with my work in GLB.

Guess that means I can't help much with your 3d questions, sorry..not yet! But I just thought I'd say hi ;)


Offline Ian Price

  • Administrator
  • Prof. Inline
  • *******
  • Posts: 4144
  • On the shoulders of giants.
    • View Profile
    • My Apps
Re: Introducin' Meself
« Reply #6 on: 2011-Sep-25 »
I'm working on a Match3 game too, though for TouchPad :)
I came. I saw. I played.

Offline caffeinekid

  • Mr. Drawsprite
  • **
  • Posts: 53
    • View Profile
    • TCKSOFT
Re: Introducin' Meself
« Reply #7 on: 2011-Sep-25 »
I'm working on my first GLB game at the moment too, just getting used to some bits of the language and making something simple. I hope you enjoy your GLB journey. :)

Offline Ian Price

  • Administrator
  • Prof. Inline
  • *******
  • Posts: 4144
  • On the shoulders of giants.
    • View Profile
    • My Apps
Re: Introducin' Meself
« Reply #8 on: 2011-Sep-25 »
Wasn't Blitz your first GLB game Caff? Is it not finished? Any chance of seeing a pc version at some point?
I came. I saw. I played.

Offline bigsofty

  • Community Developer
  • Prof. Inline
  • ******
  • Posts: 2613
    • View Profile
Re: Introducin' Meself
« Reply #9 on: 2011-Sep-26 »
Welcome!  :good:
Cheers,

Ian.

“It is practically impossible to teach good programming style to students that have had prior exposure to BASIC.  As potential programmers, they are mentally mutilated beyond hope of regeneration.”
(E. W. Dijkstra)

Offline Slydog

  • Prof. Inline
  • *****
  • Posts: 930
  • KodeSource
    • View Profile
    • KodeSource
Re: Introducin' Meself
« Reply #10 on: 2011-Sep-26 »
I can't remember seeing a tutorial on Shaders, but the following seems to work in GLB.
I haven't used it in a while, mainly because it didn't work on my iPhone (3GS), and didn't want to investigate any further!
(I think I've since found out that GLB only uses OpenGL 1.1?  Is that only on iOS?  Or am i wrong?)

Here's my Shader code in GLB:
Code: GLBasic [Select]
CONSTANT FP_SHADER$ = "Graphics/Shaders/"
CONSTANT SHADER_COLOUR% = 9

FUNCTION ShaderColour%: colour%
        STATIC init%, ok%
        LOCAL r#, g#, b#

        IF init <> TRUE
                init = TRUE
                ok = ShaderLoad(SHADER_COLOUR, "Color")
        ENDIF
        IF NOT ok THEN RETURN

        r = BAND(colour,           0xff) / 255.0
        g = BAND(colour / 0x100,   0xff) / 255.0
        b = BAND(colour / 0x10000, 0xff) / 255.0

        X_SETSHADER SHADER_COLOUR
        X_PUTSHADER "r", r
        X_PUTSHADER "g", g
        X_PUTSHADER "b", b

        RETURN
ENDFUNCTION

FUNCTION ShaderLoad%: index%, fn$
        LOCAL ok%
        DEBUG ">GFX:{ShaderLoad      } fn:[" + GETCURRENTDIR$() + FP_SHADER$ + fn$ + "]\n"
        ok = X_LOADSHADER(index, FP_SHADER$ + fn$ + ".vert", FP_SHADER$ + fn$ + ".frag")
        IF NOT ok THEN DEBUG ">{Gfx ShaderLoad  } *** Error Loading:[" + FP_SHADER$ + fn$ + "]\n"
        RETURN ok
ENDFUNCTION

And here are the Shader files:
'Color.vert'
Code: GLBasic [Select]
float FogEyeRadial(vec4 Rh) {
        vec4 Re = Rh / Rh.w;
        return length(Re);
}

void main(void) {
        gl_FogFragCoord = FogEyeRadial(gl_ModelViewMatrix * gl_Vertex);
        gl_Position = ftransform();
        gl_TexCoord[0] = gl_MultiTexCoord0;
}

'Color.frag'
Code: GLBasic [Select]
uniform sampler2D TextureID1;
uniform float r;
uniform float g;
uniform float b;

void main (void) {
        vec4 color = vec4(r, g, b, 0.5);
        gl_FragColor = texture2D(TextureID1,  gl_TexCoord[0].xy) + color;
        gl_FragColor = mix(gl_Fog.color, gl_FragColor, clamp((gl_Fog.end - gl_FogFragCoord) * gl_Fog.scale / 5.0, 0.1, 1.0));
}
 

By looking at the shader files, I think this shader takes in three values, r, g, b, and shades the pixels by that colour.
And it appears to apply the fog settings to the affected pixels too.
This was my first shader, so there are maybe better or simpler ways to do this, but was just a proof of concept to see if I can get shaders to work.  I took bits and pieces from other people's shaders to get this far!

To use it, just call the 'ShaderColour(RGB(255,0,0))' function passing it a colour you want applied.
It also loads the required shader files if they haven't already been loaded.
Finally it sets the shader and passes it the three required colour parts.
My current project (WIP) :: TwistedMaze <<  [Updated: 2015-11-25]

Offline Yodaman Jer

  • Mc. Print
  • *
  • Posts: 47
  • Codin' the Day Away!
    • View Profile
Re: Introducin' Meself
« Reply #11 on: 2011-Sep-26 »
Thanks, Slydog! That will come in handy once I have the full version.  :good:
Click the pic to go to my development blog!

Offline Yodaman Jer

  • Mc. Print
  • *
  • Posts: 47
  • Codin' the Day Away!
    • View Profile
Re: Introducin' Meself
« Reply #12 on: 2011-Sep-27 »
Hmm... I seem to run into a couple of slight issues and I was just wondering if you guys might know why this is happening?

Every time I try to run one of the 2D demos (3D works fine for some reason), I get a "variable is not explicitly defined" error unless I go back and preface all of the variables with either "GLOBAL" or LOCAL" before the main loop. Is the demo version of GLB the cause, or do I just have to make sure to preface all of my variables in the future with GLOBAL/LOCAL? In which case, running the 2D demos are a hassle because I don't want to modify the file contents of a demo. :P
Click the pic to go to my development blog!

Offline Kitty Hello

  • code monkey
  • Administrator
  • Prof. Inline
  • *******
  • Posts: 10697
  • here on my island the sea says 'hello'
    • View Profile
    • http://www.glbasic.com
Re: Introducin' Meself
« Reply #13 on: 2011-Sep-27 »
That's from old project settings. Please use menu "Project/settings" and diable the checkbox "explicit declarations". (That was from pre V8 projects I think).

Offline Yodaman Jer

  • Mc. Print
  • *
  • Posts: 47
  • Codin' the Day Away!
    • View Profile
Re: Introducin' Meself
« Reply #14 on: 2011-Sep-27 »
Thanks! That did the trick. :)
Click the pic to go to my development blog!