Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 7 of 7

Thread: Visual Basic 5 and Opengl

  1. #1
    Junior Member Newbie
    Join Date
    Feb 2000
    Location
    Montreal,Quebec,Canada
    Posts
    2

    Visual Basic 5 and Opengl

    Hello everybody,

    Well i was wondering is someone can help me with that Please ....

    I am using VB5 and an Opengl Ocx created by the waites group found on their Opengl Bible book. The Problem is that they provide a component like the picture box where you can use Opengl commands and functions (most of them) but they only create six events functions with it

    1. Render
    2. Setuprc
    3.DragOver
    4. getfocus
    etc
    they do not provide a MouseMove event
    So i am trying to find a way to get the mouse position in the component and i can't
    {I am doing a Modeling Program} i want to be able to show the mouse position when the mouse is in mouvement in the component.

    I have try everything i can think of but nothing ... I put the code in the GetFocus event but it did not works and i even try with the GetFocus event and then again nothing ...

    So please if someone can help me in anyway or give me some tips or tricks or advice or anythind please do ....

    Master Minds

  2. #2
    Advanced Member Frequent Contributor
    Join Date
    Feb 2000
    Posts
    569

    Re: Visual Basic 5 and Opengl

    have you try to give the focus back to the form on wich the box is when you don't draw, and give it back when you what to draw?

  3. #3
    Junior Member Newbie
    Join Date
    Feb 2000
    Location
    Montreal,Quebec,Canada
    Posts
    2

    Re: Visual Basic 5 and Opengl

    Originally posted by Gorg:
    have you try to give the focus back to the form on wich the box is when you don't draw, and give it back when you what to draw?
    Yes i did but nothing ... Perhaps there is an other way of doing that ... Can you tell me how i can access the (x,y) position of the mouse in an event who do not as it as a parameter for exemple the GetFocus(there is no parameter) event if i wanted to access the mouse position within a function like how could i do that ????

    Thanks for reponding ....

  4. #4
    Advanced Member Frequent Contributor
    Join Date
    Feb 2000
    Posts
    569

    Re: Visual Basic 5 and Opengl

    What I've been thinking by saying: give back the focus to the main form is that:

    When your form as the focus, you use it's mouse event to capture it's position. When you are ready to write another frame, you just give back the focus to your "opengl box".

    Something else you could do that doesn't need you to change the focus is to use pure win32 mouse calls like "mouse_event" wich will give you everything you need(position, modification of the position, if buttons have been pressed etc.).

    in case you want to try the second option here is the declaration you have to put in your program:

    Public Declare Sub mouse_event Lib "user32" Alias "mouse_event" (ByVal dwFlags As Long, ByVal dx As Long, ByVal dy As Long, ByVal cButtons As Long, ByVal dwExtraInfo As Long)

    to learn how to work with the function, go to
    http://msdn.microsoft.com/library/

    and the check under platform SDK/win32 Api/references

    then look for the mouse input fonctions and check mouse_event.

    have fun!

  5. #5
    Guest

    Re: Visual Basic 5 and Opengl

    Originally posted by Gorg:

    will it be a fullscreen app?
    if it will = true then msgbox "Use winapi!"
    (laugh!)

  6. #6
    Guest

    Re: Visual Basic 5 and Opengl

    You could always use the Softoholic OpenGL control instead - see http://www.softoholic.bc.ca/opengl/index.htm

    It has all the usual form events. Hope this helps.
    Steve

  7. #7
    Junior Member Newbie
    Join Date
    Jul 2000
    Posts
    29

    Re: Visual Basic 5 and Opengl

    Also if you just want to use the Whait OpenGL OCX then you should be able to use the selection and feedback buffer to get the coords.

    cwhite40

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •