Java-Gaming.org Hi !
Featured games (81)
games approved by the League of Dukes
Games in Showcase (513)
Games in Android Showcase (119)
games submitted by our members
Games in WIP (576)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
   Home   Help   Search   Login   Register   
  Show Posts
Pages: [1]
1  Java Game APIs & Engines / JOGL Development / 'unable to transform src image' creating texture on: 2007-04-06 09:32:52

 hi
   i am facing problem creating a texture from an image size 5400 X 5400.
   It gives  ImagingOpException: Unable to transform image . This image is being read from a spatial database.  i tried saving the image as  a jpeg and creating  texture as
          TextureIO.newTexture(new File("img.jpg"));
this work perfectly allright.. i get the problem only when creating the texture from the same image fetched from database. i guess it may be due to the image size , it is not a power of two , but then it works for the same image size read from  a file instead.

any help is appreciated




 
2  Java Game APIs & Engines / JOGL Development / Re: Texture loading in background .. on: 2006-10-08 12:59:36
 

 i downloaded the latest nightly builds  , it works without a problem . Problem Solved.  Smiley
 

Thanks

schiz
3  Java Game APIs & Engines / JOGL Development / Texture loading in background .. on: 2006-10-08 07:48:48
 Hi Ken
   I used your advice on creating textures in background from the thread
              http://www.java-gaming.org/forums/index.php?topic=13922.0
   
 where you said
                 
Quote
     If you don't have pbuffer support available you may be able to make a 1x1 undecorated Frame, put a GLCanvas in it which shares textures with your main one, and put it in one corner of the screen where it should be inconspicuous. You can then fetch the context out of the second GLCanvas and make it current manually on a background thread.
               


      that works perfectly for me on Linux . but when i install the app on windows machine it gives the following error .. please do advice .
1  
2  
3  
4  
5  
          javax.media.opengl.GLException :wglShareLists (..)  failed error code :0 
             at com.sun.opengl.impl.windows.WIndowsGLContext.create (WindowsGLContext.java:133)
             ...............
             ...............
             at com.sun.opengl.impl.GLContextImpl.makeCurrent().



 please do help


schiz






     
4  Java Game APIs & Engines / JOGL Development / Re: Texture.updateSubImage doesnot update the texture ...? on: 2006-06-26 08:05:33
Hi Ken
     I am posting a Test code . I tested it with smaller images. These images are 2500 X 2500 pixels with each about 17 mb. Giving updateSubImage has no effect. But when i do setWidth, setHeight on the TextureData to 1000 X 1000 , then after zooming in for some level the new image is visible but that too is not correctly displayed. I am posting the code and also the snapshot of the application without zoom , and with zoom when the replaced texture is visible.

Thanks
schiz
5  Java Game APIs & Engines / JOGL Development / Re: Texture.updateSubImage doesnot update the texture ...? on: 2006-06-25 09:47:32
 Hi Ken
   I guess there may be a problem with size of the image. But anyways it shouldve given an error if size of the texture was a problem. Initial texture has an image of size 122 mb , then subsequently on zoom i get better resolution images from database and replace the corresponding part of the texture with it . I tried out by hardcoding some of the statements. i read an image from file , scaled it down (to reduce the size ) and did a updateSubImage on the loaded texture.  Still there is no change in the texture. But this time when i zoom in, at certain zoom level i see the replaced texture becoming visible gradually on zooming, but has some transparency as i can still see the first image behind.
         I am banking on this replace functionality of textures for my project , as creating new textures on the fly is slowing down my application.

Thanks in advance

schiz



         
6  Java Game APIs & Engines / Java 2D / Re: newbie question on conversion between world to screen coords on: 2006-06-23 11:28:46

  Hi
   Thanks for the reply . the following worked for me.
   

     
             double pixelsX = ( umax - umin ) / ( xmax - xmin );
        double pixelsY = ( vmax - vmin ) / ( ymax - ymin );
       
        trans = new AffineTransform(pixelsX , 0, 0, pixelsY, -xmin * pixelsX + umin, -ymin * pixelsY + vmin);

where screen bounds are vmin,umin, vmax , umax and world bounds are xmin,xmacx,ymin,ymax . I used the affine transform to do conversions.

