Results 1 to 7 of 7

Thread: Problems converting to fixed point

  1. #1
    Junior Member
    Join Date
    Jun 2005
    Posts
    3

    Problems converting to fixed point

    Hi. I'm developing a game engine to be used both in Desktops and PDAs... I recently converted the projects vector math and opengles calls to fixed point and I'm experiencing some problems ever since.

    If I use floating point, the scene shows up fine in the PDA. If I use fixed point, however, the geometry loads ok, but everything is black (everything but the background, which has the right color). I tried making texture loading fail, and deleted the texture files from the project. That causes everything to be white in floating point, but it's still black with fixed point (made no difference if the texture files were there).

    I'm kinda new to opengl, so I was wondering if you could help me figuring this out. Any ideas on what could the problem be (or a procedure to debug this! I have no clue how to do it)?

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

    Re: Problems converting to fixed point

    Have you also converted your texture coordinates into fixed point format? Since when you are using the commonlite profile and thus fixed point you can not use float for anything ?

    If you have converted everything to fixed point you might want to try a simple object like a quad and step through it manually checking all the values (this can be a pain when using fixed point).

    Are you using a wrapper system on the desktop such as available here:

    Link to PowerVR PC Emulation SDK

    Debugging on a PC is usually a lot easier than on an actual device.

    Hope this helps,

    K-

  3. #3
    Junior Member
    Join Date
    Jun 2005
    Posts
    3

    Re: Problems converting to fixed point

    Yep... I converted everything to fixed point, but I think there's another problem, not texture related...

    When I remove the texture files, the render paints everything the same color, which I chose to be white but could be anything else. When using fixed point, however, everything is black, not white. That must mean the problem is not with the texture mapping, right?

    And I can't think of a reason for this problem...

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

    Re: Problems converting to fixed point

    Is black your clear color ? You might not even be getting the geometry in the right place ?

    K-

  5. #5

    Re: Problems converting to fixed point

    Could you post some lines of your code? Another thing, the first texel of your texture is black? I say this because if you forgot convert texcoord '1' to '1<<16', you probably will get only the first texel in the whole triangle, because '1' is very very close to 0...

  6. #6
    Junior Member
    Join Date
    Jun 2005
    Posts
    3

    Re: Problems converting to fixed point

    SOLVED!

    Hi! I wanted to thank you for the help and to inform the problem, just in case anyone goes through this again. It's really annoying to waste time with this kind of thing...

    My problem was with fixed point representation. I created a Fixed32 class and, for float compatibility, i have many constructors and cast operators. GLfixed is defined as int and the compiler calls the (int) cast operator when the function requires the type GLfixed (I thought it would consider GLfixed as a different type). Because of that, all values were being divided by 2^16.

    The geometry was working because when the function received a pointer, the cast operator was not called.

    Anyway, thanks again.

  7. #7

    Re: Problems converting to fixed point

    GLfixed is a typedef of int, and C++ doesn't allow to overload any operator (even the casts) of basic types (like int, chat, float, etc)

Similar Threads

  1. Fixed point support
    By Jens in forum Suggestions for future OpenGL ES releases
    Replies: 0
    Last Post: 04-29-2009, 06:39 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
  •