Imagination PowerVR SDK Blog

Questions/issues with the 2.06.26.0649 SDK

pvrvframe

#1

I have installed the latest 2.06.26.0649 SDK for Windows PC.





FSAA Problem





In my application I have been using FSAA successfully in the previous version, but for some reason this FSAA is not working in the latest version. Perhaps I’m doing something dumb.





I have set EGL_SAMPLE_BUFFERS = 1 and EGL_SAMPLES = 4. I also tried EGL_SAMPLES at 1 and 2 as well, but no luck. The following is also enabled:





glEnable(GL_BLEND);


glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);


glEnable(GL_POINT_SMOOTH);


glEnable(GL_LINE_SMOOTH);


glEnable(GL_MULTISAMPLE);








This worked fine in the 2.05.25.0804 SDK, but not in the 2.06.26.0649 release.








Texture Combiner: Interpolation + Lighting Colour





I’m having trouble interpolating two textures and then applying the final lighting colour on the combined result. So far i have something like this:





//Modulate texture 0 with lighting colour


glActiveTexture(GL_TEXTURE0);


glBindTexture(GL_TEXTURE_2D, TexID0);





glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE);


glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB, GL_MODULATE);


glTexEnvi(GL_TEXTURE_ENV, GL_SRC0_RGB, GL_TEXTURE);


glTexEnvi(GL_TEXTURE_ENV, GL_SRC1_RGB, GL_PRIMARY_COLOR);


glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND0_RGB, GL_SRC_COLOR);


glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND1_RGB, GL_SRC_COLOR);





//Interpolate texture 1 with texture 0


glActiveTexture(GL_TEXTURE1);


glBindTexture(GL_TEXTURE_2D, TexID1);





glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE);


glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB, GL_INTERPOLATE);


glTexEnvi(GL_TEXTURE_ENV, GL_SRC0_RGB, GL_PREVIOUS);


glTexEnvi(GL_TEXTURE_ENV, GL_SRC1_RGB, GL_TEXTURE);


glTexEnvi(GL_TEXTURE_ENV, GL_SRC2_RGB, GL_TEXTURE);


glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND0_RGB, GL_SRC_COLOR);


glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND1_RGB, GL_SRC_COLOR);


glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND2_RGB, GL_ONE_MINUS_SRC_ALPHA);





glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_ALPHA, GL_INTERPOLATE);


glTexEnvi(GL_TEXTURE_ENV, GL_SRC0_ALPHA, GL_PREVIOUS);


glTexEnvi(GL_TEXTURE_ENV, GL_SRC1_ALPHA, GL_TEXTURE);


glTexEnvi(GL_TEXTURE_ENV, GL_SRC2_ALPHA, GL_TEXTURE);


glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND0_ALPHA, GL_SRC_ALPHA);


glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND1_ALPHA, GL_SRC_ALPHA);


glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND2_ALPHA, GL_ONE_MINUS_SRC_ALPHA);





//Blend result into the scene


glEnable(GL_BLEND);


glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);





The trouble is, the lighting is only applied on the first texture, but not on the second one. I suspect i need to do that on a third texture unit. How do i go about that?








Texture Combiner: GL_OES_texture_env_crossbar





Final question, could someone explain how I can use texture crossbars in ES 1.1? Perhaps an example would be helpful.





Am i correct to assume that GL_TEXTURE0 and GL_TEXTURE1 can be used directly in glTexEnvi() functions? For example:





glTexEnvi(GL_TEXTURE_ENV, GL_SRC1_ALPHA, GL_TEXTURE0);


glTexEnvi(GL_TEXTURE_ENV, GL_SRC2_ALPHA, GL_TEXTURE1);


…etc





- i have actually tried that, but I’m getting GLenum errors.








Feedback would be appreciated.Tachikoma2010-03-28 15:53:25


#2
Tachikoma wrote:
Final question, could someone explain how I can use texture crossbars in ES 1.1? Perhaps an example would be helpful.



Am i correct to assume that GL_TEXTURE0 and GL_TEXTURE1 can be used directly in glTexEnvi() functions? For example:



glTexEnvi(GL_TEXTURE_ENV, GL_SRC1_ALPHA, GL_TEXTURE0);

glTexEnvi(GL_TEXTURE_ENV, GL_SRC2_ALPHA, GL_TEXTURE1);

..etc



- i have actually tried that, but I'm getting GLenum errors.

This should work, assuming you are using an SGX profile in PVRVFrame. POWERVR MBX does not support this extension. We'll have a look into why this doesn't work.



Quote:
The trouble is, the lighting is only applied on the first texture, but not on the second one. I suspect i need to do that on a third texture unit. How do i go about that?

With texenv crossbar working, you can interpolate using texenv 0, then apply lighting in texenv 1:

Code:
glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D, TexID0);
glEnable(GL_TEXTURE_2D);

glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE);
glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB, GL_INTERPOLATE);
glTexEnvi(GL_TEXTURE_ENV, GL_SRC0_RGB, GL_TEXTURE0);
glTexEnvi(GL_TEXTURE_ENV, GL_SRC1_RGB, GL_TEXTURE1);
glTexEnvi(GL_TEXTURE_ENV, GL_SRC2_RGB, GL_TEXTURE1);
glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND0_RGB, GL_SRC_COLOR);
glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND1_RGB, GL_SRC_COLOR);
glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND2_RGB, GL_ONE_MINUS_SRC_ALPHA);

glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_ALPHA, GL_INTERPOLATE);
glTexEnvi(GL_TEXTURE_ENV, GL_SRC0_ALPHA, GL_TEXTURE0);
glTexEnvi(GL_TEXTURE_ENV, GL_SRC1_ALPHA, GL_TEXTURE1);
glTexEnvi(GL_TEXTURE_ENV, GL_SRC2_ALPHA, GL_TEXTURE1);
glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND0_ALPHA, GL_SRC_ALPHA);
glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND1_ALPHA, GL_SRC_ALPHA);
glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND2_ALPHA, GL_ONE_MINUS_SRC_ALPHA);

glActiveTexture(GL_TEXTURE1);
glBindTexture(GL_TEXTURE_2D, TexID1);
glEnable(GL_TEXTURE_2D);

glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE);
glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB, GL_MODULATE);
glTexEnvi(GL_TEXTURE_ENV, GL_SRC0_RGB, GL_PREVIOUS);
glTexEnvi(GL_TEXTURE_ENV, GL_SRC1_RGB, GL_PRIMARY_COLOR);
glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND0_RGB, GL_SRC_COLOR);
glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND1_RGB, GL_SRC_COLOR);

glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_ALPHA, GL_REPLACE);
glTexEnvi(GL_TEXTURE_ENV, GL_SRC0_ALPHA, GL_PREVIOUS);
glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND0_ALPHA, GL_SRC_ALPHA);



If texenv crossbar is not available, you have to use a third texture unit. This is not possible on POWERVR MBX based devices. Note that you have to bind a texture to texture unit 2 even though it is not used.

Code:
glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D, TexID0);
glEnable(GL_TEXTURE_2D);

glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);

glActiveTexture(GL_TEXTURE1);
glBindTexture(GL_TEXTURE_2D, TexID1);
glEnable(GL_TEXTURE_2D);

glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE);
glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB, GL_INTERPOLATE);
glTexEnvi(GL_TEXTURE_ENV, GL_SRC0_RGB, GL_PREVIOUS);
glTexEnvi(GL_TEXTURE_ENV, GL_SRC1_RGB, GL_TEXTURE);
glTexEnvi(GL_TEXTURE_ENV, GL_SRC2_RGB, GL_TEXTURE);
glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND0_RGB, GL_SRC_COLOR);
glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND1_RGB, GL_SRC_COLOR);
glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND2_RGB, GL_ONE_MINUS_SRC_ALPHA);

glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_ALPHA, GL_INTERPOLATE);
glTexEnvi(GL_TEXTURE_ENV, GL_SRC0_ALPHA, GL_PREVIOUS);
glTexEnvi(GL_TEXTURE_ENV, GL_SRC1_ALPHA, GL_TEXTURE);
glTexEnvi(GL_TEXTURE_ENV, GL_SRC2_ALPHA, GL_TEXTURE);
glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND0_ALPHA, GL_SRC_ALPHA);
glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND1_ALPHA, GL_SRC_ALPHA);
glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND2_ALPHA, GL_ONE_MINUS_SRC_ALPHA);

glActiveTexture(GL_TEXTURE2);
glBindTexture(GL_TEXTURE_2D, TexID1);
glEnable(GL_TEXTURE_2D);

glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE);
glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB, GL_MODULATE);
glTexEnvi(GL_TEXTURE_ENV, GL_SRC0_RGB, GL_PREVIOUS);
glTexEnvi(GL_TEXTURE_ENV, GL_SRC1_RGB, GL_PRIMARY_COLOR);
glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND0_RGB, GL_SRC_COLOR);
glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND1_RGB, GL_SRC_COLOR);

glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_ALPHA, GL_REPLACE);
glTexEnvi(GL_TEXTURE_ENV, GL_SRC0_ALPHA, GL_PREVIOUS);
glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND0_ALPHA, GL_SRC_ALPHA);






#3

FSAA Problem:

We have some reports that on some configurations FSAA stoped to work so we are looking to that and hope to fix it soon.


#4

Ah excellent! Thanks for the feedback, they proved to be useful!