Author Topic: Problem 3d on Android  (Read 12022 times)

Offline erico

  • Community Developer
  • Prof. Inline
  • ******
  • Posts: 4349
    • View Profile
    • FUED
Re: Problem 3d on Android
« Reply #30 on: 2014-May-31 »
here it goes, you might want a cube with flipped surface, but here is a normal one.

Offline matchy

  • Prof. Inline
  • *****
  • Posts: 1545
    • View Profile
Re: Problem 3d on Android
« Reply #31 on: 2014-May-31 »
Still the same erico.  :(

Here's test code!  :P

Code: (glbasic) [Select]
// --------------------------------- //
// Project: z_denabled
// Start: Sunday, June 01, 2014
// IDE Version: 11.414

TYPE _obj
id
index
texture_id
screen_id
x
y
z
px
py
pz
width
height
depth
color_value
ENDTYPE

GLOBAL sprite AS _obj
GLOBAL block AS _obj

loop()

FUNCTION paint_test_pattern:
LOCAL obj AS _obj, i
obj.x = 0
obj.y = 0
obj.width = sprite.width / 2
obj.height = sprite.height / 2
FOR obj.py = 0 TO 1
FOR obj.px = 0 TO 1
obj.x = obj.px * obj.width
obj.y = obj.py * obj.height
SELECT i
CASE 0
obj.color_value = 0x0000ff
CASE 1
obj.color_value = 0x00ff00
CASE 2
obj.color_value = 0xff0000
CASE 3
obj.color_value = 0xff00ff
ENDSELECT
INC i
DRAWRECT obj.x, obj.y, obj.width, obj.height, obj.color_value
NEXT
NEXT
ENDFUNCTION

FUNCTION load_block:
block.id = GENX_OBJ()
X_LOADOBJ "Media/block.ddd", block.id
ENDFUNCTION

FUNCTION create_block:
block.id = GENX_OBJ()
X_OBJSTART block.id
X_OBJADDVERTEX -0.5, +1.0, -0.5,  0.0, 0.0,  0xffffff
X_OBJADDVERTEX -0.5, +1.0, +0.5,  0.5, 0.0,  0xffffff
X_OBJADDVERTEX -0.5, +0.0, -0.5,  0.0, 1.0,  0xffffff
X_OBJADDVERTEX -0.5, +0.0, +0.5,  0.5, 1.0,  0xffffff
X_OBJNEWGROUP // LEFT
X_OBJADDVERTEX +0.5, +1.0, +0.5,  1.0, 0.0,  0xffffff
X_OBJADDVERTEX +0.5, +1.0, -0.5,  0.5, 0.0,  0xffffff
X_OBJADDVERTEX +0.5, +0.0, +0.5,  1.0, 1.0,  0xffffff
X_OBJADDVERTEX +0.5, +0.0, -0.5,  0.5, 1.0,  0xffffff
X_OBJNEWGROUP // RIGHT
X_OBJADDVERTEX -0.5, +1.0, -0.5,  0.0, 0.0,  0xffffff
X_OBJADDVERTEX +0.5, +1.0, -0.5,  0.5, 0.0,  0xffffff
X_OBJADDVERTEX -0.5, -0.0, -0.5,  0.0, 1.0,  0xffffff
X_OBJADDVERTEX +0.5, -0.0, -0.5,  0.5, 1.0,  0xffffff
X_OBJNEWGROUP // FRONT
X_OBJADDVERTEX +0.5, +1.0, +0.5,  1.0, 0.0,  0xffffff
X_OBJADDVERTEX -0.5, +1.0, +0.5,  0.5, 0.0,  0xffffff
X_OBJADDVERTEX +0.5, -0.0, +0.5,  1.0, 1.0,  0xffffff
X_OBJADDVERTEX -0.5, -0.0, +0.5,  0.5, 1.0,  0xffffff
X_OBJNEWGROUP // BACK
X_OBJEND
ENDFUNCTION

FUNCTION draw_obj: ob AS _obj
X_SETTEXTURE sprite.id, -1
X_MOVEMENT ob.x, ob.y, ob.z
X_DRAWOBJ block.id, -1
ENDFUNCTION

FUNCTION loop_draw:
LOCAL obj AS _obj
FOR obj.z = 2 TO 5
FOR obj.x = 2 TO 5
draw_obj(obj)
NEXT
NEXT
ENDFUNCTION

FUNCTION create_sprite:
sprite.screen_id = 1
sprite.id = GENSPRITE()
sprite.width = 256
sprite.height = 256
CREATESCREEN sprite.screen_id, sprite.id, sprite.width, sprite.height
USESCREEN sprite.screen_id
paint_test_pattern()
USESCREEN -1
ENDFUNCTION

FUNCTION setup:
create_sprite()
create_block()
// load_block()
ENDFUNCTION

FUNCTION loop:
setup()
WHILE TRUE
X_MAKE3D 0.0001, 100, 45
X_ENABLE_Z FALSE ////////////////////
X_CAMERA 0, 0.5, 0, 1.1, 0.5, 1.2
loop_draw()
SHOWSCREEN
WEND
ENDFUNCTION

Offline erico

  • Community Developer
  • Prof. Inline
  • ******
  • Posts: 4349
    • View Profile
    • FUED
Re: Problem 3d on Android
« Reply #32 on: 2014-May-31 »
Strange I change the cube obj to a sphere obj and get the same image.
I guess I have to read the code closer.

Offline matchy

  • Prof. Inline
  • *****
  • Posts: 1545
    • View Profile
Re: Problem 3d on Android
« Reply #33 on: 2014-Jun-07 »
So I was able to reconstruct the process of display room walls by only drawing the faces of those closest to the camera. So with Z_ENABLED FALSE, this works well on the Android for now to continue on that platform.
« Last Edit: 2014-Jun-07 by matchy »

Offline erico

  • Community Developer
  • Prof. Inline
  • ******
  • Posts: 4349
    • View Profile
    • FUED
Re: Problem 3d on Android
« Reply #34 on: 2014-Jun-07 »
Great! :good:

Offline matchy

  • Prof. Inline
  • *****
  • Posts: 1545
    • View Profile
Re: Problem 3d on Android
« Reply #35 on: 2015-Nov-29 »
Has anyone released an Android 3D app because this bug is a big obstacle?  :rant:

Offline Kitty Hello

  • code monkey
  • Administrator
  • Prof. Inline
  • *******
  • Posts: 10760
  • here on my island the sea says 'hello'
    • View Profile
    • http://www.glbasic.com
Re: Problem 3d on Android
« Reply #36 on: 2015-Nov-29 »
The z buffer does not work? So the puxelformat is bad... Spacefractal?

Offline matchy

  • Prof. Inline
  • *****
  • Posts: 1545
    • View Profile
Re: Problem 3d on Android
« Reply #37 on: 2015-Nov-29 »
Can maybe inline glBegin commands correct it?  :blink: