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

Messages - fuzzy70

#16
I just tested the simple program I posted on different topic http://www.glbasic.com/forum/index.php?topic=9975.msg87568#msg87568 & the grabsprite fails on my android phone, Xperia Z running 4.4.2.

Rest of the program runs as expected but it drawn sprite is empty/blank.

Lee
#17
I'm pretty much the same as Ian in that I rarely use debug mode unless something is not acting right & it's not obvious. Sometimes I might track some variables (mainly floats for rounding errors etc) as it's less messy in the debug window than showing on screen plus being able to scroll through them is better.

When I started with GLB I used debug a lot more until becoming more familiar with it's syntax & commands but now mainly if something goes wrong or doesn't look right I pretty much know where to look in the code. I try as much as possible to avoid lengthy sections of code which also helps me find whats not working right.

Lee
#18
There are numerous ways to draw checkerboards, personally I would create a 64x32 checkerboard sprite then draw a single POLYVECTOR with SMOOTHSHADING set to false the size of the screen. The sprite could be generated at runtime or at the start if you are planning different resolutions, however I'm not 100% sure if virtual screens are currently working on Andriod.

Lee
#19
Off Topic / Re: TV fee?!
2014-Sep-04
Would depend a lot on usage I would say, for example a 30 second scene showing the game being used to explain a point like gamestyle etc would be a lot different to the same game actually being used/played as part of a challenge in the TV program.

How much focus the game gets & its usage in the TV program I would say changes the fee amount.

Lee
#20
Quote from: Hemlos on 2014-Sep-03
I have a solution for an loop of indefinite size....should be able to play years...on any computer.

Im going to do a small rewrite test, itll load 4 images only(2 that are showing, 2 are loading. And as the animation plays, itll load images, this will cause a delay and that delay will become the lower limit for the FPS timer.

As a sideffect, memory will be freed up big time!  :good:
Lets see how it goes, ill be back soon...
Sounds like possibly like a good solution.

:offtopic: BTW you don't happen to plan on a GLB Seti program do you  ;)

Lee
#21
Quote from: spacefractal on 2014-Sep-03
Im thinks we should not go future with the offtypic PM debate. Im want to see that all got removed, which is include mine.
To me valid arguments & points where raised with regards to the PM issue or are we going to sweep it under the carpet like the "GLB Future" issue. If you are unhappy with your comments then please edit/delete them if you so wish as they are your posts & you have control over it, if you do not like other peoples comments then that's your choice unless it's a personal attack on yourself then that's different.

Technically the PM issue was not offtopic as it was the original author who brought up the PM subject in the first place & others put their views on that subject.

Probably I will find this post deleted because of my views.

Lee
#22
 :good: , I love things like this, short & sweet  :)

Lee
#23
Here's some example code for you erico that both do the same thing, the 1st uses GETPIXEL & SETPIXEL & the 2nd MEM2SPRITE. All they do is reset the red value to zero so nothing complicated but shows the difference in speed other the 2 methods. I've tried to keep the code as simple as possible with comments & it's intentionally laid out that way so you can see how it works rather than optimal way.

If you don't understand the bitwise operations on modifying the MEM2SPRITE array (bAND) I can explain that in more detail with other examples as to how they work, just PM me or post here & I'll see what I can do.

Example 1, using GET/SETPIXEL, btw the GETPIXEL part takes a long time (~20 seconds on my machine) so don't think the program has crashed just be patient  :D
Code (glbasic) Select
GLOBAL sw%=800,sh%=600
GLOBAL loop%
GLOBAL red%[],green%[],blue%[],alpha%[]
GLOBAL pixel_value%
GLOBAL x%,y%
GLOBAL timer,timetaken

DIM   red[sw][sh]
DIM green[sw][sh]
DIM  blue[sw][sh]
DIM alpha[sw][sh] // Pretty pointless as setpixel has no alpha

SETSCREEN sw,sh,FALSE

// Create some random coloured boxes
FOR loop = 0 TO 1000

DRAWRECT RND(300),RND(300),RND(500),RND(500),RGB(RND(255),RND(255),RND(255))

NEXT

// Loop through the entire screen & read the pixel values into an array
timer = GETTIMERALL()

FOR x=0 TO sw-1
FOR y=0 TO sh-1

// read the pixel value at x,y
pixel_value=GETPIXEL(x,y)

// GLB stores pixels in 32bit alpha,blue,green,red format
// 1st byte is alpha, 2nd byte green & so on
// Read each colour into its respective array
  red[x][y] = bAND(pixel_value, 0xff)
green[x][y] = bAND(ASR(pixel_value,8), 0xff)
blue[x][y] = bAND(ASR(pixel_value,16), 0xff)
alpha[x][y] = bAND(ASR(pixel_value,24), 0xff)

NEXT
NEXT

timetaken = GETTIMERALL()-timer

PRINT "Pixel colours copied to Array",0,0
PRINT "Time taken = "+timetaken,0,8
PRINT "Press any key to continue",0,16

SHOWSCREEN
KEYWAIT

// Now to modify the array by removing all the red colour values
timer = GETTIMERALL()

FOR x=0 TO sw-1
FOR y=0 TO sh-1

red[x][y] = 0

NEXT
NEXT

timetaken = GETTIMERALL()-timer
PRINT "Colours modified, Press any key to view the result",0,0
PRINT "Time taken = "+timetaken,0,8

SHOWSCREEN
KEYWAIT

//Now to draw the array back to screen
timer = GETTIMERALL()

FOR x=0 TO sw-1
FOR y=0 TO sh-1

SETPIXEL x,y,RGB(red[x][y],green[x][y],blue[x][y])

