SDL 2.0, openGL with shader on iOS/MacOSX

Hello.
I am trying to create a simple code example using openGL with shader.
But the code only works on desktop (macosx), I tried to run on iOS, but
only paints the background and not the design (colored triangle).

Code attached.
Screen images in
https://www.cubby.com/pl/shared/_d4a1c77005f54e41b9d11b38a3beab8c

What is wrong?

Thank you.–

[]s
Silvio Fragnani da Silva.
Music, motorcycle and algorithm.

“Preocupe-se mais com sua consci?ncia do que com sua reputa??o. Porque sua
consci?ncia ? o que voc? ?, e sua reputa??o ? o que os outros pensam de
voc?. E o que os outros pensam, ? problema deles…”
(Albert Einstein)

“Temo o dia em que a tecnologia se sobreponha ? nossa humanidade. O mundo
s? ter? uma gera??o de idiotas”
(Albert Einstein)

“N?o h? nada que seja maior evid?ncia de insanidade do que fazer a mesma
coisa dia ap?s dia e esperar resultados diferentes.”
(Albert Einstein)

“Coletar dados ? s? o primeiro passo em dire??o ? sabedoria. Mas
compartilhar dados ? o primeiro passo em dire??o a comunidade.”
(desconhecido)

ops, code attached.Em 12 de maio de 2013 19:06, Silvio Fragnani <@Silvio_Fragnani>escreveu:

Hello.
I am trying to create a simple code example using openGL with shader.
But the code only works on desktop (macosx), I tried to run on iOS, but
only paints the background and not the design (colored triangle).

Code attached.
Screen images in
https://www.cubby.com/pl/shared/_d4a1c77005f54e41b9d11b38a3beab8c

What is wrong?

Thank you.

[]s
Silvio Fragnani da Silva.
Music, motorcycle and algorithm.

“Preocupe-se mais com sua consci?ncia do que com sua reputa??o. Porque sua
consci?ncia ? o que voc? ?, e sua reputa??o ? o que os outros pensam de
voc?. E o que os outros pensam, ? problema deles…”
(Albert Einstein)

“Temo o dia em que a tecnologia se sobreponha ? nossa humanidade. O mundo
s? ter? uma gera??o de idiotas”
(Albert Einstein)

“N?o h? nada que seja maior evid?ncia de insanidade do que fazer a mesma
coisa dia ap?s dia e esperar resultados diferentes.”
(Albert Einstein)

“Coletar dados ? s? o primeiro passo em dire??o ? sabedoria. Mas
compartilhar dados ? o primeiro passo em dire??o a comunidade.”
(desconhecido)

[]s
Silvio Fragnani da Silva.
Music, motorcycle and algorithm.

“Preocupe-se mais com sua consci?ncia do que com sua reputa??o. Porque sua
consci?ncia ? o que voc? ?, e sua reputa??o ? o que os outros pensam de
voc?. E o que os outros pensam, ? problema deles…”
(Albert Einstein)

“Temo o dia em que a tecnologia se sobreponha ? nossa humanidade. O mundo
s? ter? uma gera??o de idiotas”
(Albert Einstein)

“N?o h? nada que seja maior evid?ncia de insanidade do que fazer a mesma
coisa dia ap?s dia e esperar resultados diferentes.”
(Albert Einstein)

“Coletar dados ? s? o primeiro passo em dire??o ? sabedoria. Mas
compartilhar dados ? o primeiro passo em dire??o a comunidade.”
(desconhecido)
-------------- next part --------------
A non-text attachment was scrubbed…
Name: main.cpp
Type: text/x-c++src
Size: 6641 bytes
Desc: not available
URL: http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20130512/d9af0039/attachment.cpp

Make sure you set SDL_GL_CONTEXT_MAJOR/MINOR_VERSION appropriately. For
OpenGL ES platforms, you’d want MAJOR to be set to 2 and MINOR to be 0.

Also be careful about desktop compatibility when writing GLSL targeted for
GL ES; plenty of cases where NVIDIA will let you get away with murder, but
ATI will have a good cry instead. The easiest workaround I found was to
prepend “#version 120\n” to the desktop shaders.

2013/5/13 Silvio Fragnani > ops, code attached.

Em 12 de maio de 2013 19:06, Silvio Fragnani < silviofragnanisilva at gmail.com> escreveu:

Hello.

I am trying to create a simple code example using openGL with shader.
But the code only works on desktop (macosx), I tried to run on iOS, but
only paints the background and not the design (colored triangle).

Code attached.
Screen images in
https://www.cubby.com/pl/shared/_d4a1c77005f54e41b9d11b38a3beab8c

