What is a Command?

BlitzMax Forums/OpenGL Module/What is a Command?

DBlade(Posted 2014) [#1]
I hope nobody considers this a stupid question. I have just finished searching through the 20 pages of topics about OpenGL. I am not new to programming or game design (or even the BASIC Programming Language), but I am new to OpenGL.

I therefore have some questions still. First off, I have noticed many people have refered to "OpenGL Commands". What exactly does "Commands" refer to? I naturally assume (yes, I know what happens when you assume) that what they meant was Functions, am I correct? So therefore a "Command" could not logically refer to "OpenGL-specific" Constants or Variables... am I correct?


DBlade(Posted 2014) [#2]
Also, as an example for clarification, would "glClearColor(0.0, 0.0, 0.0, 0.0)" be an example of an OpenGL "Command"? (Which is apparently a function call)

What about GL_DEPTH_BUFFER_BIT? (Which is apparently either a constant, variable, or an object)


AdamStrange(Posted 2014) [#3]
yep
glClearColor(0.0, 0.0, 0.0, 0.0)

is an OpenGL command to set the clear colour for the background - google glclearcolor for a better look

GL_DEPTH_BUFFER_BIT

GL_COLOR_BUFFER_BIT and GL_DEPTH_BUFFER_BIT aren't functions, they're constants. You use them to tell glClear() which buffers you want it to clear - the depth buffer and the "buffers currently enabled for color writing". You can also pass GL_ACCUM_BUFFER_BIT to clear the accumulation buffer and/or GL_STENCIL_BUFFER_BIT to clear the stencil buffer.


OpenGL itself is a programming language for graphics cards, there is a good set of beginner info called NeHe:
http://www.blitzbasic.com/Community/posts.php?topic=41689#468105

Once you get familiar with OpenGL you can move on to shaders which is direct programming of the graphics card.

The best advice is to start small and work in tiny steps :)


DBlade(Posted 2014) [#4]
Thx for this response. Wow yeah. Over the last week (and ESPECIALLY over the last 2 days) I have been doing extensive research on OpenGL. Part of the problem is I don't know "how small is small". I suppose for starters I should go through all of the NeHe tutorials, which of course was the very first thing I tried.

But many of the commands (which from your reply, I gather means "functions") were not familiar to me because they are OpenGL-specific, not BlitzMax-specific. I have been searching around for a .pdf of the RedBook anc BlueBook for OpenGL so I can download them to my PC for ease-of-reference, but no luck so far. Ordinarily in a situation like this I would simply drive to my local Barnes & Nobles, sip some coffee, and buy them immediately. But unfortunately i just spent my last couple bucks buying books on Python and Ruby, which I haven't even had a chance to read yet (and it appears as if I won't need Python and Ruby anyway cuz BlitzMax is apparently superior to them when it comes to "simple, straightforward game-design purposes"!)


Yan(Posted 2014) [#5]
BMax ships with:

An OpenGLGraphics mod - To allow the easy creation of a Max2D Free graphics context.

An OpenGL module - This exposes the full OpenGL 1.1 interface.

A GLU Module - This gives you access to Glu.


It should be noted, however, that these mods give access to pretty outdated versions. I'm sure I've seen updated versions of posted here. A forum search should throw something up.


DBlade(Posted 2014) [#6]
EDITTED to make a little bit more sense:

THX for these resources. I am reading them in another browser window as I type.

So far, I've been talking about actual "inline OpenGL commands".

I would like to get my head around the following:

1. It's possible for me to, in theory, put chunks of "inline C", "inline Assembly", and "inline OpenGL" (although I realize its not "language" perse) all into a single .bmx file at the same time ( along with BlitzMax code as well, of course), am I Correct?

2. I would like to know which of the standard, default BM language commands are actually "calls to the BlitzMax Standard Library"?

3. Which standard commands ultimately call OPENGL commands silently/Behind-the-scenes?


DBlade(Posted 2014) [#7]
Ok. I walked away for a few minutes and returned to re-read my most recent question above and realized that it could be misconstrued as retarded, so I revised it for further clarification...

and sorry ahead of time if this is the wrong subforum to post those 3 questions in.

I have also eddited the thread title to reflect the new direction of my question.


Kryzon(Posted 2014) [#8]
Hello.

1. It's possible for me to, in theory, put chunks of "inline C", "inline Assembly", and "inline OpenGL" (although I realize its not "language" perse) all into a single .bmx file at the same time ( along with BlitzMax code as well, of course), am I Correct?

If I'm not mistaken, as long as you make an "extern C" style interface for exporting functions, you can compile C and CPP code to use in BlitzMax by using the mysterious Import and Extern commands.
Then you can import source files to be compiled with your BlitzMax code (which makes the compilation process longer, and needs to use a special compiler), or import object files which are already compiled and will be included\linked for use by your program.
Read more in the IDE: Language Reference -> Advanced Topics -> Interfacing with C.

Also, take a look at some of the work by user Yasha:
- http://blitzbasic.com/Community/posts.php?topic=101999
- http://blitzbasic.com/Community/posts.php?topic=102004

While the official documentation is somewhat superficial, the IDE does have a lot of valuable information about how the language works etc.

2. I would like to know which of the standard, default BM language commands are actually "calls to the BlitzMax Standard Library"?

To establish some context, I believe that the difference between a "command" and a "function" is that, while both perform some computational work, only the function returns a value.
The standard BM language commands and functions are available through the official modules (located in BlitzMax\mod\brl.mod and pub.mod), and since most of these commands are documented with the "BBDOC" tag, they are usually highlighted in a special colour by the IDE when you write them. There are also the standard language keywords of BlitzMax, of which you can't see the source for most as they're made available by the proprietary BCC ("Blitz Command-Line Compiler") compiler.
Inside the IDE, on the right side, you will find a tabber object with "Home, Code and Debug" tabs. The "Home" tab allows you to quickly investigate the available documentation of modules. In the documentation page for a module, at the top of the page there is usually a "Source" link that will take you to the .BMX file that belongs to the module, where you can view how the module works.

3. Which standard commands ultimately call OPENGL commands silently/Behind-the-scenes?

When you set up OpenGL drivers by calling either SetGraphicsDriver( GLGraphicsDriver() ) or SetGraphicsDriver( Max2DGLDriver() ), all of the calls made by the Max2D driver and all of the calls made by the Graphics driver will use raw OpenGL calls, adapted to the platform that you're compiling your code on. It's the use of "drivers" that makes cross-platform functionality available. EDIT: I realize this is wrong in fact. The use of drivers allows for different graphics APIs to be used, so it's not related to the desktop platform.


DBlade(Posted 2014) [#9]
Thanks, Kryzon!

This leaps my understanding ahead by light years. A very good, consise and detailed explanation.

So just to recap, to indicate I understand everything you just said:

1. Stop me if I'm wrong. Everything inside the "mod folder" and the "lib folder" (assuming its a freshly installed BM) could collectively be considered the "BM Std. Library." And these functions act essentially as Syntax Keywords, and are highlighted within the IDE just like the compiler's built in Syntax Keywords are. Correct so far?...


Kryzon(Posted 2014) [#10]
Hello.
If I'm not mistaken, in the BlitzMax\lib\ folder there are only the library files from the MinGW environment for building programs on Windows.
On Mac OS and Linux, these libraries seem to come from other sources.

In the BlitzMax\mod\ folder there are all the module packages that your BlitzMax programs can use. This includes the official packages such as BRL and PUB (which could be considered as the "BlitzMax Std. Library"), but there can also be others such as SIDESIGN (for MiniB3D), MAXGUI, KORIOLIS, BAH, VERTEX etc. for all the different modules that third-parties have made for the language.

You should also look into the Framework statement and the Framework Assistant tool.


DBlade(Posted 2014) [#11]
Will do, thx again!