Introducin' Meself

Previous topic - Next topic

Yodaman Jer

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!

ampos

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

I've got a 3D game up and running, but I never bothered compiling it for Linux :)

Moru

Long time ago I did some 3D test and it worked just fine in Ubuntu too.

Yodaman Jer

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!

Falstaff

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 ;)


Ian Price

I'm working on a Match3 game too, though for TouchPad :)
I came. I saw. I played.

caffeinekid

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. :)

Ian Price

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.

bigsofty

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)

Slydog

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]

Yodaman Jer

Thanks, Slydog! That will come in handy once I have the full version.  :good:
Click the pic to go to my development blog!

Yodaman Jer

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!

Kitty Hello

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).

Yodaman Jer

Thanks! That did the trick. :)
Click the pic to go to my development blog!