What is wrong?

Thank you.

[]s
Silvio Fragnani da Silva.
Music, motorcycle and algorithm.

“Preocupe-se mais com sua consci?ncia do que com sua reputa??o. Porque
sua consci?ncia ? o que voc? ?, e sua reputa??o ? o que os outros pensam de
voc?. E o que os outros pensam, ? problema deles…”
(Albert Einstein)

“Temo o dia em que a tecnologia se sobreponha ? nossa humanidade. O mundo
s? ter? uma gera??o de idiotas”
(Albert Einstein)

“N?o h? nada que seja maior evid?ncia de insanidade do que fazer a mesma
coisa dia ap?s dia e esperar resultados diferentes.”
(Albert Einstein)

“Coletar dados ? s? o primeiro passo em dire??o ? sabedoria. Mas
compartilhar dados ? o primeiro passo em dire??o a comunidade.”
(desconhecido)

[]s
Silvio Fragnani da Silva.
Music, motorcycle and algorithm.

“Preocupe-se mais com sua consci?ncia do que com sua reputa??o. Porque sua
consci?ncia ? o que voc? ?, e sua reputa??o ? o que os outros pensam de
voc?. E o que os outros pensam, ? problema deles…”
(Albert Einstein)

“Temo o dia em que a tecnologia se sobreponha ? nossa humanidade. O mundo
s? ter? uma gera??o de idiotas”
(Albert Einstein)

“N?o h? nada que seja maior evid?ncia de insanidade do que fazer a mesma
coisa dia ap?s dia e esperar resultados diferentes.”
(Albert Einstein)

“Coletar dados ? s? o primeiro passo em dire??o ? sabedoria. Mas
compartilhar dados ? o primeiro passo em dire??o a comunidade.”
(desconhecido)


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

On the question SDL_GL_CONTEXT_MAJOR / MINOR_VERSION, even though 3.2 by
setting the example, he assumes the highest value below the value reported.
Using glGetString (GL_VERSION) and glGetString
(GL_SHADING_LANGUAGE_VERSION), respectively:

  • IOS: APPLE OpenGL ES 2.0 and OpenGL ES GLSL ES 1.0.
  • On MacOSX: 2.1-INTEL 8:10:44 and 1.20.
    In this example the problem is that it is not drawing the triangle in iOS,
    only on MacOSX (desktop).
    I’ve made an example in OpenGL ES 1.1 for iOS, however would like to use
    shaders (ES 2.0).

2013/5/15 Scott Percival > Make sure you set SDL_GL_CONTEXT_MAJOR/MINOR_VERSION appropriately. For

OpenGL ES platforms, you’d want MAJOR to be set to 2 and MINOR to be 0.

Also be careful about desktop compatibility when writing GLSL targeted for
GL ES; plenty of cases where NVIDIA will let you get away with murder, but
ATI will have a good cry instead. The easiest workaround I found was to
prepend “#version 120\n” to the desktop shaders.

2013/5/13 Silvio Fragnani <@Silvio_Fragnani>

ops, code attached.

Em 12 de maio de 2013 19:06, Silvio Fragnani < @Silvio_Fragnani> escreveu:

Hello.

I am trying to create a simple code example using openGL with shader.
But the code only works on desktop (macosx), I tried to run on iOS, but
only paints the background and not the design (colored triangle).

Code attached.
Screen images in
https://www.cubby.com/pl/shared/_d4a1c77005f54e41b9d11b38a3beab8c

What is wrong?

Thank you.

[]s
Silvio Fragnani da Silva.
Music, motorcycle and algorithm.

“Preocupe-se mais com sua consci?ncia do que com sua reputa??o. Porque
sua consci?ncia ? o que voc? ?, e sua reputa??o ? o que os outros pensam de
voc?. E o que os outros pensam, ? problema deles…”
(Albert Einstein)

“Temo o dia em que a tecnologia se sobreponha ? nossa humanidade. O
mundo s? ter? uma gera??o de idiotas”
(Albert Einstein)

“N?o h? nada que seja maior evid?ncia de insanidade do que fazer a mesma
coisa dia ap?s dia e esperar resultados diferentes.”
(Albert Einstein)

“Coletar dados ? s? o primeiro passo em dire??o ? sabedoria. Mas
compartilhar dados ? o primeiro passo em dire??o a comunidade.”
(desconhecido)

[]s
Silvio Fragnani da Silva.
Music, motorcycle and algorithm.

“Preocupe-se mais com sua consci?ncia do que com sua reputa??o. Porque
sua consci?ncia ? o que voc? ?, e sua reputa??o ? o que os outros pensam de
voc?. E o que os outros pensam, ? problema deles…”
(Albert Einstein)

