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

#1
Hi,
I'm still struggeling in havin a GLB-App as reusable (ios) component.

My goal is to have an iOS - app that uses the handy functions of GLB but can be used in a "normal" xcode project. So you just would add the compiled libs from glb to your project and could have the (glb-)output on a (say) viewcontroller. As I understand so far the main.m that is generated returns a UIApplication-instance. I understand this is a singleton and so I cannot simply call main from somewhere else in my code. Is there a chance to change this (returning UIApplication)? I'd rather use the "normal" main.m instead and just create a (say) GLKit-View once I need it, and then pass this instance to GLB, so that the GLB-Output will go there?

If this is not possible, a workaround for me could be an architecture that uses the "custom sceme" variant: My "main"-App calls the "glb-App" via custom-sceme. I understand this should be possible by now, reading threads
http://www.glbasic.com/forum/index.php?topic=7974.0#top and
http://www.glbasic.com/forum/index.php?topic=7924.0
so I could just "shell out" to the glb-app (using the customsceme of the glb app) with an identifer (say the custom-sceme of the main-app) as a query-param. Then the glb-App is doing it's job and once finished calls the main app via the custom-sceme that was delivered before. But: How can I achive the latter? Is there a way to call a custom-sceme in GLB?

Is there anyone having a better idea?

Thanx in advance for any hint or idea
Det
#2
Hi folks,
here's some question that should be easily answered:
Obviously SPRCOL is not handling transparent pixels that are defined as "pink" RGB(255,0,128)? My Colliosiondetection is quite ugly.
What am I supposed to do to have a pixel-collision only with non-transparent pixels=
Thank's a lot
Det

#3
(Wer nicht fragt bleibt dumm... )

Da ich an der inhaltlichen Baustelle gerade festhänge (siehe thread:Frage zu X_SCRREN2WORLD, X_COLLISIONRAY und X_GETFACE) hab ich mich mal daran gewagt, die Integration des GLBasic-Codes in ein iOS Projekt zu wagen.

Ziel: Ich habe ein xcode-projekt und möchte einen ViewController haben, in dem ein GLBasic-Code läuft. Der Rest der App ist komplett ObjectiveC, nur in einem DetailView möchte ich GLBasic benutzen. Idealerweise gelingt es mir ein delegate aufzurufen, um Werte aus dem GLBasic-Teil abrufen zu können. Sinnvol wäre es nat. auch Parameter an den GLBasic-code zu übergeben.

Problem: Ich sehe aktuell nur einen "Absprung":  im main.m der Aufruf
GLB-iPhone_call_main

Der erzeugt offenbar ein UIApplication-Objekt, und da ich da nur eines von haben darf, bin ich an der Stelle schon aufgeschmissen.

Und damit hier die Frage: Was gibt's da für Möglichkeiten? Gibt es eine Dokumentation  der Funktionen aus z.b. libGLBasiciPhone-egl? Wäre das ein Feature-Request (die Schaffung eines "Embedded GLBasic", das ich als Komponente in Android oder iOS verbauen kann)? Oder gibt es das schon?

Danke
Det




#4
Hello again,
today it's me again having problems with the above functions.
I built up a small testscenario to check a collision with ny 3d-object.
Goal: Read out the coordinates under the mouseposition in the uv-map of my texture.
Test: Created a 3d-object in blender, exported as obj and converted to ddd. Result: All neat. Object visible at (0,0,0) (I think), camera in distance 15 along the x-axis, looking at (0,0,0) as well.
Now I use X_COLLISIONRAY: Stuffed in two point-coordinates: I decided that the first point is my camerapostion: (15,0,0) the othe one is wherever the user touched (positioned the mouse). I understood tha I have to transform the Screencoordinates the the user gave with the mouse have to be converted using "X_SCREEN2WORLD" (right?).
Now I get some collisions listed. BUT: The area that detects a collision is far smaller than the visible object. How come? Is it because of my Screen2World-Z-Parameter? Don't know what this is used for and cannot imagine a possible value. 1 did at least the trick... (Help please!)

