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

#61
GLBasic - en / Re: Static
2015-Aug-15
I think you simply missunderstood that text. When it did say extern it did not mean extern of of its program, but extern of its scope. In C++ static has several meanings:

  • static inside a function = same as in GLBasic, variable will be kept between function calls, but can not be access from outside of the function.
  • static inside class declaration = create a static member or function that can be used from outside of the class (using the scope operator :: ) even when there is no instance of that class. It is the same for all instances of that class
  • static outside of any function/class = if you write a variable outside of any function or class it will be global (C++ has no keyword global), it can be accessed anywhere in your program, even in other compilation unites (when using the keyword extern). But if you declare such a variable static, then it will be a "global" only in this file/compilation unit, it can be access inside any function in that unit, but not in other ones (even not with the keyword extern).
Remember, that in GLBasic only the 1st meaning of static exist, but not the other two.

Again all variable are for intern use of the program only and can only be accessed with special tools that use some kind of hacky way to break out of its own memory and read other programs memory. But that has nothing todo with the way variable scopes are designed. So I think you just got your text wrong.
#62
Is V14 available in source code, or if not, will it be?

BTW how do you compile, I always get this:
Code (glbasic) Select
*** Configuration: WIN32 ***
precompiling:
*** create process failed
#63
No viewport does not change anything. Fix needed anyway.
#64
GLBasic - en / Re: Static
2015-Aug-14
Quoteby header i mean the top of your program above the main loop where you define most of your globals.
This is just part of what i called the main area, in C++ it will be in the main function. That you did not define a main loop yet (you dont need one) does not change anything. Its simply the main function. And variables inside main function have same scope as variables inside every function, LOCALs/STATICs from main loop are not accessible inside any other function. You can define a GLOBAL anywhere in your program, it does not need to be at top of your main file.

QuoteI did research before sharing this K.
Globals are "extern" accessable....so you can use C++ tools to view data and memory leaks etc.
Static are not accessable this way, even though they are a global.
When you declare a GLOBAL, it gets pushed into a volatile area of your ram, thats how extern can access it....its GLOBAL for the whole computer, not just your program.....that said, this data is not secure.
If you use debugging/hacking/analysing tools you can access any variable in a program, no matter if it was a global, static or local. All are in stored in ram and ram can be read out completely by programs with high enough privileges. But this has nothing to do with globals, like I said you can also read out statics/locals. But without such special tools no variable is readable from outside your program, even not globals. If you still say otherwise I demand a prove/link.
#65
1. On windows SETSCREEN is basically broken. If I use SETSCREEN to change window size, the window gets created in the requested size, but the render area is only of the screen size that is set in project options. So if project options screen size is smaller than SETSCREEN, then there is a black (or other color set with CLEARSCREEN) border, if project settings is bigger than SETSCREEN, part of the screen gets rendered outside of the windo, so its not displayed fully.

2. Fullscreen not working. If I set fullscreen using SETSCREEN, I just get a fullscreen blackscreen, nothing is displayed. Setting fullscreen in project settings just gets ignored and does nothing changes, it gets rendered normally in windowed mode.


All tests only done on windows, no idea about other platforms.
#66
Off Topic / Re: Windows 10
2015-Aug-13
Quote from: erico on 2015-Aug-12But a full OS stealing everything?
Ever heard about Android? A whole OS made by a tracking company, which only made it to get more data about you, so it can sell better advertising targets to its customers (customers are those that buy add space and pay google, you are just a data deliverer, no customer). BTW I dont blame Android to be worse then anything else, I just point out, that Microsoft is just following a trend.
You also should worry about your browser, if you dont configure it very carefully and block many "services" you just let it hand out extremely large data about you, by just surfing sites, even if you dont log into anything.

At Win10:
what I find the most fun are updates. In the last months Microsoft had problems with quality of updates the had to pull back several because they caused problems, going up to completely destroying the windows installation so it could not boot up any more. But if you got informed about that fast enough, you could decide to not install this updates. What did Microsoft with Win10? Enforce all updates, you can not cancel out individual ones, it will automatically install all updates. Well done Microsoft, creative solution.

Quote from: bigsoftylink=topic=10384.msg91758#msg91758 date=1438770613Here is a quick guide to removing some of the built in malware... https://fix10.isleaked.com
Thank you for that link, did help to setup my testing win10.
#67
GLBasic - en / Re: Static
2015-Aug-13
Quote from: HemlosLocal is tricky..and interestingly enough..
No, LOCAL is easy and the way to go, see below.

Quote from: Hemlosheader
Actually I wonder what you are talking about Hemlos, what is a header in GLBasic? GLBasic only has .gbas files, no differentiation between headers and implementation files.

Quote from: HemlosGLOBAL  // can be accessed outside the program GLOBAL to the computer.
This is just simply wrong. A GLOBAL can not be accessed outside of the program, all variables are just for internal use of the program. If you want something to be accessed from outside you could set a environment variable or write to a file or something... Generally this should be avoided of cause.

Ontopic:
You can only create LOCAL variables inside the main area (in the main gbas file, above the 1st FUNCTION/SUB) or inside a function/sub. The scope of a LOCAL variable is always local to that area where it is defined, that means you can only use it from that area. If you call a function that contains a LOCAL variable the variable gets created and when the function is done and returns to its caller, the variable gets destroyed.

STATIC variables get created in a local scope to, just like a LOCAL variable. Only difference to LOCAL is, that a STATIC variable gets not destroyed when its containing function is done and return. So you can save its value between function calls. But you still can not access it from outside of the function. So STATICs are the way to go if you need to save data between function calls, that are only needed inside that function.