“Temo o dia em que a tecnologia se sobreponha ? nossa humanidade. O mundo
s? ter? uma gera??o de idiotas”
(Albert Einstein)

“N?o h? nada que seja maior evid?ncia de insanidade do que fazer a mesma
coisa dia ap?s dia e esperar resultados diferentes.”
(Albert Einstein)

“Coletar dados ? s? o primeiro passo em dire??o ? sabedoria. Mas
compartilhar dados ? o primeiro passo em dire??o a comunidade.”
(desconhecido)


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

[]s
Silvio Fragnani da Silva.
Music, motorcycle and algorithm.

“Preocupe-se mais com sua consci?ncia do que com sua reputa??o. Porque sua
consci?ncia ? o que voc? ?, e sua reputa??o ? o que os outros pensam de
voc?. E o que os outros pensam, ? problema deles…”
(Albert Einstein)

“Temo o dia em que a tecnologia se sobreponha ? nossa humanidade. O mundo
s? ter? uma gera??o de idiotas”
(Albert Einstein)

“N?o h? nada que seja maior evid?ncia de insanidade do que fazer a mesma
coisa dia ap?s dia e esperar resultados diferentes.”
(Albert Einstein)

“Coletar dados ? s? o primeiro passo em dire??o ? sabedoria. Mas
compartilhar dados ? o primeiro passo em dire??o a comunidade.”
(desconhecido)

Yes, the tip about adding “#version 120\n” was unrelated to your problem
per se., just an observation I had in general about compatibility. Right
now your OS X version runs under Intel’s OpenGL 2.1 driver, which so
happens to use GLSL 1.20. Some implementations (i.e. AMD) will assume a
later version of GLSL and so complain about the 1.20 syntax, so it helps to
specify the GLSL version at the start.

Annoyingly I don’t have access to my GLES 2.0 dev machine for a while, so I
can’t test your code. At a guess, maybe call glViewport(0, 0, 512, 512) to
set the default transformation, and change GL_TRIANGLES to
GL_TRIANGLE_STRIP?On 16 May 2013 08:43, Silvio Fragnani wrote:

On the question SDL_GL_CONTEXT_MAJOR / MINOR_VERSION, even though 3.2 by
setting the example, he assumes the highest value below the value reported.
Using glGetString (GL_VERSION) and glGetString
(GL_SHADING_LANGUAGE_VERSION), respectively:

  • IOS: APPLE OpenGL ES 2.0 and OpenGL ES GLSL ES 1.0.
  • On MacOSX: 2.1-INTEL 8:10:44 and 1.20.
    In this example the problem is that it is not drawing the triangle in iOS,
    only on MacOSX (desktop).
    I’ve made an example in OpenGL ES 1.1 for iOS, however would like to use
    shaders (ES 2.0).

2013/5/15 Scott Percival <@Scott_Percival>

Make sure you set SDL_GL_CONTEXT_MAJOR/MINOR_VERSION appropriately. For
OpenGL ES platforms, you’d want MAJOR to be set to 2 and MINOR to be 0.

Also be careful about desktop compatibility when writing GLSL targeted
for GL ES; plenty of cases where NVIDIA will let you get away with murder,
but ATI will have a good cry instead. The easiest workaround I found was to
prepend “#version 120\n” to the desktop shaders.

2013/5/13 Silvio Fragnani

ops, code attached.

Em 12 de maio de 2013 19:06, Silvio Fragnani < silviofragnanisilva at gmail.com> escreveu:

Hello.

I am trying to create a simple code example using openGL with shader.
But the code only works on desktop (macosx), I tried to run on iOS, but
only paints the background and not the design (colored triangle).

Code attached.
Screen images in
https://www.cubby.com/pl/shared/_d4a1c77005f54e41b9d11b38a3beab8c

What is wrong?

Thank you.

[]s
Silvio Fragnani da Silva.
Music, motorcycle and algorithm.

“Preocupe-se mais com sua consci?ncia do que com sua reputa??o. Porque
sua consci?ncia ? o que voc? ?, e sua reputa??o ? o que os outros pensam de
voc?. E o que os outros pensam, ? problema deles…”
(Albert Einstein)

“Temo o dia em que a tecnologia se sobreponha ? nossa humanidade. O
mundo s? ter? uma gera??o de idiotas”
(Albert Einstein)

“N?o h? nada que seja maior evid?ncia de insanidade do que fazer a
mesma coisa dia ap?s dia e esperar resultados diferentes.”
(Albert Einstein)

