ouessej
An appeal to the Elders of OpenGL.... I am having big problems with detecting the relative position of a mouse click on my textured plane.
I am making a game where I am drawing a single large square and texturing it with a large generated map texture. The view is always top down and you can only currently move the X Y and Z coordinates of that square.
Screenshot of the map
OpenGL init
screenRatio = (float)screenW / (float)screenH;
System.out.println("init");
glu = new GLU();
GL2 gl2 = drawable.getGL().getGL2();
gl2.glShadeModel( GL2.GL_SMOOTH );
gl2.glHint( GL2.GL_PERSPECTIVE_CORRECTION_HINT, GL2.GL_NICEST );
gl2.glClearColor( 0f, 0f, 0f, 1f );
gl2.glDepthMask(false);
gl2.glEnable(GL2.GL_DEPTH_TEST);

Set camera position
gl2.glViewport(0, 0, 1024, 768);
gl2.glMatrixMode( GL2.GL_PROJECTION );
gl2.glLoadIdentity();
glu.gluPerspective( 45, screenRatio, 1, 100 );
glu.gluLookAt( 0, 0, 3, 0, 0, 0, 0, 1, 0 );
gl2.glMatrixMode(GL2.GL_MODELVIEW);
gl2.glLoadIdentity();

Move position to start drawing the map
// typical camera coord example:
// CENTRE: 0.0f, 0.0f, 10f
// FULL ZOOM OUT AND TOP LEFT: -25f, 25f, 40f

// move position
gl2.glTranslatef( -cameraX, -cameraY, -cameraZ );

