473,795 Members | 3,151 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

OpenGL - Order of transformations

7 New Member
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 pretty straight forward.

Expand|Select|Wrap|Line Numbers
  1. void Display(void)
  2. {
  3.       glClear(GL_COLOR_BUFFER_BIT |   GL_DEPTH_BUFFER_BIT);
  4.       glEnable(GL_DEPTH_TEST);
  5.  
  6.       eyePos.Set(0,0,10);
  7.       //this is my wrist position
  8.        targetPos.Set(GraspEngine.wsPositions.palmContainerMat[12],GraspEngine.wsPositions.palmContainerMat[13],GraspEngine.wsPositions.palmContainerMat[14]);
  9.  
  10.       //I draw all environment objects here as primitives
  11.       drawEnvObj();
  12.       //Render the hand here
  13.       render();
  14.  
  15.       //get distance to closest primitive, set color to red, and select motion from primitive struct
  16.       GraspEngine.GetDistToEnvObj(&GraspEngine.env);
  17.  
  18.       //reset all transformations and place camera. The PanXYZ variable is a keyboard callback which is set to 0 initially.
  19.       glMatrixMode(GL_MODELVIEW);
  20.       glLoadIdentity();
  21.       gluLookAt(eyePos.GetX()-panX,eyePos.GetY()-panY,eyePos.GetZ()-panZ,
  22.       targetPos.GetX(),targetPos.GetY(),targetPos.GetZ(),
  23.             0.0, 1.0, 0.0);
  24.  
  25.       //output wrist position, it is correct but camera won’t move now.  If I place this at the top then the camera moves but the wrist position is thrown off by this transformation
  26.  
  27. cout << GraspEngine.wsPositions.wristContainerMat[12] << "  " << GraspEngine.wsPositions.wristContainerMat[13] << "  " << GraspEngine.wsPositions.wristContainerMat[14] << endl;
  28.  
  29.       glutSwapBuffers();
  30.       glutPostRedisplay();
  31. }
  32.  

Thanks in advance,

Matt Brisbin
Nov 10 '07 #1
0 968

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

Similar topics

15
4546
by: oracle411 | last post by:
Hi I'm new to OpenGL, but have an OpenGL application written in CPP that I would like to display on a web browser. Was wondering how this could be done? Thank you very much
10
5223
by: Bad_Kid | last post by:
which is better for what?
2
3066
by: pontifikas | last post by:
I've be struggling for a few days to make Opengl work in VS using C#. However, all wrappers I've stambled on(CsGL, CsGL.Basecode,ColinFahey's wgl etc) do not provide sufficient info on how to do it.They only give their own classes and "high level" methods and for someone nwe to C# is impossible to figure out how they do it. Has anyone used OpenGL with C#?
1
5617
by: Scott Chang | last post by:
Hi All I tried to use the attached OpenGL code to draw a Star-shaped figure on my Microsoft Visual C++ .NET 2002-Windows XP Pro PC. When I did 'Build' in Debug Mode, I got an error C2065: 'RenderScence': undeclared identifier. Please help and tell me (1) what it is wrong with my coding in this program and how to correct the problem, and (2) whether the functions/commands of the OpenGL v1.1 (existing in Microsoft Visual C++ .NET 2002) and GLUT...
14
2661
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
9993
by: jg.campbell.ng | last post by:
I'm beginning learning Python and OpenGL in Python. Python fine. But difficulties with OpenGL; presumably with the installation of OpenGL. OS = Linux FC5. Python program gl_test.py: from OpenGL.GLUT import *
22
2787
by: MC felon | last post by:
hello. i have a Dev c++ compiler (version 4.0). i wish to start on openGL. How do i enable openGL programming in Dev c++? what exactly do i download? assume me to be a complete fresher and please direct me step-by-step on how to have a standard openGL setup on Dev c++. P.S- i do have GLUT, but i reckon it's only part of openGL. cheers! thanx! yours,
9
7507
by: Achim Domma | last post by:
Hi, I'm developing a GUI app in Python/C++ to visualize numerical results. Currently I'm using Python 2.4 with wx and PyOpenGLContext, but there are no windows binaries for Python 2.5 for quite some time now. I need a OpenGL context without restrictions and some settings dialogs. Is wx + PyOpenGL the way to go? Or could somebody recommend a better set of tools/libs?
1
2973
by: braveheartkenya | last post by:
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...
0
10438
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10214
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10164
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10001
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7540
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6780
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5563
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3727
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2920
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.