GLOBALs are defined globally (yes really!) that means you can read or write to them from everywhere inside your program. You can define a GLOBAl everywhere, even outside of any function or the main scope. You should never have a variable with the same name of a GLOBAl, because this shadowing can really confuse readers of your code and my be a huge source of bugs. So creating a GLOBAL somewhere actively limits the names of variables that you use anywhere in your project, so if you create one, give it a long and meaningful name. Also being able to access and change the value of a GLOBAL everywhere in your program can be a huge source of bugs, if anything changes that value and you can have a really painful time searching that bug. So generally advice is: avoid GLOBAL when ever possible, think twice or even 3-4 times if you can find any way to avoid a GLOBAL, replace it with a static or pack all your data that belongs together in the same type. Globals are evil most times.

-> LOCALs should be the tool that you use 99,99% of your time. Really dont use anything else, unless really needed. Then try to use static, or pack the data in a TYPE and declare this one LOCAL. BTW types... they are just normal variables. Soyoucan declare an instance of a type LOCAL, STATIC or GLOBAL as any otehr variable too. Of cause you should declare it LOCAL when ever possible.

BTW all this was about variable scope in GLBasic. In c++ its a bit different (but the ban on global vars is just as important too) and the keyword static has a totally different meaning! So a C++ article about static would not help you that much in GLBasic.
#68
Hmm thats a clear fail by Google. :rant:

Checking the maximum texture size before loading generally is not a bad idea. Best way to do it is:
Code (glbasic) Select
int maxsize;
glGetIntegerv(GL_MAX_TEXTURE_SIZE, &maxsize);


BTW OpenGL ES 2.0 requires GL_MAX_TEXTURE_SIZE to be at least 64x64 pixels, while OpenGL ES 3.0 requires a minimum of at least 2048x2048. So Google limits you to the lowest possible value... I would guess this is because of the support for cheap devises with cheap GPUs that have small RAM and low bandwidth. So basically they are nerving high spec devises in favour of cheap ones. Will be fun when there are devices with higher resolutions than 2048 (what about TV sticks on a 4k display?), they can not even load a fullscreen texture, or do easy screen capture... I expect Google to drop this limitation (if it ever gets implemented in final code), because its just plain stupid.
#69
Actually those limits are defined in drivers, I dont think GPU vendors will remove support for 4k textures, just cause Google allows them. Usually drivers implement more then just the pure limits. We will see what happens in reality.
BTW space, why drop details, cant you simply tile your background by splitting your 4k texture into 4 2k ones?
#70
Did set a new Password for old account by request.

I think its quite possible, that most (if not all?) mails get not send. Im manually check+activate new registered accounts 1-2 times a week, dont know if thats all that registers. I remember that there were issues with emails in the past, no idea if that ever got fixed.
#72
Yeah well done, nice effect and good coding, thats how to use POLYVECTOR.
#73
I feel like Im the only Admin that checks user activation and spam accoutns from time to time (1-2 times a week), but Im not here on every day, sorry...

I did activate plasma2 and he should have gotten an email. Would be interesting to know if our forum still does not send emails... I can also set+send him a new password for his old account, if he wants. If I should do this he needs to write me an email or PN from that new account.
#74
Hi and thank you for your feedback. I did not try your code, but I did read your review. I want to add a few points (that you probably found out since you started anyways, but who knows):

  • You can use all premium features in free version too, not only all build targets (like you tried with HTML5), but also all other features like 3D, network, Inline etc. Then your program will be build in Testmode and only run for a few minutes, but thats enough to learn and test those features.
  • Its correct that GLBasic does not support full OOP (at least not without Inline C++), but you can add functions to Types, so you can accees your types/classes data with this methods. So thats at least some basic OOO and it really helps to keep your project structured, design logical modules and avoid code duplication.
  • IMHO HTML5 development stopped in the middle and was never really finished. But the last time I tried it (ages ago) it was working (and running in browser of cause) to some basic degree. You just need to follow some special way that HTML demands your project to be layouted, just compiling your normal GLBasic program would not work unfortunately. Check this Thread
  • Also note that there was a Community approach to write a GLBasic HTML5 compiler that worked pretty well. See this thread from there you get to his personal website, the project website and the Github project. Note that I did not try it for ages.

hope this will help you, in case you decide to stick here for some more time.
#75
Really you did not know that colors are just integers? RGB just creates one integer, of cause you could do normal math with it. That integers is represented this way (including alpha, which RGB lacks, but GLBasic uses internally):
Code (glbasic) Select
// each color component value must be <=255 and >= 0!
// all of those do the same:
abgr = ASL(a,24) + ASL(b,16) + ASL(g,8) + r
abgr = a*POW(2,24) + b*POW(2,16) + g*POW(2,8) + r
abgr = a*0x1000000 + b*0x10000 + g*0x100 + r
abgr = a*16777216 + b*65536 + g*256 + r

So you can use this knowledge the other way around,  to get the r,g,b,a parts of an abgr integer (that info is in the help file too):
Code (glbasic) Select
r = bAND(abgr, 0xff)
g = bAND(ASR(abgr,8), 0xff)
b = bAND(ASR(abgr,16), 0xff)
a = bAND(ASR(abgr,24), 0xff)


So now that you know that colors are integers between RGB=(0...16777215) ARGB=(0...4294967295) its quite easy to make colors random: rgb = RND(0...16777215)

But of cause there is no logic behind adding colors (besides randomisation maybe), especially if you do it in a way that one color component overflows 255 and changes an other component.

Also note that the GLBasic function RGB() gets translated to a C++ macro, this means it will be solved at compile time. If you use RGB with just static number literals that are known at compile time, the compiler calculates the final integer from it and builds that into your program - So there is not now slowdownin using RGB(255,255,255), but its saver and better readable than 16777215. So bottom line is: dont do math with that integer, its not what you want to do in most cases.