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

Earlier I thought that polyvector significantly improves rendering speed, but now I do not know ..
Check it yourself, I uploaded code here:
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:
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

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%
sb_typesize = sizeof(sb_vertex);

FUNCTION SB_clear: something%
DIM SB_vertices[0]

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%

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

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


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]
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?

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

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]
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.
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]
FAQ / Re: New to Mac...
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:
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.
FAQ / Re: First contact
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:
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
end loop

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.
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 "", 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 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 ;)