Advertisement

glclipplane problem in VB

Started by January 11, 2003 02:54 PM
3 comments, last by daryoushj 22 years, 1 month ago
I have a 3D-Graph drawn with VB+OpenGL and I have to perform a 3D-Clipping based on User''s Input which comes as 3-pairs of: X-Min, X-Max Y-Min, Y-Max Z-Min, Z-Max (all being 3D-Coordinates) (I am also rotating the 3D-Graph based on User''s Input using gluLookAt subroutine.) Now, as far as I''ve gathered, I should be able to do the 3D-Clipping using glClipPlane on PLANE0 to PLANE5 but however I tried, it didn''t work!?!? I even tried using glOrtho X-Min,X-Max,Y-Min,Y-Max,Z-Min,Z-Max and still didn''t have any luck! Can anyone please help me? With so much thanks, Daryoush
Daryoush JavanSenior UNIX-Specialistdjavan@thundersort.com
ok:

do you enable the clip planes?

do you understand the plane equation?

when are you setting the clip planes? (it should be after glLookAt)

| - Project-X - my mega project.. big things comming soon - | - adDeath - an ad blocker I made - | - email me - |
Advertisement
Hi and thanks a lot for your reply.

As for your questions, the answer is YES to both.

The core of problem has actually two parts:
1. How (and where in the sequence of commands and gl-sub calls) should I be using glClipPlane? (What about any other associated calles such as glViewModel? Where would they go, if they should?)
2. Why doesn''t VB accept the following code:

Dim xClip() As GLdouble
xClip = Array(1#, 0#, 0#, 5#)
glClipPlane cpClipPlane0, xClip
glEnable glcClipPlane0

It says "ByRef arguement type mismatch", highlighting "xClip"

Daryoush JavanSenior UNIX-Specialistdjavan@thundersort.com
Try passing xClip as a varptr(xClip) to glClipPlane. That _might_ solve the problem...

The opengl32 type library is flawed in places.
Thanks a lot for the tip.

The problem with calling glClipPlane (i.e. the compiler error) was due to missing "Declare" statement as:

Public Declare Sub glClipPlane Lib "opengl32" (ByVal plane As glClipPlaneConstants, equ() As GLdouble)

So, my little VB program is OK AS FAR AS recognizing glClipPlane.
BUT!!!
the clipping is not happenning as I expect and my best guess is that I am missing some other "setting" (i.e. gl-sub calls) and/or the whereabouts/order of the calls.

Any help is very much appreciated.
Daryoush JavanSenior UNIX-Specialistdjavan@thundersort.com

This topic is closed to new replies.

Advertisement