Show Posts
|
|
Pages: [1] 2 3
|
|
3
|
Java Game APIs & Engines / JOGL Development / Re: Experiences of migrating from JOGL 1.1.1 to JSR231
|
on: 2006-09-19 17:50:58
|
Hi, Seing the brand new release of jogl i have decided to shift my old version to the new one. Made the changes which often made my code simpler and cleaner. So firstly thanks for that ;-) However at run time i got a nasty crash at the moment i am trying to load one FloatBuffer into the VRAM. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
| if(hasVBO) { VBOs=BufferUtil.newIntBuffer(3); gl.glGenBuffersARB(3, VBOs); gl.glBindBufferARB(GL.GL_ARRAY_BUFFER_ARB, VBOs.get(0)); gl.glBufferDataARB(GL.GL_ARRAY_BUFFER_ARB, nvertex * 3 * BufferUtil.SIZEOF_FLOAT, vertices, GL.GL_STATIC_DRAW_ARB); <----------------- gl.glBindBufferARB(GL.GL_ARRAY_BUFFER_ARB, VBOs.get(1)); gl.glBufferDataARB(GL.GL_ARRAY_BUFFER_ARB, nvertex * 2 * BufferUtil.SIZEOF_FLOAT, texCoords, GL.GL_STATIC_DRAW_ARB);
gl.glBindBufferARB(GL.GL_ARRAY_BUFFER_ARB, VBOs.get(2)); gl.glBufferDataARB(GL.GL_ARRAY_BUFFER_ARB, nvertex * 3 * BufferUtil.SIZEOF_FLOAT, normals, GL.GL_STATIC_DRAW_ARB); normals=null; vertices=null; texCoords=null; } |
The crash i got is an ACCESS_VIOLATION_EXCEPTION with the trace as follow. This was working perfectly fine before so i do not know what new thing deep inside could cause this? any one got the same problem. If need more information please tell me and i will post everything you would need to solve the prob. 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
| # # An unexpected error has been detected by HotSpot Virtual Machine: # # EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x69661988, pid=2260, tid=4000 # # Java VM: Java HotSpot(TM) Client VM (1.5.0_06-b05 mixed mode) # Problematic frame: # C [nvoglnt.dll+0x161988] #
--------------- T H R E A D ---------------
Current thread (0x0b1d4ad0): JavaThread "AWT-EventQueue-0" [_thread_in_native, id=4000]
siginfo: ExceptionCode=0xc0000005, reading address 0x0beab004
Registers: EAX=0x000761cc, EBX=0x0c75c800, ECX=0x00001d87, EDX=0x0bea90cc ESP=0x0b7df520, EBP=0x0b7df53c, ESI=0x0beaafcc, EDI=0x0ebaaf00 EIP=0x69661988, EFLAGS=0x00010206
Top of Stack: (sp=0x0b7df520) 0x0b7df520: 0cd100c0 0cc6f400 0c75c800 00000000 0x0b7df530: 00000001 00000002 69638fdd 0cd18fe8 0x0b7df540: 6963830d 0eba9000 0bea90cc 000780cc 0x0b7df550: 0c75c800 00000000 00000000 00000000 0x0b7df560: 69639673 0cd100c0 0c75c800 00000000 0x0b7df570: 000780cc 0bea90cc 0c75c800 0cd100c0 0x0b7df580: 00008892 695671d7 0cd100c0 00008892 0x0b7df590: 000088e4 0c75c800 000780cc 00000000
Instructions: (pc=0x69661988) 0x69661978: e9 06 8d 9b 00 00 00 00 0f 10 46 10 0f 10 4e 20 0x69661988: 0f 10 56 30 0f 10 1e 0f 2b 1f 0f 2b 47 10 0f 2b
Stack: [0x0b7a0000,0x0b7e0000), sp=0x0b7df520, free space=253k Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code) C [nvoglnt.dll+0x161988]
Java frames: (J=compiled Java code, j=interpreted, Vv=VM code) j com.sun.opengl.impl.GLImpl.dispatch_glBufferDataARB0(IILjava/lang/Object;IIJ)V+0 j com.sun.opengl.impl.GLImpl.glBufferDataARB(IILjava/nio/Buffer;I)V+52 <----------------- j Hege3D.banqueObjets.Arbre.InitArbre(Ljavax/media/opengl/GL;Z)V+118 j Hege3D.banqueObjets.Objets.InitObjets(ZLjavax/media/opengl/GL;Ljavax/media/opengl/glu/GLU;)V+729 j Hege3D.interfacesGraphique.Scene3D.init(Ljavax/media/opengl/GLAutoDrawable;)V+154 |
Thanks
|
|
|
|
|
4
|
Java Game APIs & Engines / JOGL Development / particle effects without black background...
|
on: 2006-09-15 09:53:08
|
For particle effects like smoke, fire, lasers, rain, etc. you should try using additive blending (dest = dest + source) as this also doesnt require sorting.
Hi, by searching through the forum for information on the particle effect like fire, water etc.. i fell on this topic. However i am quite new to using particle system so i would need some advice and guidance. I have seen the demo about particle engines but they are all using a png image with a black background. This made me wondering, How can i create a fire effect in a room, for example with a torch on the wall so it looks like a fire without this black background. Is the additive blending the way to do so? If so, it would be great if you could explain it in details to me so i can try to include the technique to produce the different effects i have in mind. Thanks
|
|
|
|
|
5
|
Java Game APIs & Engines / JOGL Development / particles effect without black background
|
on: 2006-09-14 16:52:06
|
For particle effects like smoke, fire, lasers, rain, etc. you should try using additive blending (dest = dest + source) as this also doesnt require sorting.
Hi, by searching through the forum for information on the particle effect like fire, water etc.. i fell on this topic. However i am quite new to using particle system so i would need some advice and guidance. I have seen the demo about particle engines but they are all using a image with a black background. This made me wondering, How can i create a fire effect in a room, for example with a torch on the wall so it looks like a fire without this black background. Is the additive blending the way to do so? If so, it would be great if you could explain it in details to me so i can try to include the technique to produce the different effects i have in mind. Thanks
|
|
|
|
|
7
|
Java Game APIs & Engines / JOGL Development / Can VBOs be used at the same time as Vertex Arrays?
|
on: 2006-06-16 10:27:24
|
Hi All, Well my problem is simple but i can not figure out some workaround, or the reason of the problem. I have a scene in which i have a parchment unscrolling itself. Therefore i have kept its data in vertex arrays to be able to modify it dynamically to produce the unscrolling effect. Once unscrolled i am draying fixed objects on it (trees cows etc...) which are completely fixed and therefore i am keeping them in VBOs. Now the problem is, when i draw my VBO, my vertex array do not redraw anymore. Below you can find the bits of code used to draw the map and its objects: 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
| public void Draw(GL gl) { gl.glVertexPointer(3, GL.GL_FLOAT, 0, verticesB); gl.glTexCoordPointer(2, GL.GL_FLOAT, 0, texCoords); gl.glNormalPointer(GL.GL_FLOAT, 0, normalsB); gl.glBindTexture(GL.GL_TEXTURE_2D,textures[empire]); gl.glPushMatrix(); gl.glTranslatef(0.75f,0.5f+pos,0); gl.glRotatef(angle,0,0,1); gl.glTranslatef(-0.75f,-0.5f,0); gl.glDrawArrays(GL.GL_QUADS, 0, 592); gl.glFrontFace(GL.GL_CW); gl.glBindTexture(GL.GL_TEXTURE_2D,textures[3]); gl.glDrawArrays(GL.GL_QUADS, 0, 592); gl.glFrontFace(GL.GL_CCW); gl.glDisable(GL.GL_TEXTURE_2D); for(int i=0;i<size[empire];i++) { gl.glPushMatrix(); gl.glTranslatef(fiefs[empire][i][0],fiefs[empire][i][1],0); if(ressources[empire][i].equals("bois")) { gl.glScalef(0.08f,0.08f,0.08f); gl.glRotatef(90,1,0,0); Objets.arbre(gl); } if(ressources[empire][i].equals("betail")) { gl.glScalef(0.06f,0.06f,0.06f); gl.glRotatef(90,1,0,0); Objets.betail(gl); } if(ressources[empire][i].equals("cereales")) { gl.glScalef(0.03f,0.03f,0.02f); gl.glRotatef(90,1,0,0); Objets.cereales(gl); } if(ressources[empire][i].equals("roche")) { gl.glScalef(0.04f,0.04f,0.04f); gl.glRotatef(90,1,0,0); Objets.roche(gl); } gl.glPopMatrix(); } gl.glEnable(GL.GL_TEXTURE_2D); |
In turn each Objets.* will call a drawing method looking like this one. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
| if(VBOs!=null) { gl.glBindBufferARB(GL.GL_ARRAY_BUFFER_ARB, VBOs[0]); gl.glVertexPointer(3, GL.GL_FLOAT, 0, null); gl.glBindBufferARB(GL.GL_ARRAY_BUFFER_ARB, VBOs[1]); gl.glTexCoordPointer(2, GL.GL_FLOAT, 0, null); gl.glBindBufferARB(GL.GL_ARRAY_BUFFER_ARB, VBOs[2]); gl.glNormalPointer(GL.GL_FLOAT, 0, null); } else { gl.glVertexPointer(3, GL.GL_FLOAT, 0, vertices); gl.glTexCoordPointer(2, GL.GL_FLOAT, 0, texCoords); coordonees de texture gl.glNormalPointer(GL.GL_FLOAT, 0, normals); } ... Draw stuff .... |
So each times i am turning my pointers to the vertex arrays before drawing the vertex array and to the VBOs before drawing VBOs, so i am not clear to why my the content of my vertex arrays is not drawn anymore. Is there a need for me to "unbind the buffer" before drawing a vertex array structure? If so how? Thanks for your help
|
|
|
|
|
8
|
Java Game APIs & Engines / JOGL Development / Re: Animate 3D character?
|
on: 2006-04-03 16:16:31
|
For skeletal animation vertices are assigned to 'bones' (matrices) and matrices are stored with the rotation, translation, and scaling for each individual frame of animation. With skeletal animation you can also do physics on the bones enhancing realism. Does anyone have an exemple of skeletal animation using JOGL? or C++?
|
|
|
|
|
9
|
Java Game APIs & Engines / JOGL Development / Re: Animate 3D character?
|
on: 2006-03-31 11:27:14
|
I am not clear to what you mean by "if your object are static and linked together by pivot " in fact i might have misexplain myself. Each building is a java object and my character ia also a java object that contains the array of vertices. and what i consider a frame is a particular state of that array. And if i need to interpolate i need to do something like 1
| Vert[i]= (1-t) * VertStart[i] + t * VertEnd[i] |
And this is what i am fearing is taking time if i have thousand vertices.
|
|
|
|
|
10
|
Java Game APIs & Engines / JOGL Development / Re: Animate 3D character?
|
on: 2006-03-31 10:41:22
|
|
Hi,
I am planning to try a key frame animation of my characters, I just have a small concerns.
For example imagine that i have a world with many buildings homes etc... so completely fixed using VBO to store them in video memory as they are fix i do not need to access their vertex arrays.
Now i have an animal, a cow, that i want to include there for trying to animate my first thing. Its polygons are therefore stored in a vertex array, but sitting in main memory to be able to update it.
My main concerns is that if i have two key frames, to create the animation what should i do, calculate the interpolation at drawing time or generate the 24 frame of a second of animation and storing them in my objet to simply read them at drawing time?
In my opinion the first one risk to make everything crawling down and the second will cost me a huge amount of memory...
So here is the question, what is the best technique to have a smooth (CPU/GPU) efficient animation?
|
|
|
|
|
13
|
Java Game APIs & Engines / JOGL Development / Re: [Q] Multiple JOGL canvases in single application
|
on: 2005-07-23 22:52:19
|
|
Here it is below attached as txt file
By the way i have noticed something strange. In my main frame i create one GLJPanel in which i make the main display and later i create other GLJPanel "shared" with the main one to display others parts in new frame. The buildings display correctly in these latter frame but not in the main.
Has you can seen on the pictures below, on one (prob2.jpg) building appear with its chemney correctly but not on the other (prob.jpg) , but it is the same building created the same way. The chemney is drawn through a display list, and the same problem arise with all other parts of buildings being drawn from display lists (meaning that on the frames it is ok but not on the main frame)
So i guess the problem is the same as the VBOs which work fine in the small frames but not in the main one as the crash below show.
Is it a known problem?
|
|
|
|
|
14
|
Java Game APIs & Engines / JOGL Development / Re: [Q] Multiple JOGL canvases in single application
|
on: 2005-07-20 18:34:18
|
|
Hi
I would have another question, textures and display list are shared but what about the VBOs?
It seems my app is quite unhappy when i try to draw from a VBO on a GL object that is shared. I mean by that, that it severly crashes complaining about an Illegal access made by the method DrawArray() not an exception but an error launched from JVM. I do not have the output here but i will add it as soon as i am back on the machine where it happened.
|
|
|
|
|
17
|
Java Game APIs & Engines / JOGL Development / Re: [Q] Multiple JOGL canvases in single application
|
on: 2005-07-19 14:19:27
|
|
If i am setting many parameters to a GL Objects (like loading many textures "into" it), and then use the command setGL() to another canvas, shouldn't the textures ID be pointing to the right adress for both?
It seems they are not, I am having a Canvas with its GlEventListener, loading the textures into the VRAM and having the textures ID in an array. Then i call a method on other canvas, passing them the array of ID and the GL object but when drawing in these canvas textures are not applied.
Is it normal or I just do not do it the right way. In Jrefract exemples the seem to clone directly the GL object but it sounds quite a rude operation no?
|
|
|
|
|
18
|
Java Game APIs & Engines / JOGL Development / Re: Why the hell is it not displaying?
|
on: 2005-07-19 12:22:30
|
Got it !  I found the reason, but i am not really understanding why it does so. The fact is i place my "eye" at coordinate (x,y+20,z) and my look point at (x,y,z). Meaning that i look vertically downwards to my scene. It seems that gluLookAt is suddenly very unhappy with it since my screen directly get black? Even if i am thinking about how does the view Volume is built i do not know why it is behaving like that. Is it normal?
|
|
|
|
|
21
|
Java Game APIs & Engines / JOGL Development / Re: [Q] Multiple JOGL canvases in single application
|
on: 2005-07-14 15:14:42
|
Hi, Is it possible to post a code example of this? It is not clear to me how to handle the different display() etc... openGL functions? Do you create all your GLcanvases in one class or you make one class for each GLcanvas to handle its behaviour? I would think it has to be done in the second way but if someone can confirm it or tell me if i am wrong it would be nice 
|
|
|
|
|
22
|
Java Game APIs & Engines / JOGL Development / Re: Do s and Don't s?
|
on: 2005-06-27 10:14:22
|
|
Thanks to gverig, by finally looking to all my calls to glu quadrics objects i finally found it ! One sphere that was generating 40 000 polygons unnecessarily! 6 cylinders that were generating 10000 polygons unncessarily. Just like a magic trick the speed of my application suddenly got back to the quick normal speed it should have!!
|
|
|
|
|
23
|
Java Game APIs & Engines / JOGL Development / Re: Do s and Don't s?
|
on: 2005-06-25 13:16:56
|
As to your last post, I didn't undertand much. Do you mean that after you used VBO for your torus and cylinders then what kind of calling methods you should use? If you don't have tens of thounds of objects I think you can just call them with glDrawElements, and instead, if you want to get better ( but maybe a little better) performance, you can use display list.
No i mean that i will use VBO for every polygons i was previously generating with glvertex etc... in loops, making thousands of calls to these functions. But for cylinders, disks, sphere and cones, i am using gluquadric since they have the texture binding enable very easily, for the torus i am using glut. Since every thing except these will be turned into VBO i was wandering how i should deal with them now. Should i put the calls to gluquadric() into display lists (with memory usage more important), only put them in loops (with the lack of efficiency due to the increasing number of them) or give up gluquadric to some other methods that would be more efficient?
|
|
|
|
|
24
|
Java Game APIs & Engines / JOGL Development / Re: Do s and Don't s?
|
on: 2005-06-24 15:47:53
|
|
I guess i will try running my application through profiler on my quick machine later, if i try on the one whose slowness make me annoyed it take ages to even start the application...
Anyway i am still investigating about vertex arrays and Buffer Object for future use as the complexity of my application will grow again and again as in final it should be able to contains something like 100 differents buildings style and you can guess how many more vertices and so on it will be. My question is, i understand how vertex arrays and buffers objects make the memory usage easy to manage and make the speed much quicker than calling thousands of glvertex glnormal gltexcoord. How should i deal with my cylinders, cones, disks and torus. Should i put their drawing in display lists? (which might be quicker but seems to take more memory as said in opengl website) Should i simply use loops to draw repeated structure? Or should i use another existing way (that i might not know yet) to make their use smooth and efficient. (N.B for one disks, cone, cylinder or torus i currently never put more than 20 rings and 20 slices, i.e 400 quads per objects).
|
|
|
|
|
25
|
Java Game APIs & Engines / JOGL Development / Re: Do s and Don't s?
|
on: 2005-06-23 15:43:47
|
To ZhaoYou, Since i am using a keyListener and MouseListener i guess i can make them call the display method rather than having it continously called when not moving, is it what you mean? To Gverig, Your idea of passing it through a profiler is interesting but i have to admit i know nothing about profiler ...  maybe you can give me hint or information about where to find and how to do. Concerning the GLU quadrics, you think that creating my own method for drawing disks, Cylinders and Sphere would be more efficient rather than using the library ones? I have in mynd that they are only shortcuts for polygons generation and rendering. I the code i am using a couple of Torus also, would you suggest the same or GLUT is not a slow down? BTW thanks for the advice about posting files  i will a more secure archive type to enable people to have code.
|
|
|
|
|
26
|
Java Game APIs & Engines / JOGL Development / Re: Do s and Don't s?
|
on: 2005-06-22 09:58:23
|
|
I am using display lists with sometimes many loops containing GlVertex.
Does anyone think that modifying the code using Vertex arrays or Vertex buffers Objects might make a clear change in speed? If it is likely to be the case i am willing to do it.
|
|
|
|
|
28
|
Java Game APIs & Engines / JOGL Development / Re: normal array issue
|
on: 2005-04-28 14:13:20
|
From how i understand it your code will draw make six quads with the correct normals but with cube[0]cube[1]cube[2]cube[3] cube[1]cube[2]cube[3]cube[4] cube[2]cube[3]cube[4]cube[5] cube[3]cube[4]cube[5]cube[6] cube[4]cube[5]cube[6]cube[7] cube[5]cube[6]cube[7]cube[8] for each quads. You can try to put the vertex entries in such an order that when being drawn like this it will have the correct values but i don't know whether such an ordering is actually possible. Therefore if your cube array contains 24 entries i suggest you put each 4 vertices of each quads after another and do 1
| gl.glVertexPointer(3, GL.GL_FLOAT, 0, cube[4*i]); |
But be careful i am assuming that gl.glDrawArrays draws only one quad, which can actually be wrong. I have in mind that this method actually takes each group of n entries (here 4) and create a polygon with it repeatedly. Meaning that it would take 4 entries of your normal array too. So i suggest to see the documentaiton of it to check about that. If draw only one quad then think of my suggestion. Otherwise you have to create an array of normals of the same size of your vertex array. (Meaning that you will have obviously repeated entries). Hope this can help
|
|
|
|
|
29
|
Java Game APIs & Engines / JOGL Development / Re: Newbie Issue: JOGL Problems With jdk 5 in linu
|
on: 2005-04-28 14:00:31
|
The first is a deprecated method and is not very serious. If you want to get rid of it you just change it to 1
| frame.setVisible(true); |
and the compiler will be happy. Concerning the setSwapInterval, normally if it is really an opengl method it should come like try to see if it compile afterwards. However as it is one of the demo it is strange it is not compiling.
|
|
|
|
|
30
|
Java Game APIs & Engines / JOGL Development / Re: Need help~add a texture on the plane
|
on: 2005-04-27 10:25:45
|
this code normally works perfectly fine for me. maybe the problem comes from your line 1
| system.out.println(texture); |
that will crash if it even happen to compile if you want to check texture you should do 1
| system.out.println(texture.toString()); |
instead. Concerning the reason of why * 3 i have no idea as i picked up the method in a tutorial 
|
|
|
|
|
|
Add your game by posting it in the WIP section,
or publish it in Showcase.
The first screenshot will be displayed as a thumbnail.
|
|