Results 1 to 2 of 2

Thread: Using Textures Stumble OpenGL

  1. #1
    Join Date
    Jun 2011
    Posts
    203
    Thanks
    7
    Thanked 4 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default Using Textures Stumble OpenGL

    Hi guys, lets say I have an electronics board .bmp showing up in my OpenGL application which has 2 LEDs. I want to draw two states for each LED, on and off and they need to be independent of each other. How is such independence possible? Please note, the method should be scalable to a larger number of LEDs.

    The first solution is to have a state struct or something of the like and then every time one of the LEDs changes, I redraw the whole scene in accordance with the new state i.e. I have a background image which never changes, but say both LEDs were off and now one comes on, then the new state means we redraw the background plus that lit up LED from a list. If the second LED comes on, we redraw the background, the lit LED plus this new one. If one comes off, we redraw the background and now superimpose just one LED once again.

    The other solution is to have a background image and then have two state images for each LED, ON and OFF and every time a state change occurs, simply redraw that one LED.

    Are there other more elegant solutions to my problem? Which of these methods do you think is best?

  2. #2
    Join Date
    Dec 2012
    Posts
    90
    Thanks
    5
    Thanked 20 Times in 18 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Using Textures Stumble OpenGL

    I'd go with the second solution, since there are unlikely to be more than hundred of LEDs top. And since you are using textures you won't have need to upload changed texture to gpu every time LED state changed.

Similar Threads

  1. QGraphicsItem and OpenGL textures
    By Aldebaran in forum Qt Programming
    Replies: 4
    Last Post: 22nd January 2010, 08:37
  2. Tiling with OpenGL and textures
    By soxs060389 in forum Qt Programming
    Replies: 1
    Last Post: 25th September 2009, 21:06
  3. OpenGL Textures + Rotating
    By aleksgidenko in forum Qt Programming
    Replies: 9
    Last Post: 21st August 2009, 16:57
  4. OpenGl textures in Qt
    By Ashitaka in forum Qt Programming
    Replies: 1
    Last Post: 28th November 2006, 15:45
  5. Opengl - Textures - Qt
    By Alex63 in forum Installation and Deployment
    Replies: 1
    Last Post: 29th June 2006, 09:32

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.