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.


Messages - dreamerman

Pages: 1 ... 17 18 [19]
271
GLBasic - en / Re: Array speeds
« on: 2012-Feb-28 »
Interesting topic, so just for comparison same code in FreeBasic:

Code: GLBasic [Select]
dim as double TimeStart, TimeEnd, TimeTaken, DummyVar
dim as integer n,n2, i, j, k
n=250
n2=10000
reDIM as integer TestData3d(n,n,n)

cls
sleep 1000
PRINT "Writing Data to the 3d array"

'' Fill 3d array in Column order
TimeStart = timer()
FOR k=0 TO n-1
        FOR j=0 TO n-1
                FOR i=0 TO n-1
                        TestData3d(i,j,k)=0
                NEXT
        NEXT
NEXT
TimeEnd = timer()
TimeTaken = TimeEnd - TimeStart
PRINT "Column order took = "+str(TimeTaken)

'' Fill 3d array in Row order
TimeStart = timer()
FOR i=0 TO n-1
        FOR j=0 TO n-1
                FOR k=0 TO n-1
                        TestData3d(i,j,k)=0
                NEXT
        NEXT
NEXT
TimeEnd = timer()
TimeTaken = TimeEnd - TimeStart
PRINT "Row order took = "+str(TimeTaken)

sleep 1000
PRINT "Reading Data from the 3d array"

'' Read 3d array in Column order
TimeStart = timer()
FOR k=0 TO n-1
        FOR j=0 TO n-1
                FOR i=0 TO n-1
                        DummyVar=TestData3d(i,j,k)
                NEXT
        NEXT
NEXT
TimeEnd = timer()
TimeTaken = TimeEnd - TimeStart
PRINT "Column order took = "+str(TimeTaken)

'' Read 3d array in Row order
TimeStart = timer()
FOR i=0 TO n-1
        FOR j=0 TO n-1
                FOR k=0 TO n-1
                        DummyVar=TestData3d(i,j,k)
                NEXT
        NEXT
NEXT
TimeEnd = timer()
TimeTaken = TimeEnd - TimeStart
PRINT "Row order took = "+str(TimeTaken)

'' Clear 3d array from mem & create 2d one
redim TestData3d(0,0,0)
reDIM as integer TestData2d(n2,n2)

sleep 1000
PRINT "Writing Data to the 2d array"

'' Fill 2d array in Column order
TimeStart = timer()
FOR j=0 TO n2-1
        FOR i=0 TO n2-1
                TestData2d(i,j)=0
        NEXT
NEXT

TimeEnd = timer()
TimeTaken = TimeEnd - TimeStart
PRINT "Column order took = "+str(TimeTaken)

'' Fill 2d array IN Row order
TimeStart = timer()
FOR i=0 TO n2-1
        FOR j=0 TO n2-1
                TestData2d(i,j)=0
        NEXT
NEXT

TimeEnd = timer()
TimeTaken = TimeEnd - TimeStart
PRINT "Row order took = "+str(TimeTaken)

sleep 1000
PRINT "Reading Data from the 2d array"

'' Read 2d array in Column order
TimeStart = timer()
FOR j=0 TO n2-1
        FOR i=0 TO n2-1
                DummyVar=TestData2d(i,j)
        NEXT
NEXT

TimeEnd = timer()
TimeTaken = TimeEnd - TimeStart
PRINT "Column order took = "+str(TimeTaken)

'' Read 2d array in Row order
TimeStart = timer()
FOR i=0 TO n2-1
        FOR j=0 TO n2-1
                DummyVar=TestData2d(i,j)
        NEXT
NEXT

TimeEnd = timer()
TimeTaken = TimeEnd - TimeStart
PRINT "Row order took = "+str(TimeTaken)

sleep

And my results on P E2180 (repeated several times):
Code: GLBasic [Select]
                GLB             FB
writing to 3d array
column order:   0.170 sec - 0.703 sec
row order:      0.699 sec - 0.089 sec
reading from 3d array
colum order:    0.137 sec - 0.65 sec
row order:      0.120 sec - 0.086 sec
writing to 2d array
column order:   0.986 sec - 8.092 sec
row order:      6.791 sec - 0.808 sec
reading from 2d array
column order:   0.656 sec - 5.20 sec
row order:      0.684 sec - 0.455 sec