“Coletar dados ? s? o primeiro passo em dire??o ? sabedoria. Mas
compartilhar dados ? o primeiro passo em dire??o a comunidade.”
(desconhecido)

[]s
Silvio Fragnani da Silva.
Music, motorcycle and algorithm.

“Preocupe-se mais com sua consci?ncia do que com sua reputa??o. Porque
sua consci?ncia ? o que voc? ?, e sua reputa??o ? o que os outros pensam de
voc?. E o que os outros pensam, ? problema deles…”
(Albert Einstein)

“Temo o dia em que a tecnologia se sobreponha ? nossa humanidade. O
mundo s? ter? uma gera??o de idiotas”
(Albert Einstein)

“N?o h? nada que seja maior evid?ncia de insanidade do que fazer a mesma
coisa dia ap?s dia e esperar resultados diferentes.”
(Albert Einstein)

“Coletar dados ? s? o primeiro passo em dire??o ? sabedoria. Mas
compartilhar dados ? o primeiro passo em dire??o a comunidade.”
(desconhecido)


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

[]s
Silvio Fragnani da Silva.
Music, motorcycle and algorithm.

“Preocupe-se mais com sua consci?ncia do que com sua reputa??o. Porque sua
consci?ncia ? o que voc? ?, e sua reputa??o ? o que os outros pensam de
voc?. E o que os outros pensam, ? problema deles…”
(Albert Einstein)

“Temo o dia em que a tecnologia se sobreponha ? nossa humanidade. O mundo
s? ter? uma gera??o de idiotas”
(Albert Einstein)

“N?o h? nada que seja maior evid?ncia de insanidade do que fazer a mesma
coisa dia ap?s dia e esperar resultados diferentes.”
(Albert Einstein)

“Coletar dados ? s? o primeiro passo em dire??o ? sabedoria. Mas
compartilhar dados ? o primeiro passo em dire??o a comunidade.”
(desconhecido)


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

Got a question # version of the SDL, I will apply it to my projects by
guarantee. Today I have no problem doing it so I’m on the computer, but if
others can help give me trouble. Thanks for the tip.

In the matter of drawing in iOS, it may not be problem in openGL ES 2.0,
perhaps a failure to draw even SDL_GL_SwapWindow () for iOS or’m forgetting
something. I think there is no point changing the policy drawing on the
desktop because this drawing the usual triangle.

Today I update the repository thinking that could have been corrected,
however q seems worse now or draws the background color, everything is
black.

I never used glViewport when I’m using shaders because the values of the
screen size was standardized -1, 1, -1, 1. As for policy design, so would
change the shape of the design.

2013/5/16 Scott Percival > Yes, the tip about adding “#version 120\n” was unrelated to your problem

per se., just an observation I had in general about compatibility. Right
now your OS X version runs under Intel’s OpenGL 2.1 driver, which so
happens to use GLSL 1.20. Some implementations (i.e. AMD) will assume a
later version of GLSL and so complain about the 1.20 syntax, so it helps to
specify the GLSL version at the start.

Annoyingly I don’t have access to my GLES 2.0 dev machine for a while, so
I can’t test your code. At a guess, maybe call glViewport(0, 0, 512, 512)
to set the default transformation, and change GL_TRIANGLES to
GL_TRIANGLE_STRIP?

On 16 May 2013 08:43, Silvio Fragnani <@Silvio_Fragnani>wrote:

On the question SDL_GL_CONTEXT_MAJOR / MINOR_VERSION, even though 3.2 by
setting the example, he assumes the highest value below the value reported.
Using glGetString (GL_VERSION) and glGetString
(GL_SHADING_LANGUAGE_VERSION), respectively:

  • IOS: APPLE OpenGL ES 2.0 and OpenGL ES GLSL ES 1.0.
  • On MacOSX: 2.1-INTEL 8:10:44 and 1.20.
    In this example the problem is that it is not drawing the triangle in
    iOS, only on MacOSX (desktop).
    I’ve made an example in OpenGL ES 1.1 for iOS, however would like to use
    shaders (ES 2.0).

2013/5/15 Scott Percival

Make sure you set SDL_GL_CONTEXT_MAJOR/MINOR_VERSION appropriately. For
OpenGL ES platforms, you’d want MAJOR to be set to 2 and MINOR to be 0.

Also be careful about desktop compatibility when writing GLSL targeted
for GL ES; plenty of cases where NVIDIA will let you get away with murder,
but ATI will have a good cry instead. The easiest workaround I found was to
prepend “#version 120\n” to the desktop shaders.

2013/5/13 Silvio Fragnani <@Silvio_Fragnani>

