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

Topics - Schranz0r

#21
Hi my friends,

i will share with you guys my litte 3D test with OpenGL in GLbasic.
It's just a start on how to use a "Camera" to move like in Minecraft (Creativemode).
I update the gl.gbas a bit to make it possible to use RenderLists in GLB, the only thing i add was:

Code (glbasic) Select

INLINE
} extern "C" { GLuint __stdcall glGenLists( GLuint range );; }; namespace __GLBASIC__{
ENDINLINE
FUNCTION glGenLists: range
INLINE
return OGL glGenLists(range);
ENDINLINE
ENDFUNCTION


RenderLists speed up the rendering by ->>>  :o  ... :D
It give you a good start on how to use OpenGL and on how to create objects!

Maybe it gives you a start for youre next game ( hope so ), let me know it!

if you have any questions, ask me.


Maybe i code some more features into it like a  OBJ loader, that was my next point on the list :D


EDIT: Fix the upload, now its working sry! 
#22
Hey my friends,

i have a question about OpenGL:
If i try to set a texture (100x100 pixel) to  GL_QUADS it works fine.
But if i try to draw only 1/4 of the texture (25x25 pixel) it doesen't work anymore...

If i try a texture in Power of Two it works fine.

My head begins to explode :D

texturecoords are:

0, 0
0.25, 0
0.25, 0.25
0, 0.25


any ideas?
#23
Hi,

this is a litte snippet on how to mousepick a cube from a array of cubes.
Some basic "Minecraft-Style"  picking.

TAGS(for the searchmaschine) :) :
mousepick, pick, picking, minecraft, 3D-picking, collisionray, ray

Code (glbasic) Select
// --------------------------------- //
// Project: Picktest
// Start: Monday, April 21, 2014
// IDE Version: 12.096



// use systempointer
SYSTEMPOINTER TRUE



GLOBAL array[]
REDIM array[3][3][3]

// normal Cube
CreateCube(1,1,RGB(0x00, 0xff, 0x00))

// debug cube ( RED )
CreateCube(2,1.01,RGB(0xff, 0x00, 0x00))


// fill up
FOR x = 0 TO 2
FOR y = 0 TO 2
FOR z = 0 TO 2

array[x][y][z] = 1

NEXT
NEXT
NEXT




WHILE TRUE
LOCAL mx,my,b1,b2
LOCAL wx1#,wy1#,wz1#, wx2#,wy2#,wz2# // screen2world variables
LOCAL cx%,cy%,cz% // collision-position in array
LOCAL closest_coll# = 100 // set max coll distance
LOCAL coll // collision variable
MOUSESTATE mx,my,b1,b2

// make the window 3D and set up the Cam, position of the cam doesen't matter
X_MAKE3D 1,1000,45
X_CAMERA 5,5,-5, 0.7,0,1.5

// 2 times screen2world, second is Z = 1 to set the direction !
X_SCREEN2WORLD mx,my,0, wx1, wy1, wz1
X_SCREEN2WORLD mx,my,1, wx2, wy2, wz2


FOR x = 0 TO 2
FOR y = 0 TO 2
FOR z = 0 TO 2

IF array[x][y][z]

// move cube and draw
X_MOVEMENT x, y, z
X_DRAWOBJ 1, 0

// check coll
coll = X_COLLISIONRAY(1,0, wx1,wy1,wz1, wx2,wy2,wz2) // shoot up the RAY
IF coll
IF closest_coll > coll  // is closest coll larger then coll then set as closest
closest_coll = coll

// save position in array
cx = x
cy = y
cz = z
ENDIF

ENDIF


ENDIF



NEXT
NEXT
NEXT

// draw the debugcube
IF closest_coll < 100
X_MOVEMENT cx, cy, cz
X_DRAWOBJ 2, 0
ENDIF


// some 2D stuff
X_MAKE2D

PRINT  "X: "+mx+" Y: "+my,10,10
PRINT closest_coll,10,20

SHOWSCREEN
WEND
END


