Welcome!

Welcome to the Official BlackBerry Support Community Forums. This is your resource to discuss support topics with your peers, and learn from each other. New to the forum? Please visit the ‘Getting Started’ link below.
inside custom component

Native Development

Reply
Contributor
TobyKaos
Posts: 38
Registered: ‎12-12-2012
My Carrier: free

OpenGL image with alpha are darker

Hello,

 

I run my game on BB10 (porting from Android, PC). On PC Android my game images with an alpha are ok but on the playbook all alpha are darker. Something I am missing?

 

Code to load texture:

 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, image.getWidth(), image.getHeight(), 0, GL_RGBA, GL_UNSIGNED_BYTE, image.getDatas());

 

 

 

Code to render a texture:

glClearColor((GLfloat)(gBackColor.r), (GLfloat)(gBackColor.g), (GLfloat)(gBackColor.b), (GLfloat)(gBackColor.a));

  // Efface l'ecran et le tampon de profondeur : note: pas besoin pour le color buffer car on affcihe tout l ecran
  glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);  
 
  glLoadIdentity();
  glPushMatrix();
 
  glEnableClientState(GL_VERTEX_ARRAY);
  glEnableClientState(GL_TEXTURE_COORD_ARRAY);
  glEnable(GL_TEXTURE_2D);
  glEnable(GL_BLEND);
  glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);   

 

   M_Color lightDiffuse = disp_GetGlobalDiffuse();

    // affect lightDiffuse
    lightDiffuse *= this->mDiffuseColor;
 
    glColor4f((GLfloat)(lightDiffuse.r), (GLfloat)(lightDiffuse.g), (GLfloat)(lightDiffuse.b), (GLfloat)lightDiffuse.a);

 

And finally I use glDrawArrays(....)

 

 

On PC and Android I have no problem.

 

Thank you

Please use plain text.
Contributor
TobyKaos
Posts: 38
Registered: ‎12-12-2012
My Carrier: free

Re: OpenGL image with alpha are darker

premultiplied alpha ? Automatic?

Please use plain text.
Developer
BGmot
Posts: 956
Registered: ‎11-24-2011
My Carrier: x

Re: OpenGL image with alpha are darker

May be couple of screenshots?

Please use plain text.
Contributor
TobyKaos
Posts: 38
Registered: ‎12-12-2012
My Carrier: free

Re: OpenGL image with alpha are darker

bug

 

As you can see cloud are dark. Halo arround the fuel are dark to.

Please use plain text.