Welcome, Guest
You have to register before you can post on our site.



Search Forums

(Advanced Search)

Forum Statistics
» Members: 46
» Latest member: keejelo
» Forum threads: 174
» Forum posts: 599

Full Statistics

Online Users
There are currently 21 online users.
» 0 Member(s) | 20 Guest(s)

Latest Threads
Online sourcecode files ?
Forum: Scratchpad Games
Last Post: Brian Beuken
1 hour ago
» Replies: 1
» Views: 6
I ran out of space?? Resi...
Forum: Other SBC's
Last Post: jomoengineer
04-16-2019, 03:44 PM
» Replies: 7
» Views: 1,651
New Jetson....
Forum: Other SBC's
Last Post: jomoengineer
04-15-2019, 05:36 AM
» Replies: 3
» Views: 192
installing STB and GLM
Forum: General Chat
Last Post: jomoengineer
04-15-2019, 04:13 AM
» Replies: 2
» Views: 580
Banana Pi zero
Forum: Other SBC's
Last Post: Brian Beuken
04-14-2019, 05:24 PM
» Replies: 3
» Views: 913
Can't install on Ubuntu?
Forum: Help my code won't work??
Last Post: Brian Beuken
04-14-2019, 01:18 PM
» Replies: 0
» Views: 50
RockPro64 4GB
Forum: Other SBC's
Last Post: Brian Beuken
04-14-2019, 11:00 AM
» Replies: 7
» Views: 282
Start without debugging e...
Forum: Help my code won't work??
Last Post: Brian Beuken
04-11-2019, 03:50 PM
» Replies: 1
» Views: 50
Dear Imgui
Forum: Assets, Tools, Libraries and other useful things
Last Post: Brian Beuken
04-10-2019, 01:04 PM
» Replies: 1
» Views: 75
What do you find hard to ...
Forum: Scratchpad Games
Last Post: Brian Beuken
04-03-2019, 03:50 PM
» Replies: 5
» Views: 452

  Online sourcecode files ?
Posted by: keejelo - 5 hours ago - Forum: Scratchpad Games - Replies (1)

Hi, I've recently bought your book and I enjoy reading it.  (The Fundamentals of C/C++ Game Programming using targetbased.. SBC's 1st ed.)

I've been coding alot of stuff for many years, as a hobby, but I still feel like a newbie in some areas of c/c++   Smile

I'm currently coding my own game/engine from scratch and the book has helped me getting forward with my own code.

I was wondering if there was any online sourcecode to download ?   It would really help to see how all the code in the book fits together.

I've been looking, but I can't seem to find any code to download..


Print this item

  Can't install on Ubuntu?
Posted by: Brian Beuken - 04-14-2019, 01:18 PM - Forum: Help my code won't work?? - No Replies

Depending on the version of ubuntu you may come accross this error when trying to install bullet or mesa libs

Unable to lock the administration directory (/var/lib/dpkg/), is another process using it?

This is nearly always caused by the Ubuntu updater being active in the background, which is the other process it's asking about, and doing exactly what its designed to. Unfortunately while its doing it, there's nothing you can really do, it has a priority over the directories while its in progress.

On the 1st run, the updater is downloading and installing any updates, so you just have to wait for it. Once its done (this can take up to an hour), you can usually go to your system updater via the System->Administration->Software Updater and switch off the auto updates.
Annoyingly you can't switch them off if an update has alrady started.

Print this item

  Start without debugging error chp 4
Posted by: bergj - 04-11-2019, 03:20 PM - Forum: Help my code won't work?? - Replies (1)

When I start the project (your code from the code download page) without debugging it says "failed to load" and glGetError 0x501. When I start with debugging it runs fine and loads the images. Why is this? Going forward, am I supposed to always run with debugging?

Print this item

  Dear Imgui
Posted by: Brian Beuken - 04-09-2019, 08:48 AM - Forum: Assets, Tools, Libraries and other useful things - Replies (1)

One of my students has been using this on their project I must say it looks rather nice now that I've seen it in action.
Its not massively hard to set up but it does need a bit of effort... Once done though, it gives a very cool input system you can use to set up values/variables in game via a very nice usable menu, scroll bar system


Print this item

  prerequisites for book
Posted by: Guest - 03-26-2019, 09:40 PM - Forum: Scratchpad Games - Replies (1)

Thinking about buying the book but just wanted to know what programming experience is needed.

Print this item

  Using Extensions
Posted by: Brian Beuken - 03-25-2019, 03:39 PM - Forum: Assets, Tools, Libraries and other useful things - Replies (1)

I generally don't use many extensions, but now that we're getting into OpenGLES3.0 its important to make use of them, and they can be confusing.
I just tried to use some on Raspberry and discovered some interesting issues, namely a missing lib called libdl  which needs to be added if you are going to use extensions on a current Raspberry. Not sure about other boards as I don't have one set up, but if you get a link error add dl