// ------------------------------------------------------------- //
// -=#  CREATECUBE  #=-
// -= by KittyHello =-
// ------------------------------------------------------------- //
FUNCTION CreateCube: num, sz, col
// Diese Variablen sind als LOCAL definiert:
// num, sz,
X_AUTONORMALS 1 // For a cube, hard edges
sz=sz/2
X_OBJSTART num
// Front Face
X_OBJADDVERTEX  sz, -sz,  sz, 1, 0, col
X_OBJADDVERTEX -sz, -sz,  sz, 0, 0, col
X_OBJADDVERTEX  sz,  sz,  sz, 1, 1, col
X_OBJADDVERTEX -sz,  sz,  sz, 0, 1, col
X_OBJNEWGROUP
// Back Face
X_OBJADDVERTEX -sz,  sz, -sz, 1, 1, col
X_OBJADDVERTEX -sz, -sz, -sz, 1, 0, col
X_OBJADDVERTEX  sz,  sz, -sz, 0, 1, col
X_OBJADDVERTEX  sz, -sz, -sz, 0, 0, col
X_OBJNEWGROUP
// Top Face
X_OBJADDVERTEX -sz,  sz,  sz, 0, 0, col
X_OBJADDVERTEX -sz,  sz, -sz, 0, 1, col
X_OBJADDVERTEX  sz,  sz,  sz, 1, 0, col
X_OBJADDVERTEX  sz,  sz, -sz, 1, 1, col
X_OBJNEWGROUP
// Bottom Face
X_OBJADDVERTEX  sz, -sz, -sz, 0, 1, col
X_OBJADDVERTEX -sz, -sz, -sz, 1, 1, col
X_OBJADDVERTEX  sz, -sz,  sz, 0, 0, col
X_OBJADDVERTEX -sz, -sz,  sz, 1, 0, col
X_OBJNEWGROUP
// Right face
X_OBJADDVERTEX  sz,  sz, -sz, 1, 1, col
X_OBJADDVERTEX  sz, -sz, -sz, 1, 0, col
X_OBJADDVERTEX  sz,  sz,  sz, 0, 1, col
X_OBJADDVERTEX  sz, -sz,  sz, 0, 0, col
X_OBJNEWGROUP
// Left Face
X_OBJADDVERTEX -sz, -sz,  sz, 1, 0, col
X_OBJADDVERTEX -sz, -sz, -sz, 0, 0, col
X_OBJADDVERTEX -sz,  sz,  sz, 1, 1, col
X_OBJADDVERTEX -sz,  sz, -sz, 0, 1, col
X_OBJNEWGROUP
X_OBJEND

ENDFUNCTION // sz
#24
Hi folks,

this is a simple wrapper for SQLite (just the beginning), maybe someone can use/need it....
#25
Hi Gernot,


is it possible to initialize the CONSTANTS before the TYPES?
So that we can do this:

Code (glbasic) Select
CONSTANT MaxX = 12
CONSTANT MaxY = 14
CONSTANT MaxZ = 16

TYPE Whatever
    Map[MaxX][MaxY][MaxZ]
ENDTYPE
#26
Hi,

Anyone try to create a simple project directry with the gpc.exe?

I create a new project, named it Hello.gbap.


Code in it:

Code (glbasic) Select
WHILE TRUE

PRINT "Hello world",10,10

SHOWSCREEN
WEND
END


make a batchfile(StartConsole.bat) in the same directory from the project:
Code (batch) Select
cd /d %~dp0
cmd.exe



make another batch(hello.bat):
Code (batch) Select

"C:\Program Files (x86)\GLBasic_v11\Compiler\platform\gpc" -N "C:\Users\sliver\Documents\GLBasic\Hello\Hello.gbap" -O"test"  -D -X800 -Y600 -R60 -M0 -pWin32=1



console output is this:

Code (text) Select
C:\Users\sliver\Documents\GLBasic\Hello>"C:\Program Files (x86)\GLBasic_v11\Comp
iler\platform\gpc" -N "C:\Users\sliver\Documents\GLBasic\Hello\Hello.gbap" -O"te
st"  -D -X800 -Y600 -R60 -M0 -pWin32=1
GPC - GLBasic Precompiler V.9.921 SN:c5e0e24b - "C:\Users\sliver\Documents\GLBas
ic\Hello\Hello.gbap"(1) error : GPC0001 syntax error


:/
it's just to play with, but now i will see it running :D
#27
Pls post all possible bugs in a separate thread and let us link it here. If something is missing, just tell us. Thank you for your help.