ops, code attached.

Em 12 de maio de 2013 19:06, Silvio Fragnani < @Silvio_Fragnani> escreveu:

Hello.

I am trying to create a simple code example using openGL with shader.
But the code only works on desktop (macosx), I tried to run on iOS,
but only paints the background and not the design (colored triangle).

Code attached.
Screen images in
https://www.cubby.com/pl/shared/_d4a1c77005f54e41b9d11b38a3beab8c

What is wrong?

Thank you.

[]s
Silvio Fragnani da Silva.
Music, motorcycle and algorithm.

“Preocupe-se mais com sua consci?ncia do que com sua reputa??o. Porque
sua consci?ncia ? o que voc? ?, e sua reputa??o ? o que os outros pensam de
voc?. E o que os outros pensam, ? problema deles…”
(Albert Einstein)

“Temo o dia em que a tecnologia se sobreponha ? nossa humanidade. O
mundo s? ter? uma gera??o de idiotas”
(Albert Einstein)

“N?o h? nada que seja maior evid?ncia de insanidade do que fazer a
mesma coisa dia ap?s dia e esperar resultados diferentes.”
(Albert Einstein)

“Coletar dados ? s? o primeiro passo em dire??o ? sabedoria. Mas
compartilhar dados ? o primeiro passo em dire??o a comunidade.”
(desconhecido)

[]s
Silvio Fragnani da Silva.
Music, motorcycle and algorithm.

“Preocupe-se mais com sua consci?ncia do que com sua reputa??o. Porque
sua consci?ncia ? o que voc? ?, e sua reputa??o ? o que os outros pensam de
voc?. E o que os outros pensam, ? problema deles…”
(Albert Einstein)

“Temo o dia em que a tecnologia se sobreponha ? nossa humanidade. O
mundo s? ter? uma gera??o de idiotas”
(Albert Einstein)

“N?o h? nada que seja maior evid?ncia de insanidade do que fazer a
mesma coisa dia ap?s dia e esperar resultados diferentes.”
(Albert Einstein)

“Coletar dados ? s? o primeiro passo em dire??o ? sabedoria. Mas
compartilhar dados ? o primeiro passo em dire??o a comunidade.”
(desconhecido)


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

[]s
Silvio Fragnani da Silva.
Music, motorcycle and algorithm.

“Preocupe-se mais com sua consci?ncia do que com sua reputa??o. Porque
sua consci?ncia ? o que voc? ?, e sua reputa??o ? o que os outros pensam de
voc?. E o que os outros pensam, ? problema deles…”
(Albert Einstein)

“Temo o dia em que a tecnologia se sobreponha ? nossa humanidade. O mundo
s? ter? uma gera??o de idiotas”
(Albert Einstein)

“N?o h? nada que seja maior evid?ncia de insanidade do que fazer a mesma
coisa dia ap?s dia e esperar resultados diferentes.”
(Albert Einstein)

“Coletar dados ? s? o primeiro passo em dire??o ? sabedoria. Mas
compartilhar dados ? o primeiro passo em dire??o a comunidade.”
(desconhecido)


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

[]s
Silvio Fragnani da Silva.
Music, motorcycle and algorithm.

“Preocupe-se mais com sua consci?ncia do que com sua reputa??o. Porque sua
consci?ncia ? o que voc? ?, e sua reputa??o ? o que os outros pensam de
voc?. E o que os outros pensam, ? problema deles…”
(Albert Einstein)

“Temo o dia em que a tecnologia se sobreponha ? nossa humanidade. O mundo
s? ter? uma gera??o de idiotas”
(Albert Einstein)

“N?o h? nada que seja maior evid?ncia de insanidade do que fazer a mesma
coisa dia ap?s dia e esperar resultados diferentes.”
(Albert Einstein)

“Coletar dados ? s? o primeiro passo em dire??o ? sabedoria. Mas
compartilhar dados ? o primeiro passo em dire??o a comunidade.”
(desconhecido)

Don’t worry about the “#version 120\n” thing for now.

glViewport is the method which sets up the transform between window
coordinates (i.e. pixels) and normalised (i.e. [-1, 1]) coordinates.
There’s no guarantee that the default transform will be correct, you need
to update it after creating a window (plus every time you perform a window
resize).On 17 May 2013 10:01, Silvio Fragnani wrote:

Got a question # version of the SDL, I will apply it to my projects by
guarantee. Today I have no problem doing it so I’m on the computer, but if
others can help give me trouble. Thanks for the tip.