NEXT
NEXT

timetaken = GETTIMERALL()-timer
PRINT "All done, press any key to exit",0,0
PRINT "Time taken = "+timetaken,0,8

SHOWSCREEN
KEYWAIT



Example 2, using MEM2SPRITE
Code (glbasic) Select
GLOBAL sw%=800,sh%=600
GLOBAL loop%
GLOBAL x%,y%
GLOBAL timer,timetaken
GLOBAL memsprite%[]

DIM memsprite[sw*sh]

SETSCREEN sw,sh,FALSE

// Create some random coloured boxes
FOR loop = 0 TO 1000

DRAWRECT RND(300),RND(300),RND(500),RND(500),RGB(RND(255),RND(255),RND(255))

NEXT

// Grab the screen as a sprite then load it into memsprite array
// Grab must be done before showscreen as gets the current backbuffer
// If using virtual screens then grabsprite is not required as you
// just pass the screen sprite number to the SPRITE2MEM call
timer = GETTIMERALL()

GRABSPRITE 1,0,0,sw,sh
SPRITE2MEM(memsprite[],1)

timetaken = GETTIMERALL()-timer

PRINT "Screen grabbed to Array",0,0
PRINT "Time taken = "+timetaken,0,8
PRINT "Press any key to continue",0,16

SHOWSCREEN
KEYWAIT

// Now to modify the array by removing all the red colour values
// Since the mem2sprite array is just one dimension you would normally
// loop from 0 to the end of the array. Here I am doing it the same way
// as the getpixel method for consistancy & illustraion purposes
timer = GETTIMERALL()

FOR x=0 TO sw-1
FOR y=0 TO sh-1

// GLB pixel format is 0xAABBGGRR so as we are just changing the red
// value we bAND 0xffffff00 with the current value in array
// & that will set only the last byte (in this case the red byte) to 0
// leaving the rest untouched
memsprite[x + y * sw] = bAND(memsprite[x + y * sw],INTEGER(0xffffff00))

NEXT
NEXT

timetaken = GETTIMERALL()-timer

PRINT "Colours modified, Press any key to view the result",0,0
PRINT "Time taken = "+timetaken,0,8

SHOWSCREEN
KEYWAIT

//Now to draw the array back to screen
timer = GETTIMERALL()

// Put the array into a sprite then draw the sprite
MEM2SPRITE(memsprite[],2,sw,sh)
DRAWSPRITE 2,0,0

timetaken = GETTIMERALL()-timer

PRINT "All done, press any key to exit",0,0
PRINT "Time taken = "+timetaken,0,8

SHOWSCREEN
KEYWAIT



Lee
#24
The spider model is not something I made as it lacks quite a few thousand polys like my models  :D, just an example object that comes with open3mod that Hemlos mentioned earlier.

But one good thing is as you can see all the textures shown on a tab you will know that while the model will convert correctly to OBJ for use in the GLB DDD tool, if there is more than one texture then you will not be able to texture the DDD object correctly when loaded into GLB.

Of course this only applies if you use other peoples models as GLB can only load a single texture plus a bump texture I think.

So to me I think this is a handy tool that I will use quite often to check anything I create has been exported to OBJ like normals & such, also how many textures where created in the export process etc. As we know some 3d apps export to OBJ isn't perfect (C4D springs to mind) so this is a quick & easy way to check.

Lee

#25
There is no way in the program to merge or bake the textures on export so that would have to he taken into account. Same thing would happen in any 3d app if there are multiple textures.

As far as I'm aware the ddd tool just converts the mesh only & multi texturing is not part of the command set in GLBasic from what I can work out. Probably could be achieved in OpenGL though but I don't know enough about that either lol.

Lee
#26
If you look close you'll notice a gap around the main top body part (as well as other areas). The 2nd pic has the vertices shown to make it show up more. If you look at the yellow symbol on the back of the spider & follow it towards the head on the right you will see it.

It is definitely the texture used as like I said it exported 4 in total & that yellow graphic should be at the rear only. However if there was just one texture for the entire model it would be fine as the 1st pic with no texture loaded doesn't have the gaps.

Lee
#27
Ok I exported the spider to OBJ format from Open3mod & used the GLB tool to convert it to DDD.

Attached are 3 screenshots, 1st is object loaded into AGOSA without texture, 2nd is with texture, 3rd is the OBJ loaded into blender. You will notice that the 2nd screenshot in AGOSA has some gaps between the polys which are not present in the 1st screenshot. This I think is down to the texture as the exported object has 4 textures in total & I just picked one of them, will have a look at Open3mod to see if it's possible to export just a single texture.

With regards to loading the DDD into GLB I failed miserably & just got a blank screen, but I did mention earlier my issues with regards to that area  :D.

Lee
#28
Strange as OBJ is a pretty simple file format & well documented.

I tend to use FBX over OBJ if possible in my 3d apps & tbh I haven't really given the glb tool a good play with, what the keyframe buttons are for & converting animated meshes is still a mystery to me. How to create an animated mesh & what file formats best is another thing also with regards to using it in GLBasic.

Lee
#29
I have not tried it yet with regards to converting an object & opening it up in GLBasic mainly because my attempts at 3d in GLBasic are, to be blunt, s**t.

However conversions I have tried & used in 3d packages all seem fine with normals etc being they way they should.

I may have another crack at 3d in GLBasic in the near future once I get my head around my issues.

Lee
#30
He might if you make him a Shrubbery  :D.

Honestly though can't see it happening due to it being limited to some platforms & not all, inline c++ works on all whereas Java doesn't.

Lee