Makro not work:
http://www.glbasic.com/forum/index.php?topic=9214.0

Sprite hole don't work:
http://www.glbasic.com/forum/index.php?topic=9213.0 [fixed. READ IT!]

Android - polygons rendered in wrong order and glDrawElements issue:
http://www.glbasic.com/forum/index.php?topic=9091.0 [fixed]

Android accelerometer issue:
http://www.glbasic.com/forum/index.php?topic=8824.0

project resolution 768x1024 gives 320x480 on iPhone4/iPod4:
http://www.glbasic.com/forum/index.php?topic=8847.0

REDIM + FOREACH:
http://www.glbasic.com/forum/index.php?topic=8862.0 [fixed]

Problems with Samples\_Projects_\native_gui\glb_GUI_Editor on Windows, cant compile it for Linux:
http://www.glbasic.com/forum/index.php?topic=8544.msg78869#msg78869

DEBUG mode with INLINE C/C++ code generates a compiler error on the ON_DEBUG function:
http://www.glbasic.com/forum/index.php?topic=9218.msg78912#msg78912 [demo code, please]

RETURN (Not existing type.member) -> debugger jumps to wrong line:
http://www.glbasic.com/forum/index.php?topic=9218.msg82470#msg82470

3D on Android: wrong camera viewport and Cullmode inversed:
http://www.glbasic.com/forum/index.php?topic=9521.0

CTRL+G at functions in types, also lights in 3D incorrect:
http://www.glbasic.com/forum/index.php?topic=9218.msg82478#msg82478

X_TEXTUREOFFSET not working properly with X_DRAWANIM:
http://www.glbasic.com/forum/index.php?topic=9218.msg81554#msg81554

GLB overrides XCode project in each compilation:
http://www.glbasic.com/forum/index.php?topic=9218.msg81831#msg81831

Problems with INLINE and function folding and copy+paste:
http://www.glbasic.com/forum/index.php?topic=9218.msg80697#msg80697

VSync not working for MacOX:
http://www.glbasic.com/forum/index.php?topic=9218.msg81170#msg81170

Numbers in project names get replaced by _ (underscore):
http://www.glbasic.com/forum/index.php?topic=9218.msg80219#msg80219

PLATFORMINFO$("LOCALE") wrong on many platforms:
http://www.glbasic.com/forum/index.php?topic=9218.msg79765#msg79765

GETDESKTOPSIZE wrong for HTML5:
http://www.glbasic.com/forum/index.php?topic=9218.msg79785#msg79785

Using wrong Default.png etc. on XCode:
http://www.glbasic.com/forum/index.php?topic=9218.msg82481#msg82481

Include correct icons for iOS7:
http://www.glbasic.com/forum/index.php?topic=9218.msg82498#msg82498

glb_code_sign.bat dosent work if glbasic is installed in the default folder:
http://www.glbasic.com/forum/index.php?topic=9218.msg82519#msg82519

USESCREEN+SPRITE2MEM bug, current offscreen gets unbound:
http://www.glbasic.com/forum/index.php?topic=9108.msg82763#msg82763

Sometimes compiling not the current project, but one that was opened before:
http://www.glbasic.com/forum/index.php?topic=9574.0

X_SPRITE not working on android:
http://www.glbasic.com/forum/index.php?topic=9218.msg83017#msg83017

HTML5 not compiling any more:
http://www.glbasic.com/forum/index.php?topic=9588.0

DRAWRECT bug and program quitting slowly, both on Raspberry Pi:
www.glbasic.com/forum/index.php?topic=8544.msg83362#msg83362
#28
Hi my friends,

let's chat together:


IRC-Link:
irc://irc.freenode.org/glbasic

Webchat:
http://webchat.freenode.net/?channels=glbasic
#29
So,
um ein bisschen Spaß ins Deutsche Forum zu bringen mache ich hier diesen Fred auf!
Was macht ihr heute noch so, also wo GOTO ihr heute nich hin:)

Also bei mir schauts so aus:
(Reihenfolge absichtlich durcheinander, ist ja GOTO ;D )

Code (glbasic) Select

GOTO Home

Kuehlschrank:
IF Bier_im_Sack > 0 THEN Stelle_Bier_In_Den_Kuehlschrank = 1
IF kuehlschrank = TRUE AND Bier > 0
   GOTO Sofa
