473,327 Members | 2,071 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,327 software developers and data experts.

Simulating motion and zoom with opengl Tao framework vb.net

Hi,

I'm new to openGL programming. I'm trying to simulate motion and zooming in and out in an SimpleOpenGLControl from the Tao Framework. <So you'll need to install the framework and put in a reference in Visual Studio to 'Tao' in order to test my code>

I've just begun trying to move an object up and down, but i can't seem to get the object to move. i know i'm missing something but i can't figure it out. I think it has to do with loading the transformed coordinates into a new buffer and displaying the contents from the buffer... but i don't know how to do that.

Here's my code:
Expand|Select|Wrap|Line Numbers
  1. Imports Tao.OpenGl
  2. Imports Tao.Platform
  3. Imports Tao.FreeGlut
  4.  
  5. Public Class frmMainWin
  6.  
  7.     Dim xTrans, yTrans, zTrans As Single
  8.  
  9.     Private Sub frmMainWin_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
  10.         myGlWindow.InitializeContexts()
  11.         myGlWindow.AutoSwapBuffers = True
  12.  
  13.         'init glwindow
  14.         Gl.glClearColor(0.0F, 0.0F, 0.0F, 0.0F)
  15.  
  16.         'Glu.gluLookAt(
  17.         Gl.glViewport(0, 0, 400, 300)
  18.         Gl.glMatrixMode(Gl.GL_PROJECTION)
  19.         Gl.glLoadIdentity()
  20.  
  21.         Gl.glOrtho(0.0, 10.0, 0.0, 10.0, -10.0, 10.0)
  22.         Gl.glMatrixMode(Gl.GL_MODELVIEW)
  23.         Gl.glLoadIdentity()
  24.  
  25.         xTrans = 0
  26.         yTrans = 0
  27.         zTrans = 0
  28.  
  29.     End Sub
  30.  
  31.     Private Sub myGlWindow_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles myGlWindow.Paint
  32.         Gl.glClear(Gl.GL_COLOR_BUFFER_BIT)
  33.  
  34.         Gl.glColor3f(0.2F, 0.2F, 0.8F)
  35.  
  36.         'Gl.glTranslatef(0.0F, 0.0F, 0.0F)
  37.         Gl.glTranslatef(xTrans, yTrans, zTrans)
  38.         Gl.glBegin(Gl.GL_TRIANGLES)     'Draw a triangle
  39.         Gl.glVertex3f(0.5F, 1.0F, 0.0F)
  40.         Gl.glVertex3f(0.0F, 0.0F, 0.0F)
  41.         Gl.glVertex3f(1.0F, 0.0F, 0.0F)
  42.         Gl.glEnd()
  43.  
  44.     End Sub
  45.  
  46.     Private Sub cmdUp_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdUp.Click
  47.         'MsgBox("up")
  48.         yTrans = yTrans + 1
  49.  
  50.         myGlWindow.SwapBuffers()
  51.  
  52.     End Sub
  53. End Class
  54.  
Any help would be greatly appreciated.
Thanks
Feb 24 '08 #1
1 2939
debasisdas
8,127 Expert 4TB
Question moved to .NET forum.
Feb 25 '08 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Michael Peuser | last post by:
Python's OpenGL.Tk binding makes simple 3D drawing a snap! The default mouse keys for panning and sizing is left and right, for rotation it seems to be the middle key which is on just very few...
1
by: Kurt | last post by:
Hi All, I'm just getting started rewriting a small CAD/GIS like application for designating outlines of objects in photographs/images in Python. Is there a class out there that already handles...
0
by: info | last post by:
Hi! I have just posted the C# OpenGL Framework for .NET 2.0 on our website http://www.devdept.com/code/oglf. If you are interested on these two ingredients, give it a try. You'll find a...
2
by: George | last post by:
I have marked the areas with comments as to what I would like to do and what the code does. The two problem areas are in the key pressing and mousing clicking areas. thanks for the help. This...
14
by: Jessica Weiner | last post by:
I am writing an application in C# which need to plot graphs and simple shapes (polygons, circles, squares etc). Which library is better for this purpose and why? Thanks.
3
by: Mark Thompson | last post by:
Hi, I have an application I have written in VB.NET. Part of the application is to display 3D models of buildings and allow the user to zoom and rotate around them. I have implemented this using...
0
by: Hoax | last post by:
I didn't see a forum for OpenGL so i assume it would go here. I've having an issues with my camera interfering with the transformations of my geometry. Here is my Display() code, I think it's...
0
by: paulcybulski | last post by:
I have a 2 buttons and the mouse wheel enabled with zoom functionality. Generally this is the AS: //zoom out mcName._xscale *= 0.9; mcName._yscale *= 0.9; //zoom in mcName._xscale *= 1.1;...
0
by: andrew78 | last post by:
hi all. i am writing a visualization program for 3D files like .stl files. until now everything is fine. the visualization, rotation, zoom of the 3D structure works perfect. but now i want to pick...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.