Show Posts
|
|
Pages: [1]
|
|
1
|
Java Game APIs & Engines / JOGL Development / 'unable to transform src image' creating texture
|
on: 2007-04-06 11: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
|
|
|
|
|
3
|
Java Game APIs & Engines / JOGL Development / Texture loading in background ..
|
on: 2006-10-08 09: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 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 10: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 11: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 13: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 09: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()); } ----------------------------------
|
|
|
|
|
9
|
Java Game APIs & Engines / JOGL Development / rotating a globe on mouse drag is not smooth
|
on: 2006-05-03 08: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(); 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 08: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
|
|
|
|
|
13
|
Java Game APIs & Engines / JOGL Development / jogl newbie .. error trying to glDrawPixels
|
on: 2006-03-07 07: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.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
|
|
|
|
|
|
Add your game by posting it in the WIP section,
or publish it in Showcase.
The first screenshot will be displayed as a thumbnail.
|
|