In the matter of drawing in iOS, it may not be problem in openGL ES 2.0,
perhaps a failure to draw even SDL_GL_SwapWindow () for iOS or’m forgetting
something. I think there is no point changing the policy drawing on the
desktop because this drawing the usual triangle.

Today I update the repository thinking that could have been corrected,
however q seems worse now or draws the background color, everything is
black.

I never used glViewport when I’m using shaders because the values of the
screen size was standardized -1, 1, -1, 1. As for policy design, so would
change the shape of the design.

2013/5/16 Scott Percival <@Scott_Percival>

Yes, the tip about adding “#version 120\n” was unrelated to your problem
per se., just an observation I had in general about compatibility. Right
now your OS X version runs under Intel’s OpenGL 2.1 driver, which so
happens to use GLSL 1.20. Some implementations (i.e. AMD) will assume a
later version of GLSL and so complain about the 1.20 syntax, so it helps to
specify the GLSL version at the start.

Annoyingly I don’t have access to my GLES 2.0 dev machine for a while, so
I can’t test your code. At a guess, maybe call glViewport(0, 0, 512, 512)
to set the default transformation, and change GL_TRIANGLES to
GL_TRIANGLE_STRIP?

On 16 May 2013 08:43, Silvio Fragnani wrote:

On the question SDL_GL_CONTEXT_MAJOR / MINOR_VERSION, even though 3.2 by
setting the example, he assumes the highest value below the value reported.
Using glGetString (GL_VERSION) and glGetString
(GL_SHADING_LANGUAGE_VERSION), respectively:

  • IOS: APPLE OpenGL ES 2.0 and OpenGL ES GLSL ES 1.0.
  • On MacOSX: 2.1-INTEL 8:10:44 and 1.20.
    In this example the problem is that it is not drawing the triangle in
    iOS, only on MacOSX (desktop).
    I’ve made an example in OpenGL ES 1.1 for iOS, however would like to use
    shaders (ES 2.0).

2013/5/15 Scott Percival <@Scott_Percival>

Make sure you set SDL_GL_CONTEXT_MAJOR/MINOR_VERSION appropriately. For
OpenGL ES platforms, you’d want MAJOR to be set to 2 and MINOR to be 0.

Also be careful about desktop compatibility when writing GLSL targeted
for GL ES; plenty of cases where NVIDIA will let you get away with murder,
but ATI will have a good cry instead. The easiest workaround I found was to
prepend “#version 120\n” to the desktop shaders.

2013/5/13 Silvio Fragnani

ops, code attached.

Em 12 de maio de 2013 19:06, Silvio Fragnani < silviofragnanisilva at gmail.com> escreveu:

Hello.

I am trying to create a simple code example using openGL with shader.
But the code only works on desktop (macosx), I tried to run on iOS,
but only paints the background and not the design (colored triangle).

Code attached.
Screen images in
https://www.cubby.com/pl/shared/_d4a1c77005f54e41b9d11b38a3beab8c

What is wrong?

Thank you.

[]s
Silvio Fragnani da Silva.
Music, motorcycle and algorithm.

“Preocupe-se mais com sua consci?ncia do que com sua reputa??o.
Porque sua consci?ncia ? o que voc? ?, e sua reputa??o ? o que os outros
pensam de voc?. E o que os outros pensam, ? problema deles…”
(Albert Einstein)

“Temo o dia em que a tecnologia se sobreponha ? nossa humanidade. O
mundo s? ter? uma gera??o de idiotas”
(Albert Einstein)

“N?o h? nada que seja maior evid?ncia de insanidade do que fazer a
mesma coisa dia ap?s dia e esperar resultados diferentes.”
(Albert Einstein)

“Coletar dados ? s? o primeiro passo em dire??o ? sabedoria. Mas
compartilhar dados ? o primeiro passo em dire??o a comunidade.”
(desconhecido)

[]s
Silvio Fragnani da Silva.
Music, motorcycle and algorithm.

“Preocupe-se mais com sua consci?ncia do que com sua reputa??o. Porque
sua consci?ncia ? o que voc? ?, e sua reputa??o ? o que os outros pensam de
voc?. E o que os outros pensam, ? problema deles…”
(Albert Einstein)

“Temo o dia em que a tecnologia se sobreponha ? nossa humanidade. O
mundo s? ter? uma gera??o de idiotas”
(Albert Einstein)

“N?o h? nada que seja maior evid?ncia de insanidade do que fazer a
mesma coisa dia ap?s dia e esperar resultados diferentes.”
(Albert Einstein)

“Coletar dados ? s? o primeiro passo em dire??o ? sabedoria. Mas
compartilhar dados ? o primeiro passo em dire??o a comunidade.”
(desconhecido)


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