Regards
Schiz
7  Java Game APIs & Engines / JOGL Development / Texture.updateSubImage doesnot update the texture ...? on: 2006-06-23 07:31:26
  Hi All
     I have got a texture , when the user zooms in i get a better resolution image and then replace the texture with the new image. the following is the code .... but the texture replace returns without any effect , the texture is not replaced.
 Please help
Thanks
Schiz

      my display method

-------------------

        Extents imgExtents = mbr.getImgExtents();
        Extents scrExtents = mbr.getScrExtents();
        // if(features.isReady())
        //  GLQueue.getInstance().add(features);
        GL gl = drawable.getGL();
        GLQueue.getInstance().execute(gl);

       
        gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT);
       
        gl.glShadeModel(GL.GL_SMOOTH);

       
        texture.enable();
       
        texture.bind();
       
        gl.glTexEnvf(GL.GL_TEXTURE_ENV,GL.GL_TEXTURE_ENV_MODE,GL.GL_REPLACE);
       
        gl.glBegin(GL.GL_QUADS);
       
        gl.glTexCoord2d(imgExtents.myBottomX,imgExtents.myBottomY);
        gl.glVertex2d(scrExtents.myBottomX, scrExtents.myBottomY);
       
        gl.glTexCoord2d(imgExtents.myBottomX, imgExtents.myTopY);
        gl.glVertex2d(scrExtents.myBottomX,scrExtents.myTopY);
       
        gl.glTexCoord2d(imgExtents.myTopX, imgExtents.myTopY);
        gl.glVertex2d(scrExtents.myTopX, scrExtents.myTopY);
       
        gl.glTexCoord2d(imgExtents.myTopX, imgExtents.myBottomY);
        gl.glVertex2d(scrExtents.myTopX, scrExtents.myBottomY);
        gl.glEnd();
       
       
        texture.disable();
        texture.enable();
            texture.bind();
            ImagePool.getInstance().replace(texture);
        texture.disable();
        // features.execute(gl);
       
        drawable.swapBuffers();


--------------------------

 the replace method