Next problem: (Ignoring the first). I get a faceId. But: I do not at all understand the faces-array (not because I don't understand the two-dimensional arrays, but because of the values in nodes...) So: The face consists of three edges (nodes). This be my first dimension. But: Why can I ask a node for it's "texture-coordinates" (at index 3 and 4)? As value for face[0][3] I get something like:
Tx: 0.6175429821 ty:0.3996520042
I had thought of a more "direkt" coordinate. How am I supposed to transform this value back to my texture-map?

Some samplecode:
Code (glbasic) Select
LOADSPRITE "Media/WorldTexture.jpg", 0
X_LOADOBJ "Media/MyWorldResized.ddd", 0
LOCAL mx,my,b1,b2
LOCAL col
LOCAL cx,cy,cz
LOCAL faceIdx, face[]

SYSTEMPOINTER 1

WHILE TRUE
MOUSESTATE mx,my,b1,b2
X_SCREEN2WORLD mx, my, 1, cx,cy,cz

col = X_COLLISIONRAY(0, 0, 15,0,0, cx,cy,cz)
IF (col<>0)
DEBUG ("Coll det" + col + ".."+ "\n")
faceIdx=X_GETCOLLISIONFACE()
X_GETFACE 0,0,faceIdx,face[]
DEBUG ("Tx: " + face[0][3] + " ty:" + face[0][4] + "\n");
ELSE
DEBUG ("NO Coll det " + "\n")
ENDIF

X_MAKE3D 1, 50, 45
X_CAMERA 15,0,0,0,0,0
X_SETTEXTURE 0, -1

X_ROTATION 0,0,1,0
X_ROTATION 0,0,0,1
X_DRAWAXES 10,10,10
X_DRAWOBJ 0,0
SHOWSCREEN
WEND


As always: I'd be very glad for any input.
TIA
Det
#5
Und heute mal wieder eine Frage auf deutsch (hab mich noch nicht entschieden, ob es sich lohnt auf englisch zu posten...)

Ich habe ein Testszenario aufgebaut, um eine Kollision mit meinem 3D-Objekt zu erproben.

Ziel: Koordinatenpaar des Objekts unter der Mausposition auf der UV-Map der Textur finden.

Versuchsanordnung: 3DObjekt mit Blender erstellt -als obj exportiert zu ddd konvertiert.
Eingelesen
Zeigt 1a Ergebnis. Objekt positioniert im Ursprung (denke ich), Kamera auf der x-Achse mit entfernung 15.

Was ich bisher verstanden habe: Collisionray gibt eine Distanz oder 0 zurück. Offenbar gebe ich 2 Punkte rein. Als Quellpunkt gebe ich meine Kamera vor. Zweiter Punkt wird meine Maus, aber von Screen auf Weltkoordinaten umgerechnet.

Ergebnis ist so lala: Auf einem Kreis um die Bildschirmmitte (wo ja nun auch mein Objekt liegt) bekomme ich Kollisionen. Aber: Der Kreis ist deutlich kleiner als mein Objekt...

Denkbare Probleme: Meine Screen2World-Transformation ist müll. Kann gut sein, da die Z-Angabe "geraten" ist (1):
Frage: Was gebe ich da sinnvollerweise an?

Nächstes Problem: Wenn ich mich mal das Problem der fehlenden Treffer ignoriere: Ich bekomme eine Face-Id. Prima. Aber ehrlich gesagt raffe ich den Aufbau des face-Arrays nicht. Nicht weil es ein 2Dimensionales Array ist, sondern die Unterteilung in nodes verstehe ich nicht. Also: Das Face besteht (weil ich es aus Dreiecken aufgebaut habe) aus 3 Kanten. Wieso hat eine Kante eine tx,ty-Koordinate in die Textur (Wenn ich die Doku richtig lese, z.b. tx=[0][3])? Als Werte bekomme ich so etwas:
Tx: 0.6175429821 ty:0.3996520042
Ich hatte mit etwas "direkterem" gerechnet, wie transformiere ich das zurück in meine Textur-Map?


Samplecode:
Code (glbasic) Select

LOADSPRITE "Media/WorldTexture.jpg", 0
X_LOADOBJ "Media/MyWorldResized.ddd", 0
LOCAL mx,my,b1,b2
LOCAL col
LOCAL cx,cy,cz
LOCAL faceIdx, face[]

SYSTEMPOINTER 1

WHILE TRUE
MOUSESTATE mx,my,b1,b2
X_SCREEN2WORLD mx, my, 1, cx,cy,cz

col = X_COLLISIONRAY(0, 0, 15,0,0, cx,cy,cz)
IF (col<>0)
DEBUG ("Coll det" + col + ".."+ "\n")
faceIdx=X_GETCOLLISIONFACE()
X_GETFACE 0,0,faceIdx,face[]
DEBUG ("Tx: " + face[0][3] + " ty:" + face[0][4] + "\n");
ELSE
DEBUG ("NO Coll det " + "\n")
ENDIF

X_MAKE3D 1, 50, 45
X_CAMERA 15,0,0,0,0,0
X_SETTEXTURE 0, -1

X_ROTATION 0,0,1,0
X_ROTATION 0,0,0,1
X_DRAWAXES 10,10,10
X_DRAWOBJ 0,0
SHOWSCREEN
WEND



Das sind jetzt leider einige Fragen in einem Thread, aber da die alle zusammenhängen passt das vielleicht...

Mir fehlt jetzt so'n bisschen die Idee wie ich weiterkomme, und ich freu' mich über jede Anmerkung

TIA
Det
#6
Hi,
it seem's to me, I did not understand the mouse / touch behaviours in total, perhaps someone could point me to the right direction or has similar problems.

What I did was make a small testprogram for the iPad that should react to touches.

After I've learned that getmouscount will always deliver 16 (or should? there seems to be a bug when more than 5 fingers are placed? Anyway) and in a call Mousestate x,y,b1,b2 the b1 gives me the hint that this "finger" is "active" I came to the point that drives me nuts: Obviously I've got the chance to check whether I've got two finges places (need this, want to implement a "pinch"-gesture) my "swipe" does not work anylonger, without implementing "pinch" my "swipe works. My swipe uses the mouseaxis function.
I assume it is because of the checkroutine that always runs through 16 available mouses and asks for the button1. To do this I need to call "setactivemouse" prior to mousestate. But: This checkroutine is called in an endless loop. So I assume it's an timing / threading issue: I'm afraid the mousaxis-function is interrupted by the "check-function" to early to return an appropriate value.

Anyone else who has witnessed this problem?

Checker-Function:

Code (glbasic) Select

TYPE MOUSEDATA
x
y
b1
b2
xaxis
yaxis
ENDTYPE

TYPE MOUSEINFO
mockamouse=-1
numberofusedmice // Anzahl der Mäuse mit gedrücktemButton als limit der usedMice
usedmice[16] // Indize ins mousedata-array um werte zu kriegen
mousedata[16] AS MOUSEDATA // alle werte der gedrückten mäuse
ENDTYPE
LOCAL i

WHILE TRUE

getMice()



i=maus.numberofusedmice
IF i=2
// pinch, code dropped

       ELSE
// swipe, code dropped
       ENDIF
WEND

// ------------------------------------------------------------- //
// ---  GETMICE  ---
// ------------------------------------------------------------- //
FUNCTION getMice:
// Diese Variablen sind als LOCAL definiert:
//
LOCAL x1%,y1%,b1%,b2%, xs%, ys%

maus.numberofusedmice=0;
FOR x=0 TO GETMOUSECOUNT()-1

SETACTIVEMOUSE x
MOUSESTATE x1%,y1%,b1%,b2%

IF (b1=1)
maus.usedmice[maus.numberofusedmice]=x
maus.mousedata[x].x=x1
maus.mousedata[x].y=y1
maus.mousedata[x].b1=b1
maus.mousedata[x].b2=b2

INC maus.numberofusedmice, 1

ENDIF
NEXT
RETURN



ENDFUNCTION // GETMICE



Ideas anyone?
Thanx in advance
Det
#7
Hi there,
and the next problem I experience: I modelled a sphere with an uv-map in blender. Then exported it to obj and converted with the Convert-Tool to ddd format.

Once I display it I get the result in the attachment: It's got the ugly gap. (2nd attachment shows the original blender result)

Has anyone experienced this problem?

Any idea is helpful

Thanx
Det

And in german (to increase the audience ;) )