So basically in GLB is better to use column order :)

272
There are two basic issues with in-app ads. Maybe there are some methods to show webview/browser window with ad but it requires to wrote some crazy code in c++. Ads system could be made in pure GLB but app need to display animated gif-s correctly (some ads are normal banners but other include animations), so someone need to wrote gif to sprite loader or something like this.
Secondly, when app sends request for new ad it also passes 'User Agent' string as parameter, and it should be at least similar to 'user agent' that will be passed by browser used to open ad link, of course there are also other parameters but they are not a problem. This problem can be bypassed with for example build in ua strings for particular platform.
On other hand probably all banner/text based ad request are simple get/post request that could be done in glb, so main problem is gif loading, at least for me.

273
I think that Bada would be a better option.

The problem with Symbian is such that the most of devices (even now sold with this system) are old type old phones - nontouch small screen, keyboard/numpad, and are intended for 'emerging markets', and most common used dev language is Java - due to differences in phones and issues with publishing. Of course there are normal touch phones, but only few models have hardware acceleration and support for OpenGL (around a dozen models). When it goes to numbers, Nokia informs that there is around 155 milions of QT devices (not all Symbian just newer -> Symbian S60 and MeeGo.. 3 categories: new touch with OpenGL - N8/N9, older touch without gpu like Nokia 5800 and classic models like E65) but in true there is probably more classic phones than a touch devices. As a reminder I will say that Samsung in 2011 has sold more over 300 milions smartphones (mostly on android).
But on other hand for better devices most of top games is made by 'big companies', small dev studios are mainly focused on java games that will work on older phones, and many such games have crazy prices like $3 for tic tac toe. But to get really big impact our games should work on all touch devices not only these with gpu, that would be hard to do :/ For devices with gpu there is QtGameEnabler solution that as they said make developing simpler. Never tried cause I have Nokia 5530 without gpu :>
Aaa.. I almost forgot about it.. in Ovi/Nokia Store you can't publish games to South Korea Oo.. and self publish to China - you need some intermediary or as they tell an 'accumulator', that takes most of you earnings from that market ;]

About Bada. it's growing market, but also here not all devices have gpu so I don't know how fast games work on such phones (on Symbian phones without gpu you can't run opengl games, they just dosn't start). But there are also Smart Tv based on bada or something similar and they also could be the market for us.. Bada is more uniform system than Symbian

274
Code Snippets / Re: new QSIN (QQSIN)
« on: 2011-Jun-09 »
Don't forget about 'Lookup-table based SIN' by Ocean: http://www.glbasic.com/forum/index.php?topic=2855.msg20951#msg20951

on my pc:
m_qsin (Ampos) -> 564ms
Sin GlBasic -> 1772ms
QQSin -> 488ms
QSin -> 996ms
tSin (Ocean) -> 538ms

QQSin isn't so precise as tSin but for most calculations it would be ok..
Good job :]

275
Earlier I thought that polyvector significantly improves rendering speed, but now I do not know ..
Check it yourself, I uploaded code here:
http://www.glbasic.com/forum/index.php?topic=6341.msg51408#new
maybe I'm doing something wrong..


Yesterday I saw some old post about slow 3d on iPad with Glb, so today I was searching for some OpenGl speed-up improvements that could be adapted into Glb. I found that:
http://www.youtube.com/watch?v=VNr5I3ZRecE
I don't know how exactly StartPoly, Polyvector works, but would be faster to draw for example map tiles with glDrawArrays? My c++ and raw OpenGl skills are low, so I only managed to rewrite some code from that video:

Code: GLBasic [Select]
TYPE sb_vertex
        v#[2]
        uv#[2]
        color%[4]
ENDTYPE

GLOBAL SB_maxverts%, sb_currvert%
GLOBAL SB_vertices[] AS sb_vertex, sb_typesize%

FUNCTION SB_init: ver_count%
        DIM SB_vertices[ver_count%]
        sb_currvert% = 0
        SB_maxverts% = ver_count%
        INLINE
                sb_typesize = sizeof(sb_vertex);
        ENDINLINE
ENDFUNCTION

FUNCTION SB_clear: something%
        DIM SB_vertices[0]
ENDFUNCTION