Using an extension requires that you set it up first and that is the first minefield, you can of course list the extensions your system supports using somethng like
printf("This GPU supports these extensions :%s\n", glGetString(GL_EXTENSIONS));

Which will give you a nice list of "extensions" for a Raspberry like this. 

This GPU supports these extensions      :GL_OES_compressed_ETC1_RGB8_texture GL_OES_compressed_paletted_texture GL_OES_texture_npot GL_OES_depth24 GL_OES_vertex_half_float GL_OES_EGL_image GL_OES_EGL_image_external GL_EXT_discard_framebuffer GL_OES_rgb8_rgba8 GL_OES_depth32 GL_OES_mapbuffer GL_EXT_texture_format_BGRA8888 GL_APPLE_rgb_422 GL_EXT_debug_marker 

I put "extensions" in quotes becuase these are not the names of the functions but rather a grouping for the extensions actually available. 

This is a mix, some of these extensions are types, and some are functions. The types we don't care too much about just adding #include <GLES2/gl2ext.h> will give us access to the types that are associated with that name....for example "extension"  GL_OES_rgb8_rgba8 

* GL_OES_rgb8_rgba8 */

#ifndef GL_OES_rgb8_rgba8
#define GL_RGB8_OES                                             0x8051
#define GL_RGBA8_OES                                            0x8058

Gives us, 2 new defines that are associated with calls that set up RGBA. We can define types just by adding the GL2Ext.h file.
You may have to define the type in your pre-processor but I've not noticed it. It tends to set them all up these days, so be sure you use them in the correct functions.

Functions are a bit harder.  Depending on your system and the current version of the drivers it has,  you have to interrogate the system to get the addresses of the functions, and you also have to create alias values for them.
The Raspberry does not have a lot of extension functions but lets look at one as an example

If we look in the GL2ext.h file for this we find

/* GL_OES_mapbuffer */

#ifndef GL_OES_mapbuffer
#define GL_OES_mapbuffer 0

GL_APICALL void* GL_APIENTRY glMapBufferOES (GLenum target, GLenum access);
GL_APICALL GLboolean GL_APIENTRY glUnmapBufferOES (GLenum target);
GL_APICALL void GL_APIENTRY glGetBufferPointervOES (GLenum target, GLenum pname, GLvoid** params);


typedef void* (GL_APIENTRYP PFNGLMAPBUFFEROESPROC) (GLenum target, GLenum access);
typedef void (GL_APIENTRYP PFNGLGETBUFFERPOINTERVOESPROC) (GLenum target, GLenum pname, GLvoid** params);

Which is a bit confusing.. but what that extension is telling us is that there are 3 functions that relate to it, called. glMapBufferOES glUnmapBufferOES  and glGetBufferPointervOES

What we want to do now is create 3 alias functions, called glMapBuffer glUnmapBuffer and glGetBufferPointerv

We can leave the OES if we want  but tradition states we remove it, Now notice the typedef, and you can also see that the 3 functions return very different types.  void*, GLboolean and void.
and there is somehing called a PFNLGL XXXXXXX PROC where XXXXXXX is replaced by the name of the function..(in caps) That will intenally define what the signature of the function is going to be and ensure we get the right result back from the function. As well as setting up what values are passed.

This is a clunky system but it is how we can create a function and send and recieve the expected values.
We need to define our funciton in an accessable space, I tend to use my graphic class since graphics are most likely to use extensions So if you need to use these outside of graphic routines, make sure you can access the class.


So we've made that..now we have to load it with the address of the function...which is something EGL does for us with a standard function  Again set this up in the graphic class init.

glMapBuffer =  (PFNGLMAPBUFFEROESPROC)eglGetProcAddress("glMapBufferOES");
And now glMapBuffer is available

eglGetProcAddress asks the OpenGLES2 libs if it has a function called glMapBufferOES and of course it has. (it will return null otherwise) So now we can use glMapBuffer as a function like this.  

unsigned char* framedata = (unsigned char*)glMapBuffer(GL_ARRAY_BUFFER, GL_WRITE_ONLY_OES);

Now the function can work as if it is a standard gl function, and GL_WRITE_ONLY_OES is activated as part of its types it needs.
(now, there does seem to be a few issues with mapbuffer on raspberry, but this example still stands on how to make and use an extension)

Each extension has its own PFNGLXXXXXXXPROC make sure you define your alias with that specific typedef and though you can use any name at all, keeping the name of the function with or without the makers value is a good plan to keep it readable.

There a good explanation here https://community.nxp.com/docs/DOC-101502

If you are going to use extensions, then it means you can only be certain that your code may only run on the same systems you build it on. That means you need to be careful if running on a similar, or older, or ever newer machine to check that the extension is available, if not you need to either not use that function, or use a different method. Never assume that becuase a Raspberry has a function, that an Odroid or a Nano Pi also has it.. Make sure when you use an extension to provide an alternative. Preferably not a crash

