Hi,
I’m using opengl ported to vb6 to write a CAD package. Whilst the graphics rendering speed is great, I am battling a bit with the opengl language itself.The following routine is used to select rendered lines, each which has been given a record number. Whilst it works fine if I keep the GluPickMatix window height (MyXe) and width (MyYe) to 5 or below, it does not work for values above this, ie when I use an elastic band type inside area select where these numbers are considerably greater eg 25
I notice all the examples use GluPerspective directly after GluPickMatrix but I am unsure how this would effect the glOrtho command I use to zoom in and out by increasing or decreasing these values.
I’m really at a total loss on this and any help would be appreciated
Thanks
Tim
[b]Private Sub Process_selection(x, y, MyXe, MyYe)
Dim BUFFER_LENGTH
Dim hits As Integer
Dim viewport(0 To 3) As GLuint
Dim SelectBuff(0 To 64) As GLuint
glClear GL_COLOR_BUFFER_BIT Or GL_DEPTH_BUFFER_BIT Or GL_STENCIL_BUFFER_BIT
glSelectBuffer 64, SelectBuff(0)
glGetIntegerv GL_VIEWPORT, viewport(0)
glMatrixMode GL_PROJECTION
glPushMatrix
glRenderMode GL_SELECT
glLoadIdentity
If MyXe = 0 Then MyXe = 5#
If MyYe = 0 Then MyYe = 5#
gluPickMatrix x, viewport(3) - y - 35, MyXe, MyYe, viewport(0) 'constant 35 must be here or y axis is out - possibly toolbar ?
’ I use this to zoom in and out
glOrtho MyOrtho(0), MyOrtho(1), MyOrtho(2), MyOrtho(3), MyOrtho(4), MyOrtho(5)
glMatrixMode GL_MODELVIEW
glPushMatrix
glTranslatef XMove, YMove, 0
glRotatef XAng, 1, 0, 0
glRotatef YAng, 0, 1, 0
glRotatef ZAng, 0, 0, 1
glInitNames
glPushName (0)
'Existing ones that would be in the list
If UBound(MyLine, 1) > 1 Then
Upper = 1
Do
With MyLine(Upper)
glLoadName (.LNo)
glBegin GL_LINES
glColor3f .LcR, .LcG, .LcB
glVertex3f .Lx1, .Ly1, .Lz1
glColor3f .LcR, .LcG, .LcB
glVertex3f .Lx2, .Ly2, .Lz2
glEnd
glFlush
Upper = Upper + 1
End With
Loop Until Upper > UBound(MyLine, 1)
End If
'now the very new ones
If UBound(NewLine, 1) > 1 Then
Upper = 1
Do
With NewLine(Upper)
glLoadName (.LNo)
glBegin GL_LINES
glColor3f .LcR, .LcG, .LcB
glVertex3f .Lx1, .Ly1, .Lz1
glColor3f .LcR, .LcG, .LcB
glVertex3f .Lx2, .Ly2, .Lz2
glEnd
glFlush
Upper = Upper + 1
End With
Loop Until Upper > UBound(NewLine, 1)
End If
glMatrixMode GL_PROJECTION
glPopMatrix
glFlush
hits = glRenderMode(GL_RENDER)
glMatrixMode GL_MODELVIEW
RenderMode = GL_RENDER
glLoadIdentity
If hits > 0 Then
'Beep: Beep
Form1.Caption = SelectBuff(3)
Erase SelLine()
ReDim SelLine(1)
Call Which_end(x, y, Val(SelectBuff(3)))
Call Task_Is(Val(SelectBuff(3)), Form1)
End If
End Sub
[/b]