Go to advanced search

by jmacey
Tue Apr 30, 2013 5:19 pm
Forum: Automation, sensing and robotics
Topic: Portal Turret Student Project
Replies: 0
Views: 2479

Portal Turret Student Project

Our 2nd year BSc Software Development for Animation, Games and Effects students have built a portal turret using a Raspberry Pi, OpenCV and a web cam to track and fire on people in the room. It uses 3 arduinos to control the servos and nerf guns. They are currently writing up a making of but though ...
by jmacey
Tue Apr 30, 2013 5:11 pm
Forum: OpenGLES
Topic: Submission to Open GL ES
Replies: 2
Views: 2126

Re: Submission to Open GL ES

as long as the class data is flat / packed in the right way you can use it, I use it a lot in my code, For example class Vec3 { public: #pragma pack(push,1) union { struct { GLfloat m_x; GLfloat m_y; GLfloat m_z; }; #pragma pack(pop) GLfloat m_openGL[3]; }; }; // as std::vectors are contiguous and o...
by jmacey
Wed Feb 20, 2013 7:15 am
Forum: OpenGLES
Topic: piNGL on google code
Replies: 7
Views: 2608

Re: piNGL on google code

It's under GPL feel free to use it but let me know what you use it for so I can add it to the list on the website.

I've not had a chance to update things lately as it's term time but will have some changes / bug fixes to add soon from my main desktop branch
by jmacey
Thu Oct 18, 2012 9:55 pm
Forum: HATs and other add-ons
Topic: test programs ?
Replies: 7
Views: 8557

Re: test programs ?

It looks like it's a tar.gz file you can extract it using

tar vfxz gertboard_sw_10_07_12.tar.gz

where v -> verbose
f specifies a file is being passed on the command line (default tar looks for a physical tape device)
x extract
z pass through gzip first
by jmacey
Sun Oct 14, 2012 6:02 pm
Forum: OpenGLES
Topic: Creating 3D characters and making textures
Replies: 30
Views: 6165

Re: Creating 3D characters and making textures

the mtl file is a material template file, it contains the parameters for shaders used in the creation of the model, you could use them in your glsl shaders as parameters for Ambient, Diffuse and Specular, look at the Obj spec here if you haven't already http://en.wikipedia.org/wiki/Wavefront_.obj_fi...
by jmacey
Sat Oct 13, 2012 11:37 pm
Forum: OpenGLES
Topic: Creating 3D characters and making textures
Replies: 30
Views: 6165

Re: Creating 3D characters and making textures

OpenGL ES is a subset of OpenGL and for what you are talking about are very similar. I think the main conceptual problem you have is that OpenGL (all variants) are basically triangle renderers with a the ability to process either via the gpu and shaders of the fixed function pipeline lights and a li...
by jmacey
Sat Oct 13, 2012 9:11 am
Forum: OpenGLES
Topic: Creating 3D characters and making textures
Replies: 30
Views: 6165

Re: Creating 3D characters and making textures

That is a blender file the format is here http://www.blender.org/development/arch ... le-format/ however it would be easier to load it in blender (you would need another computer as the pi will not run blender) and export it into an easier to read format such as obj
by jmacey
Sat Oct 13, 2012 8:56 am
Forum: OpenGLES
Topic: Creating 3D characters and making textures
Replies: 30
Views: 6165

Re: Creating 3D characters and making textures

What format are the models in? Basically what OpenGL ES wants is a list of data about the models, usually this is presented in the format Vertices (Vec3) this is the xyz position of the mesh point Normals (Vec3) this is used in lighting calculations, if you only want textures you don't need this UV ...
by jmacey
Sat Oct 13, 2012 7:40 am
Forum: OpenGLES
Topic: Creating 3D characters and making textures
Replies: 30
Views: 6165

Re: Creating 3D characters and making textures

That code looks like it reads it's own data format which I presume is packed into penguinspuzzle.bin file. If you look in the data directory you can see all the models stored as json files and again I'm presuming that the .pi files in the data directory are the textures as raw RGB data. Again not kn...
by jmacey
Thu Oct 11, 2012 6:29 pm
Forum: General programming discussion
Topic: Doing simple keyboard/mouse event loops
Replies: 3
Views: 1300

Re: Doing simple keyboard/mouse event loops

May be worth looking at this http://www.glfw.org/ it does keyboard and mouse input so the source may have some pointers (but I think it uses the X11 libraries). May be worth having a look at how libcurses does things as well as this is the lowest level input lib I can think of http://www.gnu.org/sof...
by jmacey
Thu Oct 11, 2012 6:10 pm
Forum: General programming discussion
Topic: Doing simple keyboard/mouse event loops
Replies: 3
Views: 1300

Re: Doing simple keyboard/mouse event loops

You can read the raw input for mouse using the basic code in the GLES2 demo from the pi source directory static int fd = -1; fd = open("/dev/input/mouse0",O_RDONLY|O_NONBLOCK); then struct {char buttons, dx, dy; } m; int bytes = read(fd, &m, sizeof m); However I usually find it's best to use another...
by jmacey
Thu Oct 11, 2012 6:02 pm
Forum: OpenGLES
Topic: Creating 3D characters and making textures
Replies: 30
Views: 6165

Re: Creating 3D characters and making textures

There are many ways to create models, you would usually use a package such as blender http://www.blender.org/ (open source) or maya http://usa.autodesk.com/maya/ (there is a free learning edition). To model your assets, unfortunately neither will work on the pi. Once you have the models I would sugg...
by jmacey
Mon Oct 01, 2012 7:08 am
Forum: OpenGLES
Topic: Blender error
Replies: 2
Views: 1583

Re: Blender error

I've not tried to run blender but I would presume it will need much more memory / resources than the pi can handle. What error messages do you get when trying to run it?
by jmacey
Tue Sep 25, 2012 7:20 am
Forum: Troubleshooting
Topic: SDL only usable by root?
Replies: 5
Views: 1171

Re: SDL only usable by root?

I just came across this thread when I ran into the same error, you need to add the user to the video and input groups to run without x (and audio if you later need that). I've added a section on my blog as I'm doing an introduction to SDL http://jonmacey.blogspot.co.uk/2012/09/getting-started-with-s...
by jmacey
Mon Sep 03, 2012 11:05 am
Forum: OpenGLES
Topic: How do you pick up keyboard input with OpenGLES?
Replies: 8
Views: 2547

Re: How do you pick up keyboard input with OpenGLES?

In my example above, I first create the SDL window, then the EGL window, only once both have been done do I process the SDL Event loop. Usually the process I use is to do all initial OpenGL setup (load textures, models etc) then go into the event loop, where I process the keys / mouse, update the an...
by jmacey
Mon Sep 03, 2012 10:25 am
Forum: OpenGLES
Topic: How do you pick up keyboard input with OpenGLES?
Replies: 8
Views: 2547

Re: How do you pick up keyboard input with OpenGLES?

can you post the code?
by jmacey
Mon Sep 03, 2012 9:54 am
Forum: OpenGLES
Topic: How do you pick up keyboard input with OpenGLES?
Replies: 8
Views: 2547

Re: How do you pick up keyboard input with OpenGLES?

I create both, First create a small SDL window, which is not used but the creation of the window actually enables the mouse and key subsystem. Then do the EGL stuff, here is some of the code I use void exitfunc() { delete win; SDL_Quit(); bcm_host_deinit(); } int main() { bcm_host_init(); atexit(exi...
by jmacey
Mon Sep 03, 2012 7:35 am
Forum: OpenGLES
Topic: How do you pick up keyboard input with OpenGLES?
Replies: 8
Views: 2547

Re: How do you pick up keyboard input with OpenGLES?

Once you have a basic SDL context (you need to create an SDL Window for mouse and keyboard functions but not an OpenGL Context use EGL for that) you just need to process the SDL event loop http://www.libsdl.org/intro.en/usingevents.html Here is some basic code from one of my (non OpenGL demos) { SDL...
by jmacey
Wed Aug 29, 2012 11:22 am
Forum: General programming discussion
Topic: Structuring Programs
Replies: 25
Views: 6035

Re: Structuring Programs

sorry I use _var in C++ all the time as it's part of our coding standard, I forget when using python I shouldn't do it!

And by typeless I meant not statically typed, I'm so used to teaching python to non programmers (animators) I usually fudge over the details as they are not interested
by jmacey
Wed Aug 29, 2012 7:52 am
Forum: OpenGLES
Topic: Gimbal lock, despite using Matrices and Quaternions
Replies: 15
Views: 4365

Re: Gimbal lock, despite using Matrices and Quaternions

great hope it helps
by jmacey
Tue Aug 28, 2012 10:04 pm
Forum: OpenGLES
Topic: Seam visible when drawing textured quad
Replies: 9
Views: 2299

Re: Seam visible when drawing textured quad

As you are using ES2.0 set the colour to the UV value in the shader and see what that does I use this to debug UVs from time to time. Can you post and image?
by jmacey
Tue Aug 28, 2012 9:55 pm
Forum: General programming discussion
Topic: Structuring Programs
Replies: 25
Views: 6035

Re: Structuring Programs

The functions need to be defined before they are invoked so I usually put them before the functions as shown above to make it neater. If you want to put the functions in a different module you would do something like this First create a file called foo.py (the name is important as we will import it ...
by jmacey
Tue Aug 28, 2012 9:30 pm
Forum: OpenGLES
Topic: Seam visible when drawing textured quad
Replies: 9
Views: 2299

Re: Seam visible when drawing textured quad

how are you defining your texture?

glTexImage2D ( http://www.opengl.org/sdk/docs/man/xhtm ... mage2D.xml ) has a paramater called border make sure that is set to 0 else you will get a single pixel border. I've done this before ;-)

Jon
by jmacey
Tue Aug 28, 2012 9:25 pm
Forum: General programming discussion
Topic: Structuring Programs
Replies: 25
Views: 6035

Re: Structuring Programs

Just read the 2nd part about variables, this is a harder topic to approach as python is typless. I usually define variables when I need them and make sure they are not global (unless it's a quick hacked script for myself). I have some basic python lectures here if it helps http://nccastaff.bournemou...
by jmacey
Tue Aug 28, 2012 9:23 pm
Forum: General programming discussion
Topic: Structuring Programs
Replies: 25
Views: 6035

Re: Structuring Programs

There are (as is usual with python) quite a few ways of doing things, here are some examples #!/usr/bin/python # to define a function use def, it needs to be before the first use # as python is def foo(_value) : print _value # this passes two values and returns a 3rd def add(_v1,_v2) : return _v1+_v...

Go to advanced search