Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 3 of 3

Thread: Please help me, porting question

  1. #1
    Newbie Newbie
    Join Date
    Aug 2012
    Posts
    2

    Please help me, porting question

    I am trying desperatly to port some opengl es 1.0 to opengl es 2.0 code. The reason I am asking here instead of the opengl es forum is because here is a more active forum and the code is very similar to opengl code anyway.

    In the original opengl es 1.0 code we have this:
    Buffer updated each frame but there is no glBindBuffer calls or any concept of VBO's
    The main render function has this:

    glEnableClientState(GL_VERTEX_ARRAY);
    glVertexPointer(3, GL_FLOAT, VertexSize, pVertex);
    pVertex += sizeof(float) * 3;
    glDrawElements(glPrimType, nCount * 6, GL_UNSIGNED_SHORT, ((PyroByte *) pIndexBuffer->GetBuffer()) + 12 * nFirst);
    glDisableClientState(GL_VERTEX_ARRAY);

    What is the best possible way to go about getting this to work with opengl es 2.0?
    I know I need shaders and VBO's but I am just unsure how to implement it all.
    If someone could give me some basic step by step plan I would be very grateful thanks.

  2. #2
    Member Regular Contributor
    Join Date
    Apr 2009
    Posts
    258
    You dont need to have VBO - GLES2 allows to render from clinet memory as well.
    The porting should be pretty easy, when you implement your shaders.

    glEnableClientState -> glEnableVertexAttribArray
    glDisableClientState -> glDisableVertexAttribArray
    glVertexPointer -> glVertexAttribPointer

    For the shaders you need to learn GLSL, shader setup is pretty easy, but somewhat verbose.

    glCreateProgram
    glCreateShader (vertex + fragment)
    glCompileShader
    glAttachShader
    glBindAttribLocation
    glLinkProgram
    glUseProgram

    You can have a look at any GL2.0+ tutorial and it should be _mostly_ the same.

  3. #3
    Newbie Newbie
    Join Date
    Aug 2012
    Posts
    2
    You are the best!
    I didnt know it was as simple as that.
    Thanks so much this is now solved.

Posting Permissions

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