Results 1 to 6 of 6

Thread: Reversing Up-Vector of the camera

  1. #1
    Junior Member Newbie
    Join Date
    Jan 2012
    Posts
    4

    Reversing Up-Vector of the camera

    Hi,
    I have a texture(jpg) and when I map it to a cylinder OpenGL maps it upside down(I do not know why?)!
    Now I decided to reverse my Up-Vector instead of rotating my texture which is(I think) computationally expensive.
    Here is my code:
    gluLookAt(0.0, 0.0, 10.0, 0.0, 0.0, 0.0, 0.0, -1.0, 0.0);

    Is it a good idea?

  2. #2
    Senior Member OpenGL Pro
    Join Date
    Apr 2010
    Location
    Germany
    Posts
    1,135

    Re: Reversing Up-Vector of the camera

    Why don't you just mirror the UVs?

  3. #3
    Senior Member Regular Contributor imported_tksuoran's Avatar
    Join Date
    Mar 2008
    Location
    Cambridge, UK
    Posts
    223

    Re: Reversing Up-Vector of the camera

    In general, GL functions assume (1, 1) is to the right and up from (0, 0). TexImage2D assumes data for (0, 0) come in first and (1, 1) come in last. Your image loading routine might assume top row first.

    Mirroring UV like thokra advised is efficient and easy fix.

  4. #4
    Junior Member Newbie
    Join Date
    Jan 2012
    Posts
    4

    Re: Reversing Up-Vector of the camera

    Thanks,
    When I use JIG's jpeg-8 library the image is mapped upside down, but when I use FreeImage library everything is OK.

  5. #5
    Newbie Frequent Contributor
    Join Date
    Mar 2016
    Posts
    896

    Re: Reversing Up-Vector of the camera

    Some libraries already flip the image in anticipation that it will be used as an OpenGL texture, others simply give you the data in the file, and some allow you to configure this. Check the documentation of the libs to see if you can make them behave consistently (if you need to keep the option to use both) or just pick one and stick with it

  6. #6
    Senior Member Regular Contributor
    Join Date
    Jun 2009
    Location
    FL , USA
    Posts
    192

    Re: Reversing Up-Vector of the camera

    When I use JIG's jpeg-8 library the image is mapped upside down, but when I use FreeImage library everything is OK.
    I second to carsten's reply. Images like BMP (MS version) arrange data such that the first row is last and last row is first. So you need to first check the file format and then check with the library.

Similar Threads

  1. How do I get the forward vector or my camera?
    By hashbrown in forum OpenGL: General
    Replies: 3
    Last Post: 09-06-2016, 08:15 PM
  2. Replies: 3
    Last Post: 12-11-2013, 08:52 AM
  3. about up vector of camera
    By zydgyy in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 08-13-2012, 01:41 AM
  4. Determining camera aim vector
    By gib in forum OpenGL: Advanced Coding
    Replies: 0
    Last Post: 02-03-2003, 12:24 PM
  5. Vector Camera
    By imported_zedus in forum OpenGL: Advanced Coding
    Replies: 2
    Last Post: 11-24-2000, 06:44 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
  •  
Proudly hosted by Digital Ocean