Hi,
ich hab mit blender eine Sphere mit einer uv-map drauf gemacht. Wenn ich das mit GLBasic darstelle, dann erhält das Mapping eine Lücke. In blender sieht's richtig aus.
Hat irgendwer eine Idee, was ich falsch mache?

Danke
Det
#8
Hi Leute,
so mein Testprojekt tut jetzt auf dem Android-Device grob das was es soll: eine in Blender gerenderte Erdkugel bewegen. Naja, das muss ich noch besser werden, die Textur klafft am Pol auseinander und es gibt einen Spalt in der Erde. Vielleicht ist OBJ-Export und DDD-Konvert nicht die ideale Lösung, naja da frag ich später mal...
Aber: Good show. Klappt richtig gut, ein 10-Zeiler und man sieht das Objekt und kann es drehen, ohne jede Menge boilerplate-code, ich bin echt begeistert.

Soweit die "Goodnews". Jetzt hab ich mich an den iOS-Port gemacht, leider erstmal ohne Erfolg.
Konfiguration:
Mac OS X 10.7.5
XCode 4.5.2


Fehlermeldung:
Undefined symbols for architecture i386:
"_GLB_iPhone_call_maint"

wohl ein Folgefehler aus warning: ignoring file ...libGLBasiciPhone-egl.a, file was build for archive which is not the architecture being linked (i386)

