Pyra Learning OpenGL ES 2.0 for Pyra


levi

Still fresh, damnit!
Joined
Oct 6, 2008
Messages
12,473
Location
Somewhere off the coast of the EU
IIRC you can checkout each old release in git, make the changes and commit a change. The old release tag will move to your new commit, and you'll effectively have created a small branch off each old tag. If not, you may need to issue a new git tag to move the old tag. As always if in doubt copy your entire repo first as a backup.
 

kaprikawn

Very Active Member
Joined
Sep 28, 2008
Messages
391
Location
UK
Website
kaprikawn.wordpress.com
Sounds easy enough. I'll create a dummy repo and test it once I get this problem fixed.

On that...pocak was absolutely correct. Everything up to v0.2.6 works if I change mat4() to mat4( 1.0 ) which is a relief.

Everything after that version (where I did a major rewrite for v0.3.0) usually displays the ship but nothing else. So at least I know where to start looking now, probably my mesh class is the most likely candidate.
 

kaprikawn

Very Active Member
Joined
Sep 28, 2008
Messages
391
Location
UK
Website
kaprikawn.wordpress.com
Oh crap, I knew I'd put this on the back-burner for a while, but I hadn't realised I hadn't touched it since June! I've just looked at the timestamp of when I last posted, didn't realise it was that long.

Anyway, I've finally gotten around to fixing my old releases (though I haven't tested them thoroughly so a couple might not work here or there).

I've also done a new release. It doesn't have much added, just some placeholder music and a non-functional enemy. I just wanted to put something up to motivate me to do more I think.

Blog post is here https://kaprikawn.wordpress.com/2018/10/09/learning-to-learn-opengl-es-2-0-part-22-enemy-and-audio/

I've also created a Youtube video of my progress so far :

 

kaprikawn

Very Active Member
Joined
Sep 28, 2008
Messages
391
Location
UK
Website
kaprikawn.wordpress.com
I want to learn this too - someday. Thank you very much for the blogging.
It's very rewarding, but it is rather difficult. If your goal is to make a game, it might be a better idea to learn an engine. Unfortunately there aren't many options for the Pyra, though I expect Godot 3.1 will be able to output to the Pyra and that looks to be a good option with it being open-source. I've been following Godot a bit and the volume of learning materials is starting to pick up. And people whose opinion I respect have good things to say about Godot.

I'm more interested in learning to code better, and learning what is going on under the hood. I've always found it best to learn the basics of a technology like developing HTML in a text editor rather than using something like Dreamweaver (I learned HTML back when Dreamweaver was still a thing that people used). So that is why I keep the amount of external libraries and frameworks to a minimum.

The quality of my blogging could probably be better, but I hope it proves useful to somebody. The approach I'm taking does not seem to be very popular on the internet, you have either OpenGL targeted at desktop, or OpenGL ES targeted at iOS and Android. The learning materials for OpenGL ES targeting the desktop are few and generally hard to find. Even if people don't find my code or blogs helpful, I think the fact that I'm documenting where I'm find resources might still be helpful.
 

klapse

Central Scrutinizer
Joined
Aug 30, 2012
Messages
1,932
Location
Germany
I dream of a simple robotron 2084 with pyra and pandora using gles. Except TWO PLAYER NETWORK PLAY

RWAWR
 

elvissteinjr

Very Active Member
Joined
Jun 19, 2010
Messages
697
Age
24
Location
Germany
It's very rewarding, but it is rather difficult. If your goal is to make a game, it might be a better idea to learn an engine.
Coincidentally I've written my custom engine with SDL2 and OpenGL 1.5 / OpenGLES 1.1 (not 2). It's doable if you keep it 2D (3D, while technically not too far away, has a another bunch of problems to solve), but it's time consuming. It's indeed rewarding (that is after you've sorted out the engine-level bug that randomly appeared out of nowhere).
There's a lot of stuff to deal with and even platform-independent libraries may end up having platform-specific behavior where you don't expect it or some stuff simply needs multiple code paths. Deploying properly for the end user can also take quite some time on some platforms.

But I agree, if you just want to make a game, take an existing engine. But it's kinda nice to have full control and knowledge of what's happening. You can study up documentations a lot, but you know the code you've really written yourself best in the end.
 

kaprikawn

Very Active Member
Joined
Sep 28, 2008
Messages
391
Location
UK
Website
kaprikawn.wordpress.com
I forgot to told you that age ago, have you seen and read this : https://pandorawiki.org/GLESGAE ?
Oh wow, no, I haven't seen that before. For now I just want to get a crappy demo done. But after that I want to go back and do something a little more polished and improve my code quality. This resource looks excellent for helping with that, it looks to be about the same scope that I'm aiming for. One of the main things I want to do is learn data driven design/component-based entity systems, and just reading a bit at the beginning I've seen that mentioned.

Thanks for the heads up, that looks like a promising resource for me.
 

kaprikawn

Very Active Member
Joined
Sep 28, 2008
Messages
391
Location
UK
Website
kaprikawn.wordpress.com
New blog post is up :

https://kaprikawn.wordpress.com/201...-es-2-0-part-24-loading-level-data-from-json/

Level data (enemies, scenary etc.) is no longer hard-coded, I've offloaded it into JSON files. I find writing JSON files and the importing process to be just about the most boring part of coding. That's why it's taken me so long to do this part. Sorry for the delay, it's not a sign that I'm giving up or losing my motivation. More just that this part of the process was incredibly boring for me.
 

kaprikawn

Very Active Member
Joined
Sep 28, 2008
Messages
391
Location
UK
Website
kaprikawn.wordpress.com

hmn

Member
Joined
Mar 8, 2010
Messages
221
You should put up a link to your code. Maybe in that placeholder "Text Widget" that is asking to be customized in the side bar :)