ELSE
   Ragemode = TRUE
   GOTO Tankstelle
ENDIF

Bierkaufen:
IF money > 1.00 AND LieblingsBier = TRUE
   Bier_im_Sack = 5
   GOTO Home
ENDIF

Home:
GOTO Kuehlschrank

Tankstelle:
GOTO Bierkaufen


Hmmm... unterm rumspinnen ist mir grad ne lustige Idee gekommen...

Eine GOTO-Geschichte in Codeform :)

Ich habe fertig!
#30
Hi Leute,


hier ein kleines "Game of Life" nach Art von Conway ( link )
Ihr könnte ein bisschen mit den Parametern rumspielen, tilesize z.B :)
Code (glbasic) Select
// GAME OF LIFE
//
//###### REGELN ##################################
//
// Tote Zelle mit >= 3 Nachbarn = neugeboren
// lebende Zelle mit < 2 Nachbarn = tot
// lebende Zelle mit 2/3 Nachbarn = bleibt leben
// lebende Zelle mit  > 3 = tot
//
// Lebenscheck = tmp_Leben[x][y][live]
// AnzeigeArray = Leben[x][y][live]
//
// werte%:
// --------
// 0 = lebt, true oder false
// 1 = lebensdauer 0-127 für die farbe :)


GLOBAL SX%= 640, SY%= 480, werte% = 2
GLOBAL Leben%[], tmp_Leben%[]
GLOBAL tilesize = 4

REDIM Leben[SX/tilesize+2][SY/tilesize+2][werte]
REDIM tmp_Leben[SX/tilesize+2][SY/tilesize+2][werte]

FOR x = 1 TO SX/tilesize
FOR y = 1 TO SY/tilesize

LOCAL rand = RND(2)
IF rand = 1
Leben[x][y][0]= 1
ENDIF

NEXT
NEXT 


LOCAL timer, verzoegerung = 150


WHILE TRUE

IF timer < GETTIMERALL()
Array_Swap()
timer = GETTIMERALL()+verzoegerung
ENDIF

FOR x = 1 TO SX/tilesize
FOR y = 1 TO SY/tilesize

IF Leben[x][y][0] = 1
DRAWRECT x*tilesize,y*tilesize,tilesize,tilesize, RGB(255, 255-Leben[x][y][1]*2, 255-Leben[x][y][1]*2)
ENDIF

NEXT
NEXT


SHOWSCREEN
WEND
END

FUNCTION Array_Swap:

tmp_Leben[] = Leben[]

FOR x = 1 TO SX/tilesize
FOR y = 1 TO SY/tilesize

Check_Nachbarn(x,y)

NEXT
NEXT

Leben[] = tmp_Leben[]

ENDFUNCTION

FUNCTION Check_Nachbarn: x, y

LOCAL nachbarn%, es_lebt%
es_lebt = Leben[x][y][0]

// links
IF Leben[x-1][y][0] THEN INC nachbarn, 1
// rechts
IF Leben[x+1][y][0] THEN INC nachbarn, 1
// oben
IF Leben[x][y-1][0] THEN INC nachbarn, 1
// unten
IF Leben[x][y+1][0] THEN INC nachbarn, 1
// linksoben
IF Leben[x-1][y-1][0] THEN INC nachbarn, 1
// rechtsoben
IF Leben[x+1][y-1][0] THEN INC nachbarn, 1
// linksunten
IF Leben[x-1][y+1][0] THEN INC nachbarn, 1
// rechtsunten
IF Leben[x+1][y+1][0] THEN INC nachbarn, 1

// Tote Zelle mit = 3 Nachbarn = neugeboren
// lebende Zelle mit < 2 Nachbarn = tot
// lebende Zelle mit 2/3 Nachbarn = bleibt leben
// lebende Zelle mit  > 3 = tot

IF tmp_Leben[x][y][1] < 127 THEN INC tmp_Leben[x][y][1], 1

IF nachbarn < 2 AND es_lebt = TRUE THEN tmp_Leben[x][y][0] = FALSE
IF nachbarn = 2 OR nachbarn = 3
IF nachbarn = 3 AND es_lebt = FALSE
tmp_Leben[x][y][0] = TRUE
tmp_Leben[x][y][1] = 0
ENDIF