Here's some useful info on extension being available. though this is for windows so uses wgl not egl and talk of nvidia is a bit optomistic for SBC's Big Grin

Print this item

  New Jetson....
Posted by: Brian Beuken - 03-19-2019, 09:02 AM - Forum: Other SBC's - Replies (3)

oh moma

no info on where to buy yet, but oh moma, this is amazing. 
I've been after a jetson for a while but they are so expensive, this expected price brings it into my sub $100 range so can't wait to get my hands on one. The CPU is awesome, but that GPU, oh man that GPU.


Print this item

  Intellisense issues
Posted by: Brian Beuken - 03-18-2019, 12:29 PM - Forum: Getting started - Replies (1)

Oh this is a good one, one of my students was struggling with lots of errors being tossed out that it could not find GLuint or glm. It appearred to be unable to find the files and associated variable types.

This in part was true, however it was Visual Studio's intellisense that was getting things mixed up and in his case he had a genuine minor code error, which resulted in a failure to compile. His error list however was throwing up all the cannot find file issues and he assumed that there was some issue there and didn't get into his code

So his true minor error, was hidden under dozens of other errors, which in fact were not errors, but reports from intellisense. scary.

The error itself was highlighted clearly in his compiler output window, since it reported the compilers issues, which is better to check than the error window which reports visual studios issues, including intellisense. You can filter just the build errors though.

The reasons for this are somewhat annoying. When you set up a connection to a Pi, or other linux system it is supposed to syncronise the files on the Pi and keep copies of the include files on your Pc to allow intelisense to work, but the connection manager only loads the usr directory....which excludes any addition directories, like bullet or glm as well as some directories unique to Raspbian, such as opt/vc/include which is where GLES2 lives...... so these files appeared to be unreachable and unloadable to VS2017. But when sent to the target to compile they happyily find the directories where we say they are in the directory lists sent with the make file

The sync really should pull in all directories used by the project, so this is an error in the system I will report to Microsoft, perhaps its been fixed in VS 2019. I will review the preview copy

Microsoft do suggest you copy other folders manually, but really its not an obvious fix and I hope they can correct this to allow for an automatic update, like VisualGDB does

Print this item

  Page 94 is different from 95 Names[i]
Posted by: Brian Beuken - 03-16-2019, 04:04 PM - Forum: Fundamentals Errata/Questions - No Replies

Hmm yes it is, most of the code in those pages is descriptive rather than code you have to expressly type in.. I see now (from my student Kim who's struggling a bit) that its obvious to an experienced coder but not a very new coder.

So, my bad, for not being as clear as I need to be.

At the start of the discussion on page 94, I'm using a constructor like this

Aliens::Aliens(char*, MyFiles*);

Where the char* passed would be an entry from the Names[] array.

But by the bottom of 95 I am using Aliens(int, MyFiles*)
where I am only passing the i rather than the full string in names. I wrote a different constructor which then used the array...I'll change that back to avoid confusion.

That was me optimising the code a little later and pasting in the new version, but either way, here's a bit of advice, don't slavishly type in the code, there's intended to be a little room for you to adapt it to your needs, which is great if you know C++, but clearly very confusing if its all new to you. I'm sorry about that but I have said before this is not a book for absolute beginners.

Use which ever method you want, I expect you to write your constructors and call them as you choose, I've detailed both ways but not shown all the code. I'll review that though and make sure I only show one working way, so that beginners don't get confused and expect both constructor calls to work with only 1 type of constructor.

Also you don't need to create an AlienList I'm simply explaining how we "could" use arrays to hold our enemies, but we'd end up needing multiple arrays for different things, which leads us on to using a MyObjects vector to hold, almost all of them...

A lot of the books source code from Chapter5 on, is there to be descriptive and is mostly incomplete, sometimes partially lifted from source code, you should have the C++ skills to evaluate it and fill in a few blanks or change a few bits to suit what you are doing.

But if anything isn't clear, please just let me know I'm always happy to explain and push you pass a confusion roadblock, all beginners get them and I'm happy to help.

Print this item

  Connecting a Pi to a Pi?
Posted by: Brian Beuken - 03-15-2019, 05:43 PM - Forum: General Chat - Replies (14)

I'm never really going to get my head around the idea that people will actively refuse to use the best systems, because they hate Windows, or hate MS or hate VS or hate PC's or whatever, thats just being stubborn and self damaging for not valid reason. But I do accept that some people simply may not have access to a PC running windows.

But for me there is no doubt that having 1 machine as your dev system and one machine as your target is far and away the simplest way to code any kind of project.

So here's a question....how could I set up a Raspberry Pi, to run an IDE, (preferably code::blocks or similar) and have it build then send code to another Rpi to run and debug?

Since SSH connections between Pi's are perfectly possible, and GDB is also available, how can we recreate the functionality of VisualStudio/VisualGDB with a pair of PI's?

Or indeed any other SBC..

I'm very curious to know what people here think.

Print this item