View Full Version : Anyone know the syntax for VB usage of Stipple lines?
09-12-2002, 12:49 PM
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.
09-12-2002, 01:25 PM
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
09-13-2002, 04:58 AM
I have stopped by and downloaded every VB example. There are no examples that have stipple lines however.
09-13-2002, 06:33 AM
okay i am not into vb but here are the c functions for line stippling
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
09-13-2002, 10:09 AM
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.
09-13-2002, 10:43 AM
Post a bit of the VB code you are using and maybe we can see what's wrong.
09-13-2002, 11:39 AM
glBegin bmLineStrip ? *see #1
glLineStipple 1, ? *see #2
glEnable glcLineStipple ? *see #3
**** Vertices in here ****
#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.
09-13-2002, 12:00 PM
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
glLineStipple 1, &h5555 'the first number says how many times to use each bit
Now you draw your line
glVertex2f -1, 0
glVertex3f 1, 0
09-16-2002, 05:29 AM
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
Powered by vBulletin® Version 4.2.2 Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.