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

Posts: 134
Registered: ‎05-19-2012
My Device: Torch 9800, PlayBook 64GB, Dev Alpha
My Carrier: VIVO Brazil

Trying to Draw a 2D Triangle, But Got a Flickering Screen Instead

[ Edited ]

I'm trying to convert a code from OpenGL to OpenGL ES 2.0 (for the BlackBerry PlayBook). So far what I got is this (just the part of the code that should draw the triangle):


void setupScene() {
    glClearColor(250, 250, 250, 1);
    glViewport(0, 0, 600, 1024);

void drawScene() {

    glColorMask(0, 0, 0, 1);

    const GLfloat triangleVertices[] = {
        100,   100,
        150,  0,
        200,   100

    glVertexAttribPointer(0, 2, GL_FLOAT, GL_FALSE, 0, triangleVertices);
    glDrawArrays(GL_TRIANGLES, 0, 2);

void render() {

The problem is that when I launch the app instead of showing me the triangle the screen just flickers (very fast) from white to gray. Any idea what I'm doing wrong?


Also, here is the entire code if you need: Full source code

If I helped you please click the "Like" button to support my work.
My apps: CherryNotes - Bookmarked - Requests
Social Me: about.me - Twitter
Posts: 107
Registered: ‎02-15-2012
My Device: Blackberry Playbook 32GB
My Carrier: Virgin Mobile

Re: Trying to Draw a 2D Triangle, But Got a Flickering Screen Instead

try taking a look at the GL2.0 example.

compare the code in the example to your code and that might help.

(im no opengl expert but i think you need to define vertex and fragment shaders in 2.0)