Jump to content
  • Advertisement

vamseekanth

Member
  • Content Count

    7
  • Joined

  • Last visited

Everything posted by vamseekanth

  1. Hello, iam using gluUnproject () function to retrieve the object coordinates from the screen coordinates. when i click on a point (2,2,2) i get the output from the function as(2.218335,2.226619,-0.000000) when i click on a point (3,3,3) i get the output as (2.218335,2.226619,-0.000000) when i click on a point (4,4,4) i get the output as (3.079899,3.084041,-0.000000) when i click on a point (5,5,5) i get the output as (3.079899,3.084041,-0.000000) why is there such a discrepancy in the actual values and the returned values of the function?? is it the nature of the function itself or there is some other problem with my code?? i want to retrieve atleast the x-coordinate more or less exactly?? plz help me ,may be with any other possible solution. thanking you, vamsee. the code is as follows: #include <GL/glut.h> #include <stdlib.h> #include <stdio.h> void display (void) { glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glLoadIdentity(); // glu.gluLookAt(1.0,1.0,1.0,0.0,0.0,0.0,0.0,0.0,0.0); // glu.gluLookAt(0.0,0.5,0,0,0.0,0.05,0,0,1); glOrtho(0.0, 5.0, 0.0, 5.0, 0.0, 5.0); //glTranslatef(-5.0f, 0.0f, 0.0f); // gl.glRotatef(rtri,0,6.0f,0); // glu.gluLookAt(camerax, cameray, cameraz, 0, 0.0, 0.05, 0, 1, 1); glPointSize(5); // for (i = 0, j = i + 1; i < array11.size() - 1; i++, j++) // { // if (arraya1[j] == arraya1 + 1) // { glBegin(GL_POINTS); glVertex3d(1,1,1); glVertex3d(2,2,2); glVertex3d(3,3,3); glVertex3d(4,4,4); glVertex3d(5,5,5); glEnd(); // } // } glFlush(); } void reshape(int w, int h) { glViewport(0,0,(GLsizei) w ,(GLsizei) h); glMatrixMode(GL_PROJECTION); glLoadIdentity(); gluPerspective(45.0,(GLfloat) w / (GLfloat) h,1.0,100.0); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); } void mouse (int button,int state,int x,int y) { GLint viewport[4]; GLdouble mvmatrix[16],projmatrix[16]; GLint realy; GLdouble wx,wy,wz; int returnvalue1=0,returnvalue2=0; // glLoadIdentity(); switch (button) { case GLUT_LEFT_BUTTON: if( state ==GLUT_DOWN) { glGetIntegerv(GL_VIEWPORT,viewport); glGetDoublev(GL_MODELVIEW_MATRIX,mvmatrix); glGetDoublev(GL_PROJECTION_MATRIX,projmatrix); realy = viewport[3]- (GLint) y -1; printf("Coordinates at cursor are (%4d,%4d) \n ",x ,realy); returnvalue1 = gluUnProject((GLdouble) x,(GLdouble) realy,0.0,mvmatrix,projmatrix,viewport,&wx,&wy,&wz); printf("returnvalue1 is %d \n",returnvalue1); printf("World coords at z= 0.0 are (%f,%f,%f) \n",wx,wy,wz); returnvalue2 = gluUnProject((GLdouble) x,(GLdouble) realy,1.0,mvmatrix,projmatrix,viewport,&wx,&wy,&wz); printf("return value2 is %d \n",returnvalue2); printf("World coords at z= 1.0 are (%f,%f,%f) \n",wx,wy,wz); } break; case GLUT_RIGHT_BUTTON: if (state == GLUT_DOWN) exit(0); break; default: break; } } int main(int argc , char** argv) { glutInit(&argc,argv); glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB ); glutInitWindowSize(500,500); glutInitWindowPosition(100,100); glutCreateWindow(argv[0]); glutDisplayFunc(display); glutReshapeFunc(reshape); glutMouseFunc(mouse); glutMainLoop(); return 0; }
  2. vamseekanth

    please help

    Hello, I have a 3-D line and when i click with mouse on a certain point i want the original coordinates which i have used to plot the line to be retrieved. plz help !!!. this is really urgent and important. any sample code would be highly useful. vamsee
  3. vamseekanth

    Untitled

    Hello, i have a 3-D plot of points joined by lines. I want to rotate it when i mouse click and drag the object. i want it to rotate in the direction of the mouse cursor. How to make it possible?? plz help.. Any code would be highly useful.
  4. Hello, iam trying to get the raster position using gl.glRasterpos2i(x ,y ) so that i can write text onto the screen.But iam getting the following error. plz help !!! //////////////////////////////////////////////////////////////////////////////// An unexpected exception has been detected in native code outside the VM. Unexpected Signal : EXCEPTION_ACCESS_VIOLATION occurred at PC=0x13E8D5D9 Function=DrvSetLayerPaletteEntries+0x56D9 Library=C:\WINNT\system32\ialmgicd.dll Current Java thread: at gl4java.GLFunc14JauJNI.glRasterPos2f(Native Method) at ex.NeHeCanvas.writeString(NeHeCanvas.java:225) at ex.NeHeCanvas.mouseClicked(NeHeCanvas.java:301) at java.awt.AWTEventMulticaster.mouseClicked(AWTEventMulticaster.java:207) at java.awt.Component.processMouseEvent(Component.java:5137) at java.awt.Component.processEvent(Component.java:4931) at java.awt.Component.dispatchEventImpl(Component.java:3639) at java.awt.Component.dispatchEvent(Component.java:3480) at java.awt.EventQueue.dispatchEvent(EventQueue.java:450) at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:197) at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:150) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:144) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:136) at java.awt.EventDispatchThread.run(EventDispatchThread.java:99) Dynamic libraries: 0x00400000 - 0x00407000 C:\JBuilder9\jdk1.4\bin\javaw.exe 0x77F80000 - 0x77FFD000 C:\WINNT\system32\ntdll.dll 0x7C2D0000 - 0x7C332000 C:\WINNT\system32\ADVAPI32.dll 0x7C570000 - 0x7C628000 C:\WINNT\system32\KERNEL32.DLL 0x77D30000 - 0x77DA1000 C:\WINNT\system32\RPCRT4.DLL 0x77E10000 - 0x77E75000 C:\WINNT\system32\USER32.dll 0x77F40000 - 0x77F7E000 C:\WINNT\system32\GDI32.DLL 0x78000000 - 0x78045000 C:\WINNT\system32\MSVCRT.dll 0x6D340000 - 0x6D46A000 C:\JBuilder9\jdk1.4\jre\bin\client\jvm.dll 0x77570000 - 0x775A0000 C:\WINNT\system32\WINMM.dll 0x6D1E0000 - 0x6D1E7000 C:\JBuilder9\jdk1.4\jre\bin\hpi.dll 0x6D310000 - 0x6D31E000 C:\JBuilder9\jdk1.4\jre\bin\verify.dll 0x6D220000 - 0x6D239000 C:\JBuilder9\jdk1.4\jre\bin\java.dll 0x6D330000 - 0x6D33D000 C:\JBuilder9\jdk1.4\jre\bin\zip.dll 0x6D000000 - 0x6D105000 C:\JBuilder9\jdk1.4\jre\bin\awt.dll 0x77800000 - 0x7781E000 C:\WINNT\system32\WINSPOOL.DRV 0x76620000 - 0x76630000 C:\WINNT\system32\MPR.DLL 0x75E60000 - 0x75E7A000 C:\WINNT\system32\IMM32.dll 0x77A50000 - 0x77B3F000 C:\WINNT\system32\ole32.dll 0x6D190000 - 0x6D1E0000 C:\JBuilder9\jdk1.4\jre\bin\fontmanager.dll 0x51000000 - 0x51050000 C:\WINNT\system32\ddraw.dll 0x728A0000 - 0x728A6000 C:\WINNT\system32\DCIMAN32.dll 0x5C000000 - 0x5C0C8000 C:\WINNT\system32\D3DIM700.DLL 0x12EF0000 - 0x12F2C000 C:\Program Files\Windows SyncroAd\CComm.dll 0x782F0000 - 0x78538000 C:\WINNT\system32\SHELL32.dll 0x70A70000 - 0x70AD5000 C:\WINNT\system32\SHLWAPI.DLL 0x71710000 - 0x71794000 C:\WINNT\system32\COMCTL32.DLL 0x75030000 - 0x75044000 C:\WINNT\system32\WS2_32.dll 0x75020000 - 0x75028000 C:\WINNT\system32\WS2HELP.DLL 0x60000000 - 0x60045000 C:\WINNT\system32\MSCTF.dll 0x13300000 - 0x1330A000 C:\PROGRA~1\MYWEBS~1\bar\7.bin\mwsoestb.dll 0x77820000 - 0x77827000 C:\WINNT\system32\VERSION.dll 0x759B0000 - 0x759B6000 C:\WINNT\system32\LZ32.DLL 0x779B0000 - 0x77A4B000 C:\WINNT\system32\OLEAUT32.DLL 0x13CC0000 - 0x13D2C000 C:\WINNT\system32\GL4JavaJauGljJNI14.dll 0x6D240000 - 0x6D245000 C:\JBuilder9\jdk1.4\jre\bin\jawt.dll 0x69510000 - 0x695D7000 C:\WINNT\system32\OPENGL32.DLL 0x6FAC0000 - 0x6FADF000 C:\WINNT\system32\GLU32.dll 0x13E80000 - 0x14038000 C:\WINNT\system32\ialmgicd.dll 0x14050000 - 0x14076000 C:\WINNT\system32\ialmgdev.dll 0x67DE0000 - 0x67DF3000 C:\Program Files\IncrediMail\bin\ImHook.dll 0x77920000 - 0x77943000 C:\WINNT\system32\imagehlp.dll 0x72A00000 - 0x72A2D000 C:\WINNT\system32\DBGHELP.dll 0x690A0000 - 0x690AB000 C:\WINNT\system32\PSAPI.DLL Local Time = Tue Dec 28 16:18:54 2004 Elapsed Time = 22 # # The exception above was detected in native code outside the VM # # Java VM: Java HotSpot(TM) Client VM (1.4.1_02-b06 mixed mode) # # An error report file has been saved as hs_err_pid620.log. # Please refer to the file for further information. # ////////////////////////////////////////////////////////////////////////////// plz help.. thankx vamsee
  5. vamseekanth

    displaying text on the screen

    yeah i have seen that. But what to use and how?? i think i need to use Class BitmapCharRec(). But how to use it?? i donot know the fields and what do they denote?? plz send me any sample code if available which would help me. thankx vamsee
  6. hello, how to display text on the screen? i have seen some examples in the net but they use glutBitmapcharacter(). somebody plz help me out. what is the equivalent of glutBitmapcharacter() in GL4java and how to use it?? any sample code would be highlt useful. thankx in advance.. vamsee
  7. vamseekanth

    displaying text on the screen

    thankx for the suggestion but can anybody help me with the analogy of glutBitmapCharacter() in GL4java. that wouldbe of very much help to me. vamsee
  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!