Results 1 to 3 of 3

Thread: OpenGL ES beginner question

  1. #1
    Junior Member
    Join Date
    Oct 2008
    Posts
    1

    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.

    Code :
    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'?

  2. #2

    Re: OpenGL ES beginner question

    using trianglestrip dont you have to pass the indexarray?

  3. #3
    Senior Member
    Join Date
    May 2006
    Posts
    353

    Re: OpenGL ES beginner question

    Code :
    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.

    Quote Originally Posted by cobrahc
    using trianglestrip dont you have to pass the indexarray?
    No, index arrays are only required for glDrawElements, not glDrawArrays.
    Georg Kolling, Imagination Technologies
    Please ask questions specific to PowerVR hardware or SDKs on the PowerVR Insider Forum
    DevTech@imgtec.com | http://www.powervrinsider.com

Similar Threads

  1. Opengl es very beginner question
    By eshvartz in forum OpenGL ES general technical discussions
    Replies: 1
    Last Post: 11-26-2011, 07:49 AM
  2. OpenGL ES beginner question
    By opengles82 in forum OpenGL ES general technical discussions
    Replies: 1
    Last Post: 09-24-2009, 10:40 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •