Anyone know the syntax for VB usage of Stipple lines?

I can’t get the syntax correct for setting the stipple lines in VB using openGL. Does anyone know where I can get some information on VB and opengl. Also in the future I will be using C#. I could use some examples with that.

maybe you should stop by at
his tutorials cover various aspects of opengl and most of them do offer ports to any kind of compiler and os

I have stopped by and downloaded every VB example. There are no examples that have stipple lines however.

okay i am not into vb but here are the c functions for line stippling


glLineStipple(GLint factor,
GLushort pattern);
where pattern is a 16bit value and each bit represents a segment of the whole line either to be drawn or not
factor is a stretching or shrinking modifier

example for pattern
bit representation: 0101010101010101
stippled line: - - - - - - - -
as you can see the bit order is reverse to the line stipple.
I hope i helped you a little

Thanks, I already know the C code for stipple. When I try to use the same function calls in VB, nothing happens. I call the same functions and send the same arguments. I think it doesn’t like the arguments I send it. If I could see an example I could have some idea what I am doing wrong.

Post a bit of the VB code you are using and maybe we can see what’s wrong.

glBegin bmLineStrip ? *see #1
glLineStipple 1, ? *see #2
glEnable glcLineStipple ? *see #3
**** Vertices in here ****
glDisable glcLineStipple

#1: Should the glEnable and glLineStipple go inside the glBegin/glEnd. I have already tried different combinations of putting those statements inside and outside and in different order. I still have no idea what is correct.

#2: What number goes here. How should it look. I have tried putting ones and zeros hex numbers and integers. I don’t know what is correct because nothing works.

#3: Should I enable stipple before I set it or vice versa?

I hope this helps. The main problem I am having is figuring out what order to put those statements and how to set them, which is basically everything there is about stipple.

Ok, I see your problem. First of all glLineStipple cannot be called between glBegin/glEnd.

When you use glLineStipple it sets the style that will be used when you draw lines.

What you pass to glLineStipple is a16-bit unsigned short with the bit pattern you want to use. for instance say you want to alternate the bits to use the binary 0101 0101 0101 0101. In hex this would be 0x5555. (&h5555 in VB if I remember correctly, or just use the decimal form of 21845)

So for that part you now have

glEnable glLineStipple
glLineStipple 1, &h5555 'the first number says how many times to use each bit

Now you draw your line

glBegin glLine
glVertex2f -1, 0
glVertex3f 1, 0

Thanks so much guys. It worked. I tried the configuration you suggested earlier but my number was way to small. In fact that was probably my main problem. Thanks again