OpenGL ES beginner question

Hi All,

I’m trying to get the OpenGL ES API for windows on PXAXXX Processors running on my wince 5.0 PXA255 system. I’m using the lib and dll released by Intel/Marvell.

The sample program I have builds and link the code. I’m able to start using OpenGL functions. I’m setup a window for display and I’ve been able to manipulate the window size and change the background color on the fly via glClearColorx.

The problem is whenever I attempt to draw using glDrawArrays or glDrawElements. I’m not usre entirely how OpenGL works but when I define vertix coords inside of my matrix the program crashes with an invalid instruction. When i define vertices outside the matrix the program runs fine but obviously doesn’t draw anything. See the sample below.


GLfloat square[] = {
	0.25, 0.25, 0.0,
	0.75, 0.25, 0.0,
	0.25, 0.75, 0.0,
	0.75, 0.75, 0.0
    };

BOOL InitOGLES()
{  
     ...

  glClearColorx(0, 0, 0, 0);
  glShadeModel(GL_SMOOTH);

  RECT r;
  GetWindowRect(hWnd, &r);
  glViewport(r.left, r.top, r.right - r.left, r.bottom - r.top);

  glMatrixMode(GL_PROJECTION);
  glLoadIdentity();
  glOrthox(FixedFromInt(0.0f), FixedFromInt(1.0f), 
              FixedFromInt(0.0f), FixedFromInt(1.0f), 
              FixedFromInt(-1.0f), FixedFromInt(1.0f));
  return TRUE;
}
//----------------------------------------------------------------------------
void Render()
{
   glClear (GL_COLOR_BUFFER_BIT);
   glEnableClientState(GL_VERTEX_ARRAY);
   glVertexPointer(3, GL_FLOAT, 0, square);
   glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
   glDisableClientState(GL_VERTEX_ARRAY);
   glFlush ();
   eglSwapBuffers(glesDisplay, glesSurface);
}

main_simplified()
{
   InitOGLES();
   while(!quit)
      render();
}

Does anyone see a problem with the code?
Does anyone know if the Intel implimentation is working as its provided ‘as-is’?

using trianglestrip dont you have to pass the indexarray?

glVertexPointer(3, GL_FLOAT, 0, square);

It seems you are talking about an implementation of OpenGL ES Common Lite. GL_FLOAT is not a valid vertex data type for a Common Lite profile implementation, therefore this call fails and the vertex array pointer remains NULL, which causes a crash when calling glDrawArrays. Use glGetError in debug builds to find such problems.

No, index arrays are only required for glDrawElements, not glDrawArrays.

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.