----------------------------------

    public void replace(Texture texture)
    {
        if(data[curPos] == null || exts[curPos] == null)  return;
        System.out.println("Replacing ");
        MyConverter conv = IVContext.getContext().getWinToWorld();
        for(int i = 0 ; i < 3 ; i ++ )
        {
        if(exts == null) continue;
        Extents temp = conv.toScreen(exts);
         texture.updateSubImage(data, 0,(int)temp.getBottomX(),(int)temp.getBottomY());
        }
----------------------------------



8  Java Game APIs & Engines / Java 2D / newbie question on conversion between world to screen coords on: 2006-06-22 15:02:07
 Hi all

     i know this is very simple to implement, but the converter i wrote doesnt work for all cases. How to have a conversion from world to screen and screen to world coordinates in 2D. Screen coordinates can have 'Y' at the top left or at bottom left.

Any help is appreciated

Thanks
schiz
9  Java Game APIs & Engines / JOGL Development / rotating a globe on mouse drag is not smooth on: 2006-05-03 06:50:01
 Hello All
      I have a map  wrapped on a sphere using textures.   have implemented rotation of the sphere on dragging of mouse. but the rotation is not  happening properly.  the code to rotate  is attached .
   
  any ideas what is wrong . thanks in advance

schiz



 
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
33  
34  
35  
36  
37  
38  
39  
40  
41  
42  
43  
44  
45  
46  
47  
48  
49  
50  
51  
52  
53  
54  
55  
56  
57  
58  
   public void move(GL gl, GLU glu) {
       
        gl.glGetDoublev( GL.GL_MODELVIEW_MATRIX, modelview,0 );
        gl.glGetDoublev( GL.GL_PROJECTION_MATRIX, projection,0 );
        gl.glGetIntegerv( GL.GL_VIEWPORT, viewport ,0);
       
        double winX = clickX;
        double winY = viewport[3] - clickY;
        float[] winZ = new float[1];
        FloatBuffer buf = FloatBuffer.wrap(winZ);
        gl.glReadPixels( clickX, (int)winY, 1, 1, GL.GL_DEPTH_COMPONENT, GL.GL_FLOAT, buf );
        winZ[0] = buf.get(0);
       
       
        double[]    worldX = new double[1];
        double[]    worldY = new double[1];
        double[]    worldZ = new double[1];
        double[]    world  = new double[3];
       
       
        glu.gluUnProject( winX, winY, (double)winZ[0], modelview,0, projection,0, viewport,0, world, 0 );
       
        Vec3d worldVec = new Vec3d(world[0], world[1], world[2]);
        Vec3d prevVec = new Vec3d(prevX,prevY,prevZ);
        Vec3d normal = prevVec.cross(worldVec);
        normal.normalize();
       
        //double angle = Math.acos(worldVec.dot(prevVec) / ( worldVec.length() * prevVec.length() )) ;
       
       
       // Rotf rotate = new Rotf(normal.toFloat(),(float)angle);
       
       
        Vec3d from = new Vec3d(prevX,prevY,prevZ);
        Vec3d to = new Vec3d(world[0], world[1], world[2]);
       
        System.out.println("PREV " + from.toString());
        System.out.println("To " + to.toString());
        prevX = world[0];
        prevY = world[1];
        prevZ = world[2];
       
       
       
        Rotf rot = new Rotf(from.toFloat() , to.toFloat());
        rot.normalize();
       
        orientation = orientation.times(rot.inverse());
       
       
       
        double r = Math.sqrt( world[0] * world[0] + world[1] * world[1] + world[2] * world[2] );
        double lon = Math.toDegrees( Math.atan2( world[2], world[0] ) );
        double lat = 90 - Math.toDegrees( Math.acos( world[1] / r ) );
        dragged = false;
       
       
    }
10  Java Game APIs & Engines / JOGL Development / Re: JOGL texture objects and java.nio buffer reclaiming on: 2006-04-07 06:52:34
 i had a related question ..
     i am using textures for displaying images . As the full resolution image is very large i cant load the texture for the full resolution image at once . so i load a scaled down low res. image ( i pick up the image from Oracle Spatial database) and when the user zooms to a particular area i replace the zoomed area with a better resolution image using subTextures . 
           
          my question is can i free the memory for the subtexture when the subtexture area goes out of view (like due to pan by user to a different area) . so that some other subtexture can be loaded with out eventually running out of memory .


 thanks

schiz
   
11  Java Game APIs & Engines / JOGL Development / Re: Smooth zooming of images on: 2006-03-14 09:44:51

   thank you .. but is it okay on performance .


schiz
12  Java Game APIs & Engines / JOGL Development / Smooth zooming of images on: 2006-03-14 09:28:22

 Hello all ,

     how to zoom an image drawn using glDrawPixels...  i am not able to do it using gluPerspective or gluLookAt.

  Thanks
schiz
 
13  Java Game APIs & Engines / JOGL Development / jogl newbie .. error trying to glDrawPixels on: 2006-03-07 06:38:00
Hello all ,
    just started working on jogl . i wanted to display an image on GLCanvas here is the code  :

   
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
  public void display(GLAutoDrawable drawable)
    {
       

       
        GL gl = drawable.getGL();
       
       
//        gl.glBlendFunc(GL.GL_SRC_ALPHA , GL.GL_ONE_MINUS_SRC_ALPHA);
       
     //   gl.glEnable(GL.GL_BLEND);
       
        gl.glColor3f(0.0f,0.5f,0.0f);
       
        gl.glRecti(0,300,100,330);
       
        gl.glColor3f(0.0f,0.0f,0.0f);
       
        gl.glRasterPos2i(0,0);
       
        gl.glDrawPixels(img.getWidth(),img.getHeight(),gl.GL_RGBA,gl.GL_UNSIGNED_BYTE,buffer);


    }


  it throws  an exception
 
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
33  
34  
35  
36  
37  
38  
39  
40  
41  
42  
43  
44  
45  
46  
Warning: Cannot convert string "-b&h-lucida-medium-r-normal-sans-*-140-*-*-p-*-iso8859-1" to type FontStruct
Got Canvas
Attached Renderer
got the buffer ::14960:55:68
Xlib: unexpected async reply (sequence 0x1ae)!
javax.media.opengl.GLException: java.lang.InternalError: Unknown glGetError() return value: 25165887
        at javax.media.opengl.Threading.invokeOnOpenGLThread(Threading.java:268)
        at javax.media.opengl.GLCanvas.maybeDoSingleThreadedWorkaround(GLCanvas.java:245)
        at javax.media.opengl.GLCanvas.display(GLCanvas.java:130)
        at com.sun.opengl.util.Animator.display(Animator.java:144)
        at com.sun.opengl.util.Animator$MainLoop.run(Animator.java:181)
        at java.lang.Thread.run(Thread.java:534)
Caused by: java.lang.InternalError: Unknown glGetError() return value: 25165887
        at javax.media.opengl.DebugGL.checkGLGetError(DebugGL.java:11721)
        at javax.media.opengl.DebugGL.glViewport(DebugGL.java:11040)
        at javax.media.opengl.GLCanvas$DisplayAction.run(GLCanvas.java:265)
        at com.sun.opengl.impl.GLDrawableHelper.invokeGL(GLDrawableHelper.java:140)
        at javax.media.opengl.GLCanvas$DisplayOnEventDispatchThreadAction.run(GLCanvas.java:287)
        at com.sun.opengl.impl.GLWorkerThread$WorkerRunnable.run(GLWorkerThread.java:241)
        ... 1 more
javax.media.opengl.GLException: java.lang.InternalError: Unknown glGetError() return value: 25165887
        at javax.media.opengl.Threading.invokeOnOpenGLThread(Threading.java:268)
        at javax.media.opengl.GLCanvas.maybeDoSingleThreadedWorkaround(GLCanvas.java:245)
        at javax.media.opengl.GLCanvas.display(GLCanvas.java:130)
        at javax.media.opengl.GLCanvas.paint(GLCanvas.java:142)
        at sun.awt.RepaintArea.paint(RepaintArea.java:177)
        at sun.awt.motif.MComponentPeer.handleEvent(MComponentPeer.java:405)
        at java.awt.Component.dispatchEventImpl(Component.java:3678)
        at java.awt.Component.dispatchEvent(Component.java:3477)
        at java.awt.EventQueue.dispatchEvent(EventQueue.java:456)
        at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:201)
        at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:151)
        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:145)
        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:137)
        at java.awt.EventDispatchThread.run(EventDispatchThread.java:100)
