The SDL forums have moved to discourse.libsdl.org.
This is just a read-only archive of the previous forums, to keep old links working.


SDL Forum Index
SDL
Simple Directmedia Layer Forums
SDL 2.0, openGL with shader on iOS/MacOSX
Silvio Fragnani
Guest

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)
SDL 2.0, openGL with shader on iOS/MacOSX
Silvio Fragnani
Guest

ops, code attached.


Em 12 de maio de 2013 19:06, Silvio Fragnani escreveu:
Quote:
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 2.0, openGL with shader on iOS/MacOSX
Scott Percival
Guest

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
Quote:
ops, code attached.


Em 12 de maio de 2013 19:06, Silvio Fragnani escreveu:
Quote:
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

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

SDL 2.0, openGL with shader on iOS/MacOSX
Silvio Fragnani
Guest

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
Quote:
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
Quote:
ops, code attached.


Em 12 de maio de 2013 19:06, Silvio Fragnani escreveu:
Quote:
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

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org





_______________________________________________
SDL mailing list

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 2.0, openGL with shader on iOS/MacOSX
Scott Percival
Guest

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:
Quote:
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
Quote:
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
Quote:
ops, code attached.


Em 12 de maio de 2013 19:06, Silvio Fragnani escreveu:
Quote:
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

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org





_______________________________________________
SDL mailing list

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

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

SDL 2.0, openGL with shader on iOS/MacOSX
Silvio Fragnani
Guest

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
Quote:
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:
Quote:
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
Quote:
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
Quote:
ops, code attached.


Em 12 de maio de 2013 19:06, Silvio Fragnani escreveu:
Quote:
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

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org





_______________________________________________
SDL mailing list

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

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org







_______________________________________________
SDL mailing list

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 2.0, openGL with shader on iOS/MacOSX
Scott Percival
Guest

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:
Quote:
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
Quote:
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:
Quote:
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
Quote:
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
Quote:
ops, code attached.


Em 12 de maio de 2013 19:06, Silvio Fragnani escreveu:
Quote:
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

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org





_______________________________________________
SDL mailing list

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

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org







_______________________________________________
SDL mailing list

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

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

SDL 2.0, openGL with shader on iOS/MacOSX
Silvio Fragnani
Guest

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)


Quote:


2013/5/16 Scott Percival
Quote:
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:
Quote:
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
Quote:
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:
Quote:
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
Quote:
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
Quote:
ops, code attached


















SDL 2.0, openGL with shader on iOS/MacOSX
Scott Percival
Guest

No worries my friend. Glad to hear that it works!




On 17 May 2013 18:22, Silvio Fragnani wrote:
Quote:
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)


Quote:


2013/5/16 Scott Percival
Quote:
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:
Quote:
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
Quote:
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:
Quote:
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
Quote:
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
Quote:
ops, code attached






























_______________________________________________
SDL mailing list

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org