OT: in-browser searching is broken on that site, e.g. "Ctrl-F github" does not find anything, even though the text is clearly there when scrolling down to post 13. An annoying trend on "modern" web sites that want to be an app rather than a web site.
 

levi

Still fresh, damnit!
Joined
Oct 6, 2008
Messages
12,473
Location
Somewhere off the coast of the EU
FWIW, I see no side bar here. Maybe it's that I'm only using a 1080 *wide* screen and I haven't even maximised the browser, or more likely I'm blocking scripts here (but allow CSS that traditionally at least permits sidebars and things like that).

Also, note the OP contains a link to the git repo, which I find is the most convenient way of getting the code, but YMMV.
 

kaprikawn

Very Active Member
Joined
Sep 28, 2008
Messages
391
Location
UK
Website
kaprikawn.wordpress.com

levi

Still fresh, damnit!
Joined
Oct 6, 2008
Messages
12,473
Location
Somewhere off the coast of the EU
Thanks for the update.

The first problem I hit was git pull from the src directory comes back with 'You are not currently on a branch'. I tixed that by doing a git pull . v0.3.7, which fastforwarded my local image correctly, so I skipped the checkout step.

Then my system didn't have sdl2_mixer installed, but that was an easy fix. Finally, running it it built, created a window, hung about for a few seconds not updating it, then crashed with './run: line 53: 6011 Segmentation fault (core dumped) GALLIUM_HUD=".dfps;cpu0+cpu1+cpu2+cpu3;GPU-load;VRAM-usage" ./pyragles'.

If I run it manually by going to the build folder and running .pyragles, I get the following out:
Code:
Initialised 0 gamepad(s)
Changing game state to PLAY
Segmentation fault (core dumped)
Running the whole kaboolde through gdb, I see it crashes on line 26 of this file:
Code:
hread 1 "pyragles" received signal SIGSEGV, Segmentation fault.
0x004d0ac5 in Gltf::init (this=0x679ea0, filename="ship.glb")
    at /home/williain/devt/projects/gles2.0/pyragles/src/gltf.cpp:26
26	  std::string j;
(gdb) l
21	  fs_.read( ( char* )&jsonChunkType_  , 4 );
22	  
23	  binStartByte_ = jsonChunkDataStartByte_ + jsonChunkLength_; // start of binary buffer
24	  
25	  char jsonBuffer[ jsonChunkLength_ ];
26	  std::string j; <--
27	  fs_.read( ( char* )&jsonBuffer, jsonChunkLength_ );
28	  
29	  for( unsigned int i = 0; i < jsonChunkLength_; i++ ) {
30	    j += jsonBuffer[ i ];
I'm not sure why a simple std:string definition on the heap could cause a segfault, especially when a declaration on the heap successfully happens on line 12 of that file apparently, so I think the signal is not actually indicating a fault here. I've never debugged anything multithreaded before so I don't know what happens there.
 

kaprikawn

Very Active Member
Joined
Sep 28, 2008
Messages
391
Location
UK
Website
kaprikawn.wordpress.com
...

I'm not sure why a simple std:string definition on the heap could cause a segfault, especially when a declaration on the heap successfully happens on line 12 of that file apparently, so I think the signal is not actually indicating a fault here. I've never debugged anything multithreaded before so I don't know what happens there.
I've seen segfaults like this I think, I don't think it's on the string definition. Usually it's a problem with it trying to read some JSON that doesn't exist. The JSON is embedded in the .glb file (which is a GLTF2 binary). I downloaded the repo into a fresh directory and compiled it to make sure it worked, but maybe there's still an issue. I'll have to put something in to check for the file before it tries to do anything with it.

Can you see whether there's a file called ship.glb in src/assets?
 

kaprikawn

Very Active Member
Joined
Sep 28, 2008
Messages
391
Location
UK
Website
kaprikawn.wordpress.com
Yes, I have a file called ship.glb in src/assets, sized at 132 bytes and delivered by a change c8db4 on Sunday just past 7pm.
Hmm, yeah, that's just the pointer to the file, it isn't the actual file. It's because it's been uploaded as via LFS I think.

I'll have to do a little reading on how that works, I obviously haven't done it correctly. In the meantime, you could go to https://github.com/kaprikawn/pyragles/blob/master/src/assets/ship.glb and click 'Download' to download the file, and overwrite ship.glb in the assets dir.

EDIT: I think it might be that you need to install git-lfs and then do a
Code:
git lfs fetch
 
Last edited:
Top