Caused by: java.lang.InternalError: Unknown glGetError() return value: 25165887
        at javax.media.opengl.DebugGL.checkGLGetError(DebugGL.java:11721)
        at javax.media.opengl.DebugGL.glColor3f(DebugGL.java:509)
        at joglwork.TestRenderer.display(TestRenderer.java:103)
        at com.sun.opengl.impl.GLDrawableHelper.display(GLDrawableHelper.java:78)
        at javax.media.opengl.GLCanvas$DisplayAction.run(GLCanvas.java:270)
        at com.sun.opengl.impl.GLDrawableHelper.invokeGL(GLDrawableHelper.java:140)
        at javax.media.opengl.GLCanvas$DisplayOnEventDispatchThreadAction.run(GLCanvas.java:287)
        at com.sun.opengl.impl.GLWorkerThread$WorkerRunnable.run(GLWorkerThread.java:241)
        at java.lang.Thread.run(Thread.java:534)
Java Result: 137



   i have Jdk 1.4 on RHEL 4  with the latest jogl download.

     would be thankful if anyone suggests whats going wrong with it.

regards
schiz






Pages: [1]
 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

Longarmx (46 views)
2014-10-17 03:59:02

Norakomi (37 views)
2014-10-16 15:22:06

Norakomi (28 views)
2014-10-16 15:20:20

lcass (32 views)
2014-10-15 16:18:58

TehJavaDev (62 views)
2014-10-14 00:39:48

TehJavaDev (62 views)
2014-10-14 00:35:47

TehJavaDev (52 views)
2014-10-14 00:32:37

BurntPizza (70 views)
2014-10-11 23:24:42

BurntPizza (40 views)
2014-10-11 23:10:45

BurntPizza (82 views)
2014-10-11 22:30:10
Understanding relations between setOrigin, setScale and setPosition in libGdx
by mbabuskov
2014-10-09 22:35:00

Definite guide to supporting multiple device resolutions on Android (2014)
by mbabuskov
2014-10-02 22:36:02

List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!