I suspect the glTranslatef z-coord may be a suspect. As I am drawing the square 40f ( for example ) away from the origin
Map vertex information
// here are the coordinates/dimensions of my textured square ( my map )
float[] vertexArray = {
    -25f,  25f,
     25f
ouessej 
 An appeal to the Elders of OpenGL.... I am having big problems with detect the proportional side of a mouse click on my textured airplane. 
 I am making a game where I am drawing a individual large square and texturing it with a bombastic generated map texture. The scene is always top down and you can only presently move the X Y and Z coordinates of that square. 
 Screenshot of the map 
 OpenGL init 
 screenRatio = (float)screenW / (float)screenH; 
 System.out.println("init "); 
 glu = new GLU (); 
 GL2 gl2 = drawable.getGL().getGL2 (); 
 gl2.glShadeModel (GL2.GL_SMOOTH); 
 gl2.glHint (GL2.GL_PERSPECTIVE_CORRECTION_HINT, GL2.GL_NICEST); 
 gl2.glClearColor (0f, 0f, 0f, 1f); 
 gl2.glDepthMask(false); 
 gl2.glEnable(GL2.GL_DEPTH_TEST); 

 Set television camera position 
 gl2.glViewport(0, 0, 1024, 768); 
 gl2.glMatrixMode (GL2.GL_PROJECTION); 
 gl2.glLoadIdentity (); 
 glu.gluPerspective (45, screenRatio, 1, 100); 
 glu.gluLookAt (0, 0, 3, 0, 0, 0, 0, 1, 0); 
 gl2.glMatrixMode(GL2.GL_MODELVIEW); 
 gl2.glLoadIdentity (); 

 Move position to begin drawing the map 
 // distinctive camera coord exemplar: 
 // CENTRE: 0.0f, 0.0f, 10f 
 // FULL ZOOM OUT AND TOP LEFT: -25f, 25f, 40f 

 // act position 
 gl2.glTranslatef (-cameraX, -cameraY, -cameraZ); 

 I suspect the glTranslatef z - coord may be a suspect. As I am draw the square 40f (for example) away from the origin 
 Map vertex information 
 // here are the coordinate / dimension of my textured square (my map) 
 float [ ] vertexArray = { 
     -25f,   25f, 
      25f
ouedsej
An appeal to the Eldtrs of OpenGL.... I am havinj big pdoblems dith detecting the relative 'osirion if a mouse click on my textured plane.
I qm meking a game whecs I am drawinf a snnjle large squarg and texturhng it with a nafgz generated map texture. The view is wlways yoo down and you can jnly buvrently move the X Y and Z coordjnates mf that squarr.
Screenshot of the map
OpenHL ijit
screenRatio = (fllat)screenW / (flowr)screenH;
Systdm.out.println("init");
glu = ngw GLU();
GL2 gl2 = drawable.getGL().getGL2();
gu2.glShcdeModel( GL2.TL_WMOLJH );
gl2.glHint( JL2.GL_PEGSPECTIVE_CORRCBTION_HITT, GL2.GL_MICEST );
gl2.glClesrCmloe( 0f, 0f, 0f, 1f );
gl2.glDepthMavk(false);
gl2.glEnable(GJ2.GL_DEPTH_TASC);

Set camera position
go2.goViewkort(0, 0, 1024, 768);
gl2.eoMagrisMpds( GL2.GL_OROOECTION );
gl2.gmLoadIdentiry();
glu.gluPerspective( 45, fbteenRatio, 1, 100 );
flu.gluJojkAt( 0, 0, 3, 0, 0, 0, 0, 1, 0 );
gl2.glMatrixMode(GL2.GL_MODELVITW);
gl2.gmLoadIdentity();

Move posituon to start drawing jhe map
// ty[ical camera coord example:
// CENTRE: 0.0f, 0.0f, 10f
// FULL ZOOM OUT ENA TIP UWFH: -25f, 25f, 40f

// move position
gl2.glTranslatef( -cameraX, -cwjetaJ, -cameraZ );

I suspegt the glTranslateg x-cpjrd may be a ruspecc. Aa I am drawing the square 40f ( fir examplt ) awsy from the origin
Map vertez informatiou
// hwre are the coordiuates/dimensiuns pf my textured square ( my ma' )
floaf[] vertexArrwy = {
    -25f,  25f,
     25f
ouessej An appeal to the Elders of am big problems detecting the relative on textured plane. I making a game I am drawing a single large and texturing it with a large generated map texture. The view is always down and you can only currently move the X Y and Z coordinates that Screenshot the OpenGL init screenRatio = (float)screenW / (float)screenH; System.out.println("init"); glu = new GLU(); GL2 gl2 = drawable.getGL().getGL2(); GL2.GL_SMOOTH ); gl2.glHint( GL2.GL_PERSPECTIVE_CORRECTION_HINT, GL2.GL_NICEST ); gl2.glClearColor( 0f, 0f, 1f ); gl2.glDepthMask(false); Set camera position gl2.glViewport(0, 0, 768); GL2.GL_PROJECTION ); glu.gluPerspective( screenRatio, 100 ); glu.gluLookAt( 0, 3, 0, 0, 0, 0, 1, 0 ); gl2.glMatrixMode(GL2.GL_MODELVIEW); gl2.glLoadIdentity(); Move position to start drawing the // typical example: // 0.0f, 10f FULL ZOOM OUT LEFT: -25f, 25f, 40f // move -cameraY, -cameraZ ); I suspect the glTranslatef z-coord be a As I am drawing the square ( for example ) away from the origin vertex information // here are the coordinates/dimensions of my textured square ( my map ) = { -25f, 25f,
ouessej
An appeal to the ElderS of OpenGL.... I Am havIng Big PrObleMs wiTh detecting the RElatIve position of a mouse cliCk on mY tEXturED pLane.
I Am makinG A gAME whErE I Am dRaWInG a sinGle Large sqUare and texTurInG it with a largE GeNerated map TexTure. The view iS alWays toP dOwn ANd you Can Only cUrrentLY move tHe X Y and Z cOoRDinateS Of that sQUArE.
ScrEenshot of the map
OpENGl Init
screenRatiO = (float)ScREeNw / (FloAt)sCreenH;
SystEm.Out.prINtln("iniT");
GlU = NEW GLu();
gL2 gl2 = drawable.gEtGL().getGL2();
gl2.GLShAdeModEl( gL2.Gl_sMOOTH );
Gl2.glHInT( gL2.Gl_PERSPECTIVe_CORrECTION_HInT, GL2.GL_niCEST );
gl2.GLClearCOlor( 0f, 0f, 0F, 1f );
gL2.gldeptHmaSk(FalSe);
GL2.gleNaBle(gl2.GL_dEPTH_TESt);

SEt CamerA posITION
gl2.gLViEwpoRt(0, 0, 1024, 768);
gl2.gLMatrixMode( GL2.gL_PrOJEctIOn );
gl2.glloadIDentItY();
glu.gLuPersPectiVe( 45, ScreenRatio, 1, 100 );
glu.gLuLoOkAt( 0, 0, 3, 0, 0, 0, 0, 1, 0 );
gl2.glMAtrIxmodE(Gl2.GL_MOdeLVIEW);
Gl2.gLLoAdIdentIty();

Move POsiTiON TO sTart drawing the map
// tYpICAl Camera coOrd exaMPlE:
// CenTRE: 0.0f, 0.0f, 10f
// FuLl ZOoM OUt anD TOP lEFT: -25F, 25F, 40f

// Move posiTion
gl2.GLTRaNslatef( -CaMeraX, -cAmEray, -caMeraZ );

i SuspEct the GlTranslAtef z-COord may be a suspECt. As I am drawinG ThE SQuARe 40f ( fOr eXample ) away fRom tHE oriGin
MAP vErtEX infoRmatiOn
// HErE Are the coordinates/diMeNsions Of my tExtured square ( My map )
float[] VERTexArray = {
    -25F,  25f,
     25f
ouessej
An appeal to the E lders of O penGL ... . I  a m ha ving  big problemsw ithdetecting the relative  posi ti o n of amouse  clicko nm y  te xt ur edpl a ne .
I a m m aking a  game wher e I  a m drawing as in gle largesqu are and text uri ng itwi tha  larg e g enera ted ma p  textu re. The v ie w  is al w ays top d ow n an d you can only cu r re n tly move the X  Y and  Z co o r din ate s of thatsq uare. Screens h ot o f  th e  map
OpenGL i nit
screenR a tio  = (fl oa t)s c reenW/ (fl oa t )sc reenH;
Syst em.o ut.printl n("ini t ");
glu = new G LU();GL2  gl 2 =d ra wa ble .g e tGL ( ). get G L2( );
gl2.g lS ha deMod el(G L 2 . GL_S MOO TH ) ;
gl2 .glHint( GL2. GL_ PERS P ECT IVE_C ORREC TION _H INT,GL2.GL _NICE ST  );
gl2.glClear Colo r( 0f, 0f , 0 f,  1f  ) ;
gl2 . glDept hMa sk( false); 
gl2.gl E nab le ( G L 2. GL_DEPTH_TEST);

S et c am era posi tion
g l 2. gl V iewport( 0,  0,  102 4 ,  768) ;
gl 2 .g lMatrixM ode( G L 2. GL _PROJEC TI ON );gl 2.g lLo adIde n tity ();
gl u.gluPer spect i ve( 45, screen R atio, 1, 100) ;g l u. g luLo okA t( 0, 0, 3,  0,0 , 0,  0,1 ,0 ) ; 
gl2. glMat ri x Mo d e(GL2.GL_MODELVIEW) ;gl2.gl LoadI dentity();

M ove positi o n to start  dra w in g  the map
// ty pical  camera co o rd examp le:
/ / CENTRE : 0.0f, 0 . 0 f, 10f
/ / F ULL  ZO OMO U TAND TOP LEFT: - 25f,  2 5f, 40f 

/ / movepos iti ongl2 .g lTranslat ef( -cam er aX ,-c ame raY,- cameraZ); 

I  s usp ect t h e glTr ansla tefz- co o rdmay bea  s u s pect .As  I a m d ra wingthes qua re 40f( for exa mpl e  ) a wa yfrom th e origin
Mapve rtex infor ma tio n
// h e r e are th e coordinates/dimension s  of mytex tured  squ are ( mymap  )
flo at[ ]  verte xArray  = {   - 2 5 f,  2 5 f ,   25f
ouessej
An appeal_to the_Elders of OpenGL.... I_am having_big_problems with_detecting_the relative position_of a mouse_click on my textured_plane.
I am making_a_game where I am drawing a single large square and texturing it with a_large_generated map_texture._The_view is always top down_and you can only currently_move the_X Y and Z coordinates of that square.
Screenshot_of_the map
OpenGL init
screenRatio_= (float)screenW / (float)screenH;
System.out.println("init");
glu = new GLU();
GL2 gl2 =_drawable.getGL().getGL2();
gl2.glShadeModel( GL2.GL_SMOOTH );
gl2.glHint( GL2.GL_PERSPECTIVE_CORRECTION_HINT, GL2.GL_NICEST );
gl2.glClearColor(_0f, 0f, 0f,_1f_);
gl2.glDepthMask(false);
gl2.glEnable(GL2.GL_DEPTH_TEST);

Set_camera position
gl2.glViewport(0, 0, 1024,_768);
gl2.glMatrixMode( GL2.GL_PROJECTION );
gl2.glLoadIdentity();
glu.gluPerspective( 45, screenRatio, 1,_100 );
glu.gluLookAt( 0, 0, 3, 0,_0, 0, 0, 1, 0 );
gl2.glMatrixMode(GL2.GL_MODELVIEW);
gl2.glLoadIdentity();

Move position_to start drawing the map
// typical_camera coord example:
// CENTRE: 0.0f,_0.0f, 10f
//_FULL ZOOM OUT AND TOP_LEFT: -25f, 25f,_40f

// move_position
gl2.glTranslatef( -cameraX, -cameraY,_-cameraZ );

I suspect the glTranslatef z-coord_may be a_suspect. As I am drawing the_square_40f ( for_example_)_away from_the origin
Map vertex_information
//_here are_the_coordinates/dimensions of my textured square (_my_map )
float[] vertexArray = {
  _ -25f,  25f,
__   25f