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.

inside custom component

Native Development

Reply
New Contributor
rus_phantom
Posts: 6
Registered: ‎12-23-2012
My Device: Playbook 2.0

openGL + JPEG

Hi

Is there any way to render jpeg texture? I draw png texture in this way:


void CUITexture::smileysurprised:nRender()
{
if (!valide()) return;

glEnable(GL_TEXTURE_2D);
glEnable (GL_BLEND);
glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);

glEnableClientState(GL_VERTEX_ARRAY);
glEnableClientState(GL_TEXTURE_COORD_ARRAY);

//glLoadIdentity();

glPushMatrix();
if (!isZero(m_angle)) {
glTranslatef(position.x+size.x/2.0f,position.y+size.y/2.0f,0);
glRotatef(m_angle, 0.0f, 0.0f, 1.0f);
if (!fsimillar(zoom,1.0f)) {
glScalef(zoom,zoom,1.0f);
}
glTranslatef(-size.x/2.0f,-size.y/2.0f,0);
} else {
if (!fsimillar(zoom,1.0f)) {
glTranslatef(position.x+size.x/2.0f,position.y+size.y/2.0f,0);
glScalef(zoom,zoom,1.0f);
glTranslatef(-size.x/2.0f,-size.y/2.0f,0);
} else {
glTranslatef(position.x, position.y, 0);
}
}

glVertexPointer(2, GL_FLOAT, 0, m_vertices);
glTexCoordPointer(2, GL_FLOAT, 0, m_tex_coord);
glBindTexture(GL_TEXTURE_2D, m_texture);

glColor4f(color.r, color.g, color.b, color.a);
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
glPopMatrix();

glDisableClientState(GL_TEXTURE_COORD_ARRAY);
glDisableClientState(GL_VERTEX_ARRAY);

glDisable (GL_BLEND);
glDisable(GL_TEXTURE_2D);
}

 

Can I load jpg to render it in the same way? I need that becouse full screen jpeg texture usually have 3 times less size. Thanks