Results 1 to 4 of 4

Thread: Porting OpenGL sw to OpenGL-ES, help needed

  1. #1
    Junior Member
    Join Date
    Oct 2004
    Posts
    4

    Porting OpenGL sw to OpenGL-ES, help needed

    I'm trying to port an OpenGL game to an embedded device running OpenGL-ES. I'm fairly good at porting stuff, but know *very* little of OpenGL, so bear with me. So far, I've got the game compiled and running under WIN32 using both he video card's OpenGL and MESA 6.2. I've also done an analysis of OGL APIs the game uses and whether those APIs exists in OGL-ES 1.1. It doesn't look too bad.

    I'm now trying to modify the sw to only use OGL functions that are also in OGL-ES. That way I can test the OGL --> OGL-ES transition fully under WIN32 before the final port to the embedded device I'm ultimately porting it to. That's where MESA comes in because it supports things like glMultiTexCoord4f.

    First specific question....

    The game uses the following OGL commands to render a character in its menu system:
    glBindTexture (GL_TEXTURE_2D, texnum);
    glBegin (GL_QUADS);
    glTexCoord2f (fcol, frow);
    glVertex2f (x, y);
    glTexCoord2f (fcol + size, frow);
    glVertex2f (x+8, y);
    glTexCoord2f (fcol + size, frow + size);
    glVertex2f (x+8, y+;
    glTexCoord2f (fcol, frow + size);
    glVertex2f (x, y+;
    glEnd ();

    Do I assume correctly that I need to replace this using OGL-ES's glMultiTexCoord4f?

    I've tried both
    glMultiTexCoord4f(draw_chars->texnum, fcol, fcol+size, frow, frow+size);
    and
    glMultiTexCoord4f(draw_chars->texnum, x, y, x+8, y+;
    Both didn't work, the menu was not visible.

    Any help would be appreciated!

    cheers, Pete

    [ October 28, 2004: Message edited by: yipton ]

  2. #2
    Junior Member
    Join Date
    Oct 2004
    Location
    UK
    Posts
    24

    Re: Porting OpenGL sw to OpenGL-ES, help needed

    <BLOCKQUOTE><font size="1" face="Arial, Verdana, Helvetica, sans-serif">quote:</font><HR>Originally posted by yipton:

    glBegin (GL_QUADS);
    glTexCoord2f (fcol, frow);
    glVertex2f (x, y);
    glTexCoord2f (fcol + size, frow);
    glVertex2f (x+8, y);
    glTexCoord2f (fcol + size, frow + size);
    glVertex2f (x+8, y+;
    glTexCoord2f (fcol, frow + size);
    glVertex2f (x, y+;
    glEnd ();
    <HR></BLOCKQUOTE>

    The glBegin / glEnd technique of submitting geometry is not supported by OGLES. You must draw using glDrawElements or glDrawArrays.

    Normally the code above would draw a quad, and between Begin and End 4 vertices are defined that form this quad. In OGLES you need to place those 4 vertex definitions (4 positions using glVertexf and 4 2D texcoords using glTexCoord2f in your code) in a buffer which you point to and then draw using the commands mentioned above. Check the documentation for more help.

    K-

    [ October 28, 2004: Message edited by: Kristof - PowerVR ]

  3. #3
    Senior Member
    Join Date
    Sep 2003
    Location
    Seattle, WA
    Posts
    246

    Re: Porting OpenGL sw to OpenGL-ES, help needed

    Just two comments:

    Instead of Mesa you could use either the reference implementation or the desktop version of Hybrid's library.

    There is a conversion library sf.net/projects/dogless that could potentially speed up the conversion; with a performance penalty, of course.

    The conversion of float to fixed is going to be the main effort if you want to achieve optimal performance for devices, especially those featuring an ARM processor (most devices I am aware of do not have an FPU).

    - HM

  4. #4
    Junior Member
    Join Date
    Oct 2004
    Posts
    4

    Re: Porting OpenGL sw to OpenGL-ES, help needed

    Using your suggestion and this posting http://khronos.org/cgi-bin/ubb/ultim...c&f=4&t=000115
    I've managed to rewrite all quads drawing using triangles. As with a lot of things, it's quite simple once you know how
    Next step is to rewrite the polygons, but I get the general idea now.

    The game indeed uses fp but it's just too much work to change that. I take my changes and stick with fp.

    Many thanks for your help! Rest assured I will be posting other newbie questions as I go along

    cheers, Pete

Similar Threads

  1. Trouble porting OpenGL code to iPhone's OpenGL ES
    By vamshivakul in forum Cross API and window system integration
    Replies: 3
    Last Post: 10-26-2011, 01:27 AM
  2. Porting OpenGL sw to OpenGL-ES, help needed - take 2
    By yipton in forum OpenGL ES general technical discussions
    Replies: 1
    Last Post: 11-06-2004, 11:49 PM

Posting Permissions

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