[]s
Silvio Fragnani da Silva.
Music, motorcycle and algorithm.

“Preocupe-se mais com sua consci?ncia do que com sua reputa??o. Porque
sua consci?ncia ? o que voc? ?, e sua reputa??o ? o que os outros pensam de
voc?. E o que os outros pensam, ? problema deles…”
(Albert Einstein)

“Temo o dia em que a tecnologia se sobreponha ? nossa humanidade. O
mundo s? ter? uma gera??o de idiotas”
(Albert Einstein)

“N?o h? nada que seja maior evid?ncia de insanidade do que fazer a mesma
coisa dia ap?s dia e esperar resultados diferentes.”
(Albert Einstein)

“Coletar dados ? s? o primeiro passo em dire??o ? sabedoria. Mas
compartilhar dados ? o primeiro passo em dire??o a comunidade.”
(desconhecido)


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

[]s
Silvio Fragnani da Silva.
Music, motorcycle and algorithm.

“Preocupe-se mais com sua consci?ncia do que com sua reputa??o. Porque sua
consci?ncia ? o que voc? ?, e sua reputa??o ? o que os outros pensam de
voc?. E o que os outros pensam, ? problema deles…”
(Albert Einstein)

“Temo o dia em que a tecnologia se sobreponha ? nossa humanidade. O mundo
s? ter? uma gera??o de idiotas”
(Albert Einstein)

“N?o h? nada que seja maior evid?ncia de insanidade do que fazer a mesma
coisa dia ap?s dia e esperar resultados diferentes.”
(Albert Einstein)

“Coletar dados ? s? o primeiro passo em dire??o ? sabedoria. Mas
compartilhar dados ? o primeiro passo em dire??o a comunidade.”
(desconhecido)


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

I had to go back to approximately 7100 revision that was the version I had
running in order to test, I put the adjustment:

int screen_w, screen_h;
SDL_GetWindowSize (window, & screen_w, & screen_h);
glViewport (0, 0, screen_w, screen_h);

And, it worked!

So I was with a doubt. Why in macosx not needed force glViewport?
In fact, I have always worked in iOS (OpenGLES 2.0) and never used the
glViewport, so I found it strange.

Thank you Scott, I owe you a coffee.

(ps: sorry my English is by Google Translate)>

2013/5/16 Scott Percival

Don’t worry about the “#version 120\n” thing for now.

glViewport is the method which sets up the transform between window
coordinates (i.e. pixels) and normalised (i.e. [-1, 1]) coordinates.
There’s no guarantee that the default transform will be correct, you need
to update it after creating a window (plus every time you perform a window
resize).

On 17 May 2013 10:01, Silvio Fragnani <@Silvio_Fragnani>wrote:

Got a question # version of the SDL, I will apply it to my projects by
guarantee. Today I have no problem doing it so I’m on the computer, but if
others can help give me trouble. Thanks for the tip.

In the matter of drawing in iOS, it may not be problem in openGL ES 2.0,
perhaps a failure to draw even SDL_GL_SwapWindow () for iOS or’m forgetting
something. I think there is no point changing the policy drawing on the
desktop because this drawing the usual triangle.

Today I update the repository thinking that could have been corrected,
however q seems worse now or draws the background color, everything is
black.

I never used glViewport when I’m using shaders because the values of the
screen size was standardized -1, 1, -1, 1. As for policy design, so would
change the shape of the design.

2013/5/16 Scott Percival

Yes, the tip about adding “#version 120\n” was unrelated to your
problem per se., just an observation I had in general about compatibility.
Right now your OS X version runs under Intel’s OpenGL 2.1 driver, which so
happens to use GLSL 1.20. Some implementations (i.e. AMD) will assume a
later version of GLSL and so complain about the 1.20 syntax, so it helps to
specify the GLSL version at the start.

Annoyingly I don’t have access to my GLES 2.0 dev machine for a while,
so I can’t test your code. At a guess, maybe call glViewport(0, 0, 512,
512) to set the default transformation, and change GL_TRIANGLES to
GL_TRIANGLE_STRIP?

On 16 May 2013 08:43, Silvio Fragnani <@Silvio_Fragnani>wrote:

On the question SDL_GL_CONTEXT_MAJOR / MINOR_VERSION, even though 3.2
by setting the example, he assumes the highest value below the value
reported.
Using glGetString (GL_VERSION) and glGetString
(GL_SHADING_LANGUAGE_VERSION), respectively:

  • IOS: APPLE OpenGL ES 2.0 and OpenGL ES GLSL ES 1.0.
  • On MacOSX: 2.1-INTEL 8:10:44 and 1.20.
    In this example the problem is that it is not drawing the triangle in
    iOS, only on MacOSX (desktop).
    I’ve made an example in OpenGL ES 1.1 for iOS, however would like to
    use shaders (ES 2.0).