IF nachbarn = 2 AND es_lebt = TRUE
//nix los hier!
ENDIF
ENDIF
IF nachbarn > 3 AND es_lebt = TRUE THEN tmp_Leben[x][y][0] = FALSE

ENDFUNCTION
#31
Hi freakz :)

I have a gameidea, not realy new, but i think it's a cool gamemode:



This kind of game in GLBasic with maybe NewtonSDK would be cool!
You welcome to help!

A little community game?!
#32
Hi Leute,

wär interesse an einen Livestream da, der sich rund um GLbasic 2D/3D dreht?
Ich würde das alles über Twitch machen und gleichzeitig die folgen noch auf Youtube raufladen...

Was denkt ihr?!
"Mitprogrammierer" könnte ich dann auch noch gebrauchen  :D

Denke das es ne coole Sache für GLBasic sein könnte, wenn man das entstehten von einem Spiel komplett verfolgen kann!
#33
Hi there,

can pls anyone with some experience in signing android games write a little howto?
Create a marketkey is easy but then, have no clue... :/
#34
Hi my friends,
I have now a Samsung Galaxy S3 and can't compile for Android  :'(

ANDROID_SWT = C:\Program Files (x86)\Android\android-sdk\tools\lib\x86
JAVA_HOME =  C:\Program Files (x86)\Java\jdk1.6.0_35

In GLBasic(V11.163) Beta, project -> Options: I set platform to android

gbas:
Code (glbasic) Select
WHILE TRUE


PRINT "TEST", 10,10


SHOWSCREEN
WEND
END


create Multiplatform and doubleclick on Android...

Result ( SRY, german version ):

Code (glbasic) Select
_______________________________________
*** Configuration: ANDROID ***
precompiling:
GPC - GLBasic Precompiler V.10.060 SN:3554e9fd - 3D, NET
Wordcount:4 commands
compile+link:
running Android build-script...
BUILD STAGE 1: Compile and pack RELEASE
Der Befehl "xcopy" ist entweder falsch geschrieben oder
konnte nicht gefunden werden.
ERROR: SWT folder 'C:\Program Files (x86)\Android\android-sdk\tools\lib\x86' does not exist.
Please set ANDROID_SWT to point to the folder containing swt.jar for your platform.
Das System kann den angegebenen Pfad nicht finden.
.
BUILD STAGE 2: Build DEBUG and install on device
Das System kann den angegebenen Pfad nicht finden.
finished Android build-script.
Android=C:\Users\sliver\Documents\GLBasic\Android App\distribute\Android
erfolgreich
_______________________________________
*** Fertig ***
Dauer: 3.4 sek. Zeit: 17:00
Erstellen: 1 erfolgreich.


#35
Hi, here a *.OBJ-File (Wavefront OBJ file) loader for GLBasic.

See attachment

sourcecode:
Code (glbasic) Select
// --------------------------------- //
// Project: OBJ Loader
// Start: Sunday, September 02, 2012
// IDE Version: 10.283


TYPE TVector3
x#;y#;z# // position
ENDTYPE

TYPE TVector2
x#;y#
ENDTYPE

TYPE TFace
vertex[3] AS TVector3
tex_coord[3] AS TVector2
vertex_norm[3] AS TVector3
ENDTYPE


TYPE TObj

filename$
texturename$

vertex[] AS TVector3
tex_coord[] AS TVector2
vertex_norm[] AS TVector3
faces[] AS TFace

filehandle%
tex_handle%
XObj_handle%

FUNCTION LOAD: name$

self.filehandle = GENFILE() // set the filehandle
self.filename$ = name$  //set filename

// if file exist

IF DOESFILEEXIST(self.filename$) AND OPENFILE(self.filehandle, self.filename$, 1)
//DEBUG "All OK, file exist!\n"

WHILE ENDOFFILE(self.filehandle) = 0
LOCAL tmp$, check$, splt$[]

READLINE self.filehandle, tmp$
check$ = MID$(tmp$, 0, 2)

SELECT check$
CASE "v "
SPLITSTR(tmp$,splt$[]," ")
//DEBUG "->"+splt$[1]+" : "+splt$[2]+" : "+splt$[3]+"<-\n"
LOCAL v AS TVector3

v.x = splt$[1]
v.y = splt$[2]
v.z = splt$[3]

DIMPUSH self.vertex[], v

CASE "vt"
SPLITSTR(tmp$,splt$[]," ")
//DEBUG "->"+splt$[1]+" : "+splt$[2]+"<-\n"
LOCAL v AS TVector2

v.x = splt$[1]
v.y = splt$[2]

DIMPUSH self.tex_coord[], v
CASE "vn"
SPLITSTR(tmp$,splt$[]," ")
//DEBUG "->"+splt$[1]+" : "+splt$[2]+" : "+splt$[3]+"<-\n"
LOCAL v AS TVector3

v.x = splt$[1]
v.y = splt$[2]
v.z = splt$[3]

DIMPUSH self.vertex_norm[], v
CASE "us"
SPLITSTR(tmp$,splt$[]," ")
self.texturename$ = splt$[1]
//DEBUG self.texturename$+"\n"
CASE "f "
LOCAL s$[]
SPLITSTR(tmp$,splt$[]," ")

LOCAL t AS TFace

FOR i = 1 TO 3
SPLITSTR(splt$[i],s$[],"/")
//DEBUG "->"+s$[0]+" : "+s$[1]+" : "+s$[2]+"<-\n"
LOCAL v=s$[0] , vt=s$[1], vn=s$[2]

t.vertex[i-1] = self.vertex[v-1]
t.tex_coord[i-1] = self.tex_coord[vt-1]
t.vertex_norm[i-1] = self.vertex_norm[vn-1]

NEXT

DIMPUSH self.faces[], t
ENDSELECT

WEND

// free some memory!
REDIM self.vertex[0]
REDIM self.tex_coord[0]
REDIM self.vertex_norm[0]

self.tex_handle = GENSPRITE()
LOADSPRITE self.texturename$, self.tex_handle

self.XObj_handle = GENX_OBJ()

X_OBJSTART self.XObj_handle
FOREACH t IN self.faces[]
X_OBJNEWGROUP
FOR i = 0 TO 2
X_OBJADDVERTEX t.vertex[i].x, t.vertex[i].y, t.vertex[i].z, t.tex_coord[i].x, t.tex_coord[i].y, RGB(0xff, 0xff, 0xff)
NEXT
NEXT
X_OBJEND

ENDIF
ENDFUNCTION

FUNCTION DRAW:
X_SETTEXTURE self.tex_handle, -1
X_DRAWOBJ self.XObj_handle, 0
ENDFUNCTION

ENDTYPE


[attachment deleted by admin]
#36
First a REALY F***ing nice game :) :

