User avatar
RichardUK
Posts: 235
Joined: Fri Jun 01, 2012 5:12 pm

GLES2 head ache....

Sun Jun 10, 2012 3:29 pm

So I have some GLES code running and although it reports no errors and all the values are as expected I get no model on screen. I am clearing the display with different colours and that is working.

The init code was copied from the triangle demo. Shaders build with no errors and the uniform indices are fetched ok.

I changed the init code so it runs on my Ubuntu box. Only the init code is different, uses glut to set it up. This build works fine and I get to see my box. So the question, what RPi magic spell am I missing.

I've written this kind of code many times for GLES 2.0 devices so I'm sure it's correct, although I do know a simple typo can stop it.

So, any clues, what could I be doing wrong? :)

dom
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 5398
Joined: Wed Aug 17, 2011 7:41 pm
Location: Cambridge

Re: GLES2 head ache....

Sun Jun 10, 2012 3:46 pm

Are you basing it on hello_triangle or hello_triangle2?
If the answer is "what's hello_triangle2?" then http://elinux.org/R-Pi_Troubleshooting# ... g_firmware

Narishma
Posts: 151
Joined: Wed Nov 23, 2011 1:29 pm

Re: GLES2 head ache....

Sun Jun 10, 2012 3:51 pm

The triangle demo is ES 1.1. If you want ES 2.0 there's another demo in there. I think it's called triangle2 or something. Can't check right now.

User avatar
RichardUK
Posts: 235
Joined: Fri Jun 01, 2012 5:12 pm

Re: GLES2 head ache....

Sun Jun 10, 2012 3:52 pm

dom wrote:Are you basing it on hello_triangle or hello_triangle2?
If the answer is "what's hello_triangle2?" then http://elinux.org/R-Pi_Troubleshooting# ... g_firmware
Don't have hello_triangle2, so I used the init code from hello_triangle.

Firmware reports.


Apr 18 2012 15:04:46
Copyright (c) 2012 Broadcom
version 310376 (release)

Gibble
Posts: 56
Joined: Wed May 09, 2012 9:52 am

Re: GLES2 head ache....

Sun Jun 10, 2012 7:28 pm

Would it be possible to put the code up on a nopaste site or something, and then we could take a look and try and find the problem ?

dom
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 5398
Joined: Wed Aug 17, 2011 7:41 pm
Location: Cambridge

Re: GLES2 head ache....

Sun Jun 10, 2012 7:36 pm

RichardUK wrote: Firmware reports.
Apr 18 2012 15:04:46
Copyright (c) 2012 Broadcom
version 310376 (release)
So it's old. Did you try clicking the "Updating firmware" link?

finnw
Posts: 24
Joined: Wed May 16, 2012 7:05 pm

Re: GLES2 head ache....

Mon Jun 11, 2012 9:42 am

hello_triangle2 is not a port of hello_triangle to GLES2.0 (I don't think one exists, unfortunately.) It's a separate program that demonstrates the programmable shader capability.

jmacey
Posts: 135
Joined: Thu May 31, 2012 1:05 pm

Re: GLES2 head ache....

Mon Jun 11, 2012 9:48 am

The main thing you need to add to get GLES2 to work is the follwing

Code: Select all

static const EGLint context_attributes[] =
 {
                EGL_CONTEXT_CLIENT_VERSION, 2,
                EGL_NONE
 };
Then when you create the context instead of using a null as the final attribute do the following

Code: Select all

eglCreateContext(m_display, config, EGL_NO_CONTEXT, context_attributes);
I have it working quite well at the moment, I will release code soon as I have a full window class to create the context and allow GL to work (there is a download here on my blog http://jonmacey.blogspot.co.uk/2012/06/ ... class.html.

I'm hoping to do a more in depth series of article soon, but work is a bit hectic at present.

Return to “C/C++”