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: -
Imports Tao.OpenGl
-
Imports Tao.Platform
-
Imports Tao.FreeGlut
-
-
Public Class frmMainWin
-
-
Dim xTrans, yTrans, zTrans As Single
-
-
Private Sub frmMainWin_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
-
myGlWindow.InitializeContexts()
-
myGlWindow.AutoSwapBuffers = True
-
-
'init glwindow
-
Gl.glClearColor(0.0F, 0.0F, 0.0F, 0.0F)
-
-
'Glu.gluLookAt(
-
Gl.glViewport(0, 0, 400, 300)
-
Gl.glMatrixMode(Gl.GL_PROJECTION)
-
Gl.glLoadIdentity()
-
-
Gl.glOrtho(0.0, 10.0, 0.0, 10.0, -10.0, 10.0)
-
Gl.glMatrixMode(Gl.GL_MODELVIEW)
-
Gl.glLoadIdentity()
-
-
xTrans = 0
-
yTrans = 0
-
zTrans = 0
-
-
End Sub
-
-
Private Sub myGlWindow_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles myGlWindow.Paint
-
Gl.glClear(Gl.GL_COLOR_BUFFER_BIT)
-
-
Gl.glColor3f(0.2F, 0.2F, 0.8F)
-
-
'Gl.glTranslatef(0.0F, 0.0F, 0.0F)
-
Gl.glTranslatef(xTrans, yTrans, zTrans)
-
Gl.glBegin(Gl.GL_TRIANGLES) 'Draw a triangle
-
Gl.glVertex3f(0.5F, 1.0F, 0.0F)
-
Gl.glVertex3f(0.0F, 0.0F, 0.0F)
-
Gl.glVertex3f(1.0F, 0.0F, 0.0F)
-
Gl.glEnd()
-
-
End Sub
-
-
Private Sub cmdUp_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdUp.Click
-
'MsgBox("up")
-
yTrans = yTrans + 1
-
-
myGlWindow.SwapBuffers()
-
-
End Sub
-
End Class
-
Any help would be greatly appreciated.
Thanks
1 2939
Question moved to .NET forum.
Sign in to post your reply or Sign up for a free account.
Similar topics
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...
|
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...
|
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...
|
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...
|
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.
|
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...
|
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...
|
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;...
|
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...
|
by: ryjfgjl |
last post by:
ExcelToDatabase: batch import excel into database automatically...
|
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...
|
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...
|
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...
|
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)...
|
by: Defcon1945 |
last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
|
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....
|
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
|
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...
| |