Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8839587
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T10:16:11+00:00 2026-06-14T10:16:11+00:00

I have something rather strange going on at the moment with my code. I

  • 0

I have something rather strange going on at the moment with my code. I am running this on a BlackBerry Playbook and it is OpenGL ES 1.1

EDIT 4: I deleted everything I have posted to simplify my question.

I took the code and simplified it to drawing two overlapping triangles. Here is the array containing the coordinates as well as an array containing colours:

GLfloat vertices[] =
{
          // front
           175.0f, 200.0f, -24.0f,
           225.0f, 200.0f, -24.0f,
           225.0f, 250.0f, -24.0f,

          // back
           200.0f, 200.0f, -25.0f,
           250.0f, 200.0f, -25.0f,
           250.0f, 250.0f, -25.0f
};


static const GLfloat colors[] =
{
       /* front  */  1.0f,0.0f,0.0f,1.0f,1.0f,0.0f,0.0f,1.0f,1.0f,0.0f,0.0f,1.0f, //Red
       /* back  */  0.0f,1.0f,0.0f,1.0f,0.0f,1.0f,0.0f,1.0f,0.0f,1.0f,0.0f,1.0f //Green
};

Please note that my coordinates are 0 to 1024 in the x direction and 0 to 600 in the y direction as well as 0 to -10000 in the z direction.

Here is my setup code which reflects this:

    glClearDepthf(1.0f);
    glClearColor(1.0f,1.0f,1.0f,1.0f);
    glEnable(GL_DEPTH_TEST);
    glDepthMask(GL_TRUE);
    glShadeModel(GL_SMOOTH);

    glViewport(0, 0, surface_width, surface_height);
    glMatrixMode(GL_PROJECTION);
    glLoadIdentity();

    glOrthof(0, surface_width, 0, surface_height, 0, 10000);

    glMatrixMode(GL_MODELVIEW);
    glLoadIdentity();

    glEnable(GL_DEPTH_TEST);
    glDepthMask(GL_TRUE);

I have depth enabling in two places as I was trying to rule out the possibility that it was supposed to be used while a certain matrix mode was chosen.

Lastly here is my render code:

void render()
{
    //Typical render pass
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

    glEnableClientState(GL_VERTEX_ARRAY);
    glVertexPointer(3, GL_FLOAT, 0, vertices);

    glEnableClientState(GL_COLOR_ARRAY);
    glColorPointer(4, GL_FLOAT, 0, colors);

    glDrawArrays(GL_TRIANGLES, 0 , 6);

    glDisableClientState(GL_VERTEX_ARRAY);
    glDisableClientState(GL_COLOR_ARRAY);

    //Use utility code to update the screen
    bbutil_swap();
}

The issue is that no matter what I do the green triangle is always overlayed over the red one. Changing z values either way has no effect on the finished image. I cannot figure this out.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T10:16:12+00:00Added an answer on June 14, 2026 at 10:16 am

    I finally got it to work. The issue was with EGL setup code that I used that was provided. In bbutil.c (in my case .cpp) there is some code:

    if(!eglChooseConfig(egl_disp, attrib_list, &egl_conf, 1, &num_configs)) {
            bbutil_terminate();
            return EXIT_FAILURE;
        }
    

    (that is not all the code in the file but its the important bit)

    This basically freaks if the given attribute list is nor supported. Up higher in the file attrib_list is set as follows:

    EGLint attrib_list[]= { EGL_RED_SIZE,        8,
                            EGL_GREEN_SIZE,      8,
                            EGL_BLUE_SIZE,       8,
                            EGL_SURFACE_TYPE,    EGL_WINDOW_BIT,
                            EGL_RENDERABLE_TYPE, 0,
                            EGL_NONE};
    

    There is no depth buffer specified. Now if you look in the EGL spec it says no depth is the default. BINGO, that’s the problem. So I just modified it to look like this:

    EGLint attrib_list[]= { EGL_RED_SIZE,        8,
                            EGL_GREEN_SIZE,      8,
                            EGL_BLUE_SIZE,       8,
                            EGL_SURFACE_TYPE,    EGL_WINDOW_BIT,
                            EGL_RENDERABLE_TYPE, 0,
                            EGL_DEPTH_SIZE, 24,
                            EGL_NONE};
    

    Note the EGL_DEPTH_SIZE and the 24. This sets the depth buffer to 24 bits. On the PlayBook 32 throws a segmentation fault although usually 32 is not supported anyways. Perhaps this will help someone out there trying to figure out why the provided include is causing this funny result I described as my problem.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have something like this : code.js var params = { option1 : encodeURIComponent(text\n
I have just encountered something rather strange, I use the Zend Framework 1.10 with
I have something I am trying to achieve. I have a web application running
I have something like this: function showFunction () { // need position and place
I have something like the code below: for(int i=0;i<10;i++){ button=new JButton(buttons[i]); button.addActionListener(new ActionListener(){ public
I have something like this: <?xml version=1.0 encoding=utf-8?> <Data> <ConfigDatas> <ArrayOfConfigData xmlns:i=http://www.w3.org/2001/XMLSchema-instance xmlns=http://schemas.datacontract.org/2004/07/BTTest.Models> <ConfigData>
I have something like this: [{'date': 1, 'value':5}, {'date':2,'value':3}, ...] and want to map
I must be missing something quite obvious here because something rather strange is happening
I have a rather strange question: I have a Java application which uses applications
We stumbled upon a rather strange problem IMO. Our clients have been complaining about

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.