Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Graphics
  4. [OpenGL] Drawing line with patterns

[OpenGL] Drawing line with patterns

Scheduled Pinned Locked Moved Graphics
graphicscomgame-devlinuxregex
4 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • N Offline
    N Offline
    Naveen
    wrote on last edited by
    #1

    Hi all, I want to draw a line with patter "----- -- "( 1111100011000 ). The problem is that, the glLineStipple() function accepts pattern in short variable(16 bits). But in my case there is only 13 bits. Is there any method to draw a line with the above pattern? Thanks

    nave [OpenedFileFinder] [My Blog]

    D 1 Reply Last reply
    0
    • N Naveen

      Hi all, I want to draw a line with patter "----- -- "( 1111100011000 ). The problem is that, the glLineStipple() function accepts pattern in short variable(16 bits). But in my case there is only 13 bits. Is there any method to draw a line with the above pattern? Thanks

      nave [OpenedFileFinder] [My Blog]

      D Offline
      D Offline
      Dan 0
      wrote on last edited by
      #2

      Not directly, but you could play with the bit pattern and the scale to make your pattern fit, using the following equation, pattern bit ( counter / factor ) mod 16

      N 1 Reply Last reply
      0
      • D Dan 0

        Not directly, but you could play with the bit pattern and the scale to make your pattern fit, using the following equation, pattern bit ( counter / factor ) mod 16

        N Offline
        N Offline
        Naveen
        wrote on last edited by
        #3

        Thanks. I saw this equation in MSDN. But didnt understand the equation correctly. Could you please elobarate it? Does this eqation mean pattern bit * ( counter / factor ) mod 16 Also what is this counter? How can I change its value? Thanks

        nave [OpenedFileFinder] [My Blog]

        D 1 Reply Last reply
        0
        • N Naveen

          Thanks. I saw this equation in MSDN. But didnt understand the equation correctly. Could you please elobarate it? Does this eqation mean pattern bit * ( counter / factor ) mod 16 Also what is this counter? How can I change its value? Thanks

          nave [OpenedFileFinder] [My Blog]

          D Offline
          D Offline
          Dan 0
          wrote on last edited by
          #4

          The counter is internal to the raster unit, it is reset to zero on a glBegin and incremented for every antialiased pixel box until glEnd is called. Factor defines how many pixel blocks are printed for each single bit, so lets say you wanted to print 110011, what you could also do is 101 with factor = 2. So basically, you may not get the exact pattern you want, but by basing the factor to the smallest consecutive bits you can have a bit more freedom.

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups