Imagination PowerVR SDK Blog

Simple Lena Quad POD

pvrshaman

#1

Hi again -





Just running through all the PVRShaman demos to get acquainted. I have the latest SDK on Mac and they all run except for the quad.pod (with the ubiquitous Lena!). Just a dark screen. I simplified the frag to the most basic vertex/shader possible and still no go. So I looked into the Object Data for Plane 01 and inspected Vertices and UVs (should be all that’s relevant right?) A few questions:





- should it run out of box?


- The vertices seem to be in a different order. The vertex code suggests an xzy order


              Â gl_Position = vec4(inVertex.x, inVertex.z, 0, 1.0);


   why?


- About the UV0 setting. How does the utility “glDraw”? In strips or fans or other? How is that controller.





I would like to setup a very simple quad for either strip or fan ordering -1,-1 1,-1 1,1 -1,1 with a standard UV map of 0,0 1,0 1,1 0,1. At the moment, all I need is a simple quad scene to test some ES2 shaders for image post-processing. No fancy 3D. I am new to the POD and its object format.


Any suggestions and clarifications to the previous questions are appreciated.





Thanks in advance. Patrice





Update: created a simple quad object and the scene renders her just fine. Still not sure what is happening in ripple and refact. At least I experiment with my shaders there.


pkouame2010-11-18 19:39:51


#2

Ok - I’m developing a nasty habit of answering my own questions…(while waiting ahem…)





1 - Anyway the vshader isn’t transforming the position correctly. The MVPMatrix dropped out as a factor for gl_position (typo?) As such nothing will show.





2- The vertex vector being passed to gl_position is swapping Y for Z.





I believe the vshader should look something like this (if I understand the intent…)





[VERTEXSHADER]


     NAME VertShader


     [GLSL_CODE]


          attribute highp      vec4 inVertex;


          attribute mediump vec2 inTexCoord;


          


          uniform highp   mat4 MVPMatrix;


          varying mediump vec2 TexCoord;


          


          varying highp vec4 Position;


          


          void main()


          {


               gl_Position = MVPMatrix * vec4(inVertex.xyz , 1.0);


               Position = gl_Position;


               TexCoord = inTexCoord;


          }


     [/GLSL_CODE]


[/VERTEXSHADER]





3 - Lastly, the MVPMatrix needs to be declared in the EFFECT tag. And TextCoord was being flipped vertically (why?)





Again, I am assuming the intent was to blur central parts of her face following the mouse position. I may be wrong of course.





I think Lena may have suffered from some neglect over time :wink: She IS getting a little old in the tooth…





Patrice