2013/5/15 Scott Percival

Make sure you set SDL_GL_CONTEXT_MAJOR/MINOR_VERSION appropriately.
For OpenGL ES platforms, you’d want MAJOR to be set to 2 and MINOR to be 0.

Also be careful about desktop compatibility when writing GLSL
targeted for GL ES; plenty of cases where NVIDIA will let you get away with
murder, but ATI will have a good cry instead. The easiest workaround I
found was to prepend “#version 120\n” to the desktop shaders.

2013/5/13 Silvio Fragnani <@Silvio_Fragnani>

ops, code attached

No worries my friend. Glad to hear that it works!On 17 May 2013 18:22, Silvio Fragnani wrote:

I had to go back to approximately 7100 revision that was the version I had
running in order to test, I put the adjustment:

int screen_w, screen_h;
SDL_GetWindowSize (window, & screen_w, & screen_h);
glViewport (0, 0, screen_w, screen_h);

And, it worked!

So I was with a doubt. Why in macosx not needed force glViewport?
In fact, I have always worked in iOS (OpenGLES 2.0) and never used the
glViewport, so I found it strange.

Thank you Scott, I owe you a coffee.

(ps: sorry my English is by Google Translate)

2013/5/16 Scott Percival <@Scott_Percival>

Don’t worry about the “#version 120\n” thing for now.

glViewport is the method which sets up the transform between window
coordinates (i.e. pixels) and normalised (i.e. [-1, 1]) coordinates.
There’s no guarantee that the default transform will be correct, you need
to update it after creating a window (plus every time you perform a window
resize).

On 17 May 2013 10:01, Silvio Fragnani wrote:

Got a question # version of the SDL, I will apply it to my projects by
guarantee. Today I have no problem doing it so I’m on the computer, but if
others can help give me trouble. Thanks for the tip.

In the matter of drawing in iOS, it may not be problem in openGL ES
2.0, perhaps a failure to draw even SDL_GL_SwapWindow () for iOS or’m
forgetting something. I think there is no point changing the policy drawing
on the desktop because this drawing the usual triangle.

Today I update the repository thinking that could have been corrected,
however q seems worse now or draws the background color, everything is
black.

I never used glViewport when I’m using shaders because the values of
the screen size was standardized -1, 1, -1, 1. As for policy design, so
would change the shape of the design.

2013/5/16 Scott Percival <@Scott_Percival>

Yes, the tip about adding “#version 120\n” was unrelated to your
problem per se., just an observation I had in general about compatibility.
Right now your OS X version runs under Intel’s OpenGL 2.1 driver, which so
happens to use GLSL 1.20. Some implementations (i.e. AMD) will assume a
later version of GLSL and so complain about the 1.20 syntax, so it helps to
specify the GLSL version at the start.

Annoyingly I don’t have access to my GLES 2.0 dev machine for a while,
so I can’t test your code. At a guess, maybe call glViewport(0, 0, 512,
512) to set the default transformation, and change GL_TRIANGLES to
GL_TRIANGLE_STRIP?

On 16 May 2013 08:43, Silvio Fragnani wrote:

On the question SDL_GL_CONTEXT_MAJOR / MINOR_VERSION, even though 3.2
by setting the example, he assumes the highest value below the value
reported.
Using glGetString (GL_VERSION) and glGetString
(GL_SHADING_LANGUAGE_VERSION), respectively:

  • IOS: APPLE OpenGL ES 2.0 and OpenGL ES GLSL ES 1.0.
  • On MacOSX: 2.1-INTEL 8:10:44 and 1.20.
    In this example the problem is that it is not drawing the triangle in
    iOS, only on MacOSX (desktop).
    I’ve made an example in OpenGL ES 1.1 for iOS, however would like to
    use shaders (ES 2.0).

2013/5/15 Scott Percival <@Scott_Percival>

Make sure you set SDL_GL_CONTEXT_MAJOR/MINOR_VERSION appropriately.
For OpenGL ES platforms, you’d want MAJOR to be set to 2 and MINOR to be 0.

Also be careful about desktop compatibility when writing GLSL
targeted for GL ES; plenty of cases where NVIDIA will let you get away with
murder, but ATI will have a good cry instead. The easiest workaround I
found was to prepend “#version 120\n” to the desktop shaders.

2013/5/13 Silvio Fragnani

ops, code attached


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org