Tja, und nu?

Irgendwer eine Idee?

Danke
Det


#9
Hi Leute,
ich hänge dabei fest, mein Testprojekt im ADT zu kompilieren und dort im emulator laufen zu lassen (siehe auch den Thread "Android build fails (Native Libs?)" im englischen Forum. Jetzt wollte ich mal die Gegenprobe machen, und das fertige apk unter GLBasic laufen zu lassen, aber...:
Wo / Wie stelle ich denn den Emulator ein / Wie rufe ich den auf?

Det
#10
Hi there out there,
I just obtained my license key and tried to have my very first GLBasic build done.

This is my odyssey of building a android app from the GLBasic Game I wrote. Not that much of a game, merely a background and a sprite...
To shorten it up: It seems to me that my native-libs are not referenced correctly when running the build under adt (eclipse).
It tried out a lot of thinks (read it if you dare, I stuffed it to the attachment), but now I'm stuck and would be _really_ glad if someone could help me out...

Thanks in advance
Det
#11
Moinsen,
GLBasic ist ja ziemlich cool, ich benutze zur Zeit noch die "Free"-Version, und bevor ich mir die "Premium"-Edition zulege, würde ich mal ein paar Fragen stellen. Blöd ist halt, das ich nicht zu jeder Frage einen eigenen Fred (äh Thread) aufmachen möchte, und das jetzt etwas "Kraut und Rüben" durcheinander geht.

Also, vielleicht mal als "Einsteiger": Das Einsatzszenario. Das ist leider auch "ein weites Feld":
Einsatz 1:
Ich hab meinem Sohn (9) bisher mit SmallBasic einen Einstieg ins Coden gegeben, der Umstieg in GLBasic scheint nicht schwer und hat den Vorteil, das damit auch sein GalaxyTab mit seinem Code ausgestattet werden kann. Ich denke: GLBasic ist dafür ideal (kleine Games umzusetzen macht halt spass)
Einsatz 2:
Ich bin für die Entwicklung von Apps im iOS-Umfeld tätig und könnte mir vorstellen, das Tool als "Rapid Prototyping"-Tool für 3D-Ansichten einzusetzen. Dazu dann unten ein paar Fragen
Einsatz 3:
Ich würd' gerne aus Spass an der Freud ein paar mit blender gebaute Sachen auf dem Tablet darstellen. Ich sag' jetzt mal größenordnungsmäßig unter 100.000 Vertices. Mit uv-gemappten Texturen drauf. Darauf ein paar translationen / rotationen damit man ein 3D objekt auf dem Tablet bewegen und in voller Pracht ansehen kann.

Jetzt die Fragen:

- Was kann ich auch für einfache Aufgaben wie Scaling / Rotation von Objekten erwarten? Muss ich mir jetzt den OpenGL Stack draufschaffen, um das Inline zu coden? Das wollte ich eigentlich vermeiden
- Wie kann ich blender (.blend-Files) einbinden? Kann ich erwarten das ich einen Sprite direkt aus einem Blender-File laden kann? Einen DDD Object-Exporter habe ich im Forum nicht gefunden, wird der bei "Premium" mitgeliefert, oder muss ich den "Tanz" via "Export to 3ds konvert to ddd (mit welchem Tool auch immer" machen?
- Klappt das Zusammenspiel explizit auch mit der neuesten Blender-Version?
- Wie funktioniert das "Exportieren" zu einer iOS-App? Was wird da erstellt? Ein Xcode-Project, das ich dann selber baue / signiere? Mit welcher Xcode-Version funktioniert das?
- Apples Entwicklungszyklen sind ja recht kurz, bis man sein Xcode aktualisieren muss. Wie gut klappt das Update, wenn ich gezwungen bin auf ein neues Xcode umzusteigen? Habe im Forum eine Anfrage gefunden, der entsprechende User mit der Konfiguration unterwegs (Xcode 4.5) die ich auch einsetze und "hing", weil seine Architektur wohl nicht unterstützt wurde. Also: Explizit: Wird Xcode 4.5.2 die "Exporte" bauen können?
- Wie erweiterbar ist das "Exponat": Also kann ich z.B. noch einen GestureRecognizer "anflanschen", oder überhaupt: Ist das "Spiel" (oder in meinem Fall: Eine 3D-Komponente) in ein bestehendes iOS-Projekt integrierbar?
- Wie funktioniert die Umsetzung von Gestures überhaupt? Was darf ich da erwarten / wie kann ich das testen? Was benutze ich in GLBasic um z.B eine "Pinch"-Geste (der eine beliebige 2/3/4-Finger-Geste) abzufragen, weil ich die im Game irgendwo benutzen möchte?
- Und die Frage bzgl des Exports betrifft natürlich nicht nur Apple-Produkte sondern auch die Android-Welt: Was wird da Exportiert? Ein Eclipse-Workspace?
- Was kann ich an Unterstützung von speziellen tablet-Features wie "Gyroscope", "Location-API" und "Camera" auf dem Tablet erwarten? Bekomme ich das irgendwie unterstützt? Hat das schon mal jemand gemacht? Klappt das schon "native" in GLBasic
Ich bin mir im Klaren darüber, das GLBasic nicht alles kann, und ich erwarte auch nicht allzu viel (und wenn es nix vom genannten kann, kaufe ich es wahrscheinlich trotzdem), also: Lieber ehrlich "Dies geht nicht, das können wir noch nicht, dafür haben wir einen Workaround und da gibt es einen Bug" als "ich hab mal von einem gehört der das gemacht hat und darum sag ich mal: das geht"

Über jede Antwort zu jeder Frage würde ich mich freuen. Danke im voraus

Det

P.S: Eins noch: Bekomme ich beim Kauf 'ne (deutsche) Rechnung? Dann kann ich's absetzen ;)