http://www.kickstarter.com/projects/project-giana/project-giana

Next a realy cool idea for a RTS-Game:

http://www.kickstarter.com/projects/659943965/planetary-annihilation-a-next-generation-rts?ref=live


What you guys think about that games?
Any other cool projects ?

Lets talk about that side!
#37
Ok guys,

I write a simple test to get something simular to minecraft ( very very veeeeeeeery basic! )
It occurred to me that i have problems if i draw a block twice ( same objectID ) and use a pickroute(X_COLLISIONRAY) -> i select both of them.... :/

No problem so far, i can load for each cube a new object with new ID, but is this the best solution?

The real problem is that i have to set a ObjectID to use X_COLLISIONRAY :(
I'm realy pissed off and have no idea for a good way to do this...

Sad moment :/
#38
Chuck Norris doesn't get compiler errors, the language changes itself to accommodate Chuck Norris
#39
Hi,

Look at this AWSOME picture:

PICTURE SEE okee!

Who wants to create a 2D-Game like this? :D


EDIT:

WTF my imagetag does not work anymore ^^
thanks okee, to post it again :)
#40
Hi buddys!


I have a problem with a second file in a project...
If i make this in the second file:

Code (glbasic) Select

GLOBAL bla
bla = 12


I get a error:
Quote"_keystatus.gbas"(43) error : command not inside function or sub


IT SUCKSSSSSSSSS!

Any walkaround to fix the problem?
If i put all this shit into a function i get this F***ING craaaaaappppppppppp :D :


Quote"_keystatus.gbas"(43) warning : variable already exists : KEY_SPACE



FFFFFFFFFFUUUUUUUUUUU  :whistle:

I attach this shit ^^

[attachment deleted by admin]