FUNCTION SB_addvertex: posx#, posy#, uvx#, uvy#, vcolor%
        SB_vertices[sb_currvert%].v#[0] = posx#
        SB_vertices[sb_currvert%].v#[1] = posy#
        SB_vertices[sb_currvert%].uv#[0] = uvx#
        SB_vertices[sb_currvert%].uv#[1] = uvy#
        //SB_vertices[sb_currvert%].color% = vcolor%
        SB_vertices[sb_currvert%].color%[0] = 255
        SB_vertices[sb_currvert%].color%[1] = 255
        SB_vertices[sb_currvert%].color%[2] = 255
        SB_vertices[sb_currvert%].color%[3] = 255
        INC sb_currvert%
ENDFUNCTION

SUB SB_draw:
IF (sb_currvert = 0); RETURN; ENDIF

//glEnable(GL_TEXTURE_2D)
//glEnableClientState(GL_VERTEX_ARRAY)
//glEnableClientState(GL_TEXTURE_COORD_ARRAY)
//glEnable(GL_BLEND)
//glBlendFunc(GL_SRC_ALPHA, GL_ONE)

glVertexPointer(2, GL_SHORT, sb_typesize, SB_vertices[0].v#[])
glTexCoordPointer(2, GL_FLOAT, sb_typesize, SB_vertices[0].uv#[])
//glColorPointer(4, GL_UNSIGNED_BYTE, sb_typesize, SB_vertices[0].color%[])
glDrawArrays(GL_TRIANGLES, sb_typesize, sb_currvert%)
sb_currvert% = 0

ENDSUB
 
and to add a rectangular sprite to batch I do this: (assuming that sprite width=height=128)
Code: GLBasic [Select]
SB_addvertex(spr.x, spr.y, 0, 0, white_color%)
SB_addvertex(spr.x+128, spr.y, 1, 0, white_color%)
SB_addvertex(spr.x, spr.y+128, 0, 1, white_color%)

SB_addvertex(spr.x+128, spr.y, 1, 0, white_color%)
SB_addvertex(spr.x, spr.y+128, 0, 1, white_color%)
SB_addvertex(spr.x+128, spr.y+128, 1, 1, white_color%)
 
You need to attach 'GLBasic\Samples\Common\gl.bas' or just download my file..
I'm getting strange results -> misplaced sprites and other crazy things.. Whats wrong in this code, and how get this working correctly? ;]
of course before drawing I set X_Make3d, X_Settexture texnumber%, -1 and X_Make2d after drawing.



[attachment deleted by admin]

276
Code Snippets / Re: Sprite Speed Tester
« on: 2011-Jun-04 »
I changed MrTAToad (I hope You don't mind) code a little - added drawing sprite through Polyvector - both normal and rotozoom, to see what speed up it will give...
And I'm really surprised with results, I expected that polyvector would be much faster - Am I doing something in wrong way?

Use:
?DEFINE USEPOLY 1
?DEFINE ROTOZOOM 1
to change drawing options..

my results:
Code: GLBasic [Select]
Radeon 2600XT   => SIZE = 1000
GF2 mx400 (:DD) => SIZE = 100  (You can compare it to mobile devices)

min_fps / max_fps / mostly
---------------RotoZoomSprie-----DrawSprite-----RotoZoomPoly-----DrawPoly

Radeon 2600XT---56/101/~74------215/222/~218----52/147/~100------215/222/~218
GF2 mx400-------22/32/~25--------30/30/~30-------21/29/~25--------30/30/~30--

[attachment deleted by admin]

277
For this included font You need to set 'max space between merged rects (X Y)' to 6 (X - first textbox) and 20 (for second)...
Also 'base color' must be set to rgb(0,0,0) - black, because bitmap have such background.

278
Hi,
I needed some simple app to change transparent color on sprites and prepare font file, but I have some problems with ImageMagic and I don't know Gimp or other graphic editor scripts so I decided to make my own program. :]
And here it is, it basic function are: auto-cropping images, changing selected base color into final requested color, searching for sprites on image (returning their rect/positions) - and possibility to create glBasic ready to use bitmap font from selected file - there is an attached sample font bitmap made in Gimp.. (for it use rect spacing x=6, y=20)
More info and instructions, examples of code in glB are also included.
:]

It's win32 bin, but should work also on wine in Linux..

[attachment deleted by admin]

279
FAQ / Re: New to Mac...
« on: 2011-May-26 »
Hi, I have some simple but very important questions, because I don't have any Mac comp and I want to start Iphone development in near future, maybe few weeks or little more - first I need to complete my games :)
So what iOS SDK, Xcode and MacOS versions are currently needed for iPhone\iPad development?
On other similar topics:
http://www.glbasic.com/forum/index.php?topic=5023.0
http://www.glbasic.com/forum/index.php?topic=5109.0
I read that probably Xcode 3.2.5 is necessary, and it requires MacOS 10.6 Snow Leopard - I know that it can be bought for quite small money on some auctions, but will it run without problems even on single core Intel based Mac? Or I need some Dual Core CPU?
I live in Poland, Macintosh computers are much less popular than ibm pc's with Windows (because of price :d), so there are much less auctions with them. Used Mac's are much cheaper, but whether can there be some problems caused by this (license or whatever), as I'll be the next owner - apart from the hardware condition. I don't want to spend much money on modern Mac, therefore such questions.
Thanks for any info.

280
FAQ / Re: First contact
« on: 2011-May-26 »
I also recently bought glbasic. But I have different feelings, I am fully satisfied with the purchase. Before buying I checked the demo version, so easily I could compare it to other languages.
The first issue, a help file has some lacks, but it contains enough to work on most things, an additional description of the manual is available also on this www: http://glbasic.un-map.com/
you can always use forum, because it is the best source of getting help.
For each tool, where a group of developers is small, occurs similar problem - but better is if they fix bugs and add new functionality than create very extensive help files, at least this is my opinion.

As for the speed of displaying graphics. glBasic is based on OpenGL - some older / integrated graphics cards are much slower than in DirectX (but I think that you have fast GFX), the second issue are default not much optimized rendering routines (sprites) and it is the true bottleneck - not the CPU (more on that later). Most important things are the rules for optimized rendering - apply to any language and tool, don't change currently used texture to frequently, and don't use unnecessary functions many times. More sophisticated tools like XNA have probably built-in support for this what is called 'sprite atlas / sheet', and because of this, in some situations, you do not need to write optimized rendering functions by yourself, but in pure C++ and DirectX/Ogl you have to tweak these aspects. So here glBasic does not deviate from them, simple functions DrawSprite etc. should be regarded as a quick way to test something, but you should use more optimized methods, such as for example:
Code: GLBasic [Select]
Startpoly tex_id%, 2
loop throug visible map part
draw tile
polynewstrip
end loop
endpoly

of course in this case this loop need to be fast in other way there will be some slowdowns..
For these reasons glBasic may seem slower than, let say, XNA, but it is not, you just have to code the optimized rendering procedures.

As for mentioned performance, 'SpriteSpeedTester' probably uses built-in sprite commands so its slow, the results:
Pentium E2180, Radeon 2600XT -> 55-105fps
Pentium 4 ~ 2Ghz, crazy old Geforce 2 MX400 -> 3-6fps: D
One Thing That this GF2 is slower in OpenGL, but more important That this code is unoptimized, with some simple game with a little optimized code (some drawsprite/anim and other, it could be faster) I get ~30fps in 1024x769 with 32bits, to compare with same game written in VB6 (also some optimizations, some rendering via 3d) with DirectX 8.1 I get ~45fps..

As you already noticed glGasic is really easy to learn and you only need a bit of time to tune rendering routines for a specific game.

281
GLBasic - en / Re: License code
« on: 2011-Apr-14 »
I'm new to glbasic.
I also have a problem with the license key. Last week I bought a Premium license, received the code, I thought that everything will be ok, but I have the same problem as described above.
The code does not work - email remains in the registration window, entering the code changes nothing, programs are compiled in the demo mode (using inline c++ does not turn on demo mode, only the Net commands), from what I see, I can also compile the projects for other platforms than the demo version permits.
As for the license file in "%temp%\glbasic" it's called "glblicence.inc", removing it does not change anything, deleting the entire folder and reinstalling the SDK (latest 9.033) together with cleaning registry keys also doesn't help.
Another thing, the codded e-mail (in glblicence.inc) is probably too long - 2 times longer than the email address transformed into hex value with "\x", I do not know whether it should be.
There is no way to enter license code, please help ;)

Pages: 1 ... 17 18 [19]