Show Posts
|
|
Pages: [1]
|
|
2
|
Java Game APIs & Engines / JOGL Development / Re: glrotation to vectors
|
on: 2011-05-31 09:17:14
|
its working 99.0%  the only thing is, and that i think is what cylab wrote, is the multiply your objects vertices . my camera is not interacting with the objects like it does before. My old code was looking like that: glu.glulookat for camera ... push matrix rotate .. rotate... translate callList(xyz) pop matrix now i replaced the rotate ... with the set_rota funktion (see code) when i got my camera fixed ( glu.gluLookAt(0,0,1, 0,0,0, 0,1,0); the object is working perfect with the vector rotations. when now putting the vectors in the lookat funktion for the camera they make an twice rotation and the object is always in front of me. greetings  // Paint object with vector offset 0 1 2 3 4 5
| gl.glPushMatrix(); texture[9].bind(); set_rota(drawable, 0); gl.glCallList(2005); gl.glPopMatrix(); |
// My build matrix from vector method 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
| public void set_rota(GLAutoDrawable drawable,int off) { GL2 gl = drawable.getGL().getGL2();
float flc=0.0f; FloatBuffer matrix2 = FloatBuffer.allocate(16); matrix2.rewind(); flc=(float) vector[off+3] ;matrix2.put(flc); flc=(float) vector[off+4] ;matrix2.put(flc); flc=(float) vector[off+5] ;matrix2.put(flc); flc=0.000000f ;matrix2.put(flc); flc=(float) vector[off+6] ;matrix2.put(flc); flc=(float) vector[off+7] ;matrix2.put(flc); flc=(float) vector[off+8] ;matrix2.put(flc); flc=0.000000f ;matrix2.put(flc); flc=(float) vector[off+0] ;matrix2.put(flc); flc=(float) vector[off+1] ;matrix2.put(flc); flc=(float) vector[off+2] ;matrix2.put(flc); flc=0.000000f ;matrix2.put(flc);
flc=(float) 0 ;matrix2.put(flc); flc=(float) 0 ;matrix2.put(flc); flc=(float) -10 ;matrix2.put(flc); flc=1.000000f ;matrix2.put(flc); matrix2.rewind(); gl.glLoadMatrixf(matrix2); |
// My Camera Setup 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
| public void setcamera(GLAutoDrawable drawable,int was) { GL2 gl = drawable.getGL().getGL2(); GLU glu = new GLU();
gl.glMatrixMode(GL2.GL_PROJECTION); gl.glLoadIdentity();
float pvi=35.0f; float near=0.1f; float far=50000.0f; float asp = (float)screen_x / (float)screen_y; if (asp==0) asp=1;
glu.gluPerspective( pvi, asp, near,far ); gl.glMatrixMode(GL2.GL_MODELVIEW); gl.glLoadIdentity();
glu.gluLookAt(vector[0],vector[1],vector[2], 0,0,0, vector[6],vector[7],vector[8]); |
|
|
|
|
|
3
|
Java Game APIs & Engines / JOGL Development / Re: glrotation to vectors
|
on: 2011-05-31 00:30:08
|
omg, i was looking for the strangest of all calculation-combinations to get the rotation.... (i am not an mathematics expert..i wrote an own vector 3axis rotation for an space sim ..not 100% exactly..but for gaming it works perfect ) and now..simple put the vectors to the matrix..and works... think i need some coffee thanks alot cylab... 
|
|
|
|
|
4
|
Java Game APIs & Engines / JOGL Development / glrotation to vectors
|
on: 2011-05-30 02:27:47
|
hello @all, i got 3 vectors (X;Y;Z) and i need to setup an rotation in opengl/jogl to use this for drawing objects. the glu.lookat (0,0,0 ,Vx,Vy,Vz, Ux,Uy,Uz) is doing this perfect for the camera..but i need this for the objects (V'xyz= Z Vector , U'xyz is the Y/UP Vector..and i also got an X Vector to the side) how can i do this ? thanks for all help 
|
|
|
|
|
6
|
Java Game APIs & Engines / JOGL Development / JOGL2 loading mipmap levels
|
on: 2011-03-27 14:55:39
|
hello @all, i am working on an textur-atlas landscape with jogl2 (it needs a lot of different textur images on it) (but i have the textur bleeding thing on the edges..so i try to use own mip-graphics) , my question ist how i can manually load with jogl2 my images into the mipmap levels ..... ground_texture= TextureIO.newTexture(new File("gfx/mip_level0.png"), false); // true for auto mipmap generate gl.glTexParameterf(GL2.GL_TEXTURE_2D, GL2.GL_TEXTURE_MIN_...... ..... how can i load my mip_level1.png into the miplevel 1 of ground_texture...mip_level2.png into level 2 ..... much thanks for all help  theri
|
|
|
|
|
7
|
Java Game APIs & Engines / JOGL Development / Re: jogl2 GLWindow & exclusive fullscreen
|
on: 2010-07-25 15:33:41
|
|
some late response ..
i was also getting this white screen situation with windows vista/windows 7... xp was running perfect...
after a while i see that the first rendered screen appears when clicking mouse..and then black screen/freeze .. i used the robot funktion to simulate a mouse click one time direct after initialisation of opengl/jogl2.. it was only a simple test...and now it works perfect with it... (on all windows versions)
---------------------------------------------------------------------------------------------- i think its the theory/practice thing
-theory is when someone know how it works..and its not running -practise is.. its running and nobody knows why...
|
|
|
|
|
8
|
Java Game APIs & Engines / JOGL Development / Re: RenderToTexture Question
|
on: 2010-05-27 08:42:10
|
omg... i found what the app disturbed. -the nvidia desktop manager software eats all vram! (after deaktivating this program all works fine again (i use 2 screen ,and got no need of any extra screen manager... must be activated in any way) thanks for all answers!  (i program on older geforce go7300 notebook... on other hardware the problem didnt exist)
|
|
|
|
|
9
|
Java Game APIs & Engines / JOGL Development / Re: RenderToTexture Question
|
on: 2010-05-27 07:46:16
|
the rewind sounds good, but didnt work..same error stays.  i also try to use ... fbo.reset(); , nothing happend memory is more that enough...i reduce the number of used textures to minimum(2 x 256*256) ..nothing happend. and i got no memory killer arrays in the engine...all very simple but i am very sure that the static IntBuffer fbo = BufferUtil.newIntBuffer(1); static IntBuffer depth = BufferUtil.newIntBuffer(1); static IntBuffer fbo_texture = BufferUtil.newIntBuffer(1); must be the problem...
|
|
|
|
|
10
|
Java Game APIs & Engines / JOGL Development / Re: RenderToTexture Question
|
on: 2010-05-26 21:43:27
|
here some infos: -Djava.library.path="lib" -Xmx1024m -Xms1024m the application break after the gl.glBindFramebuffer(GL2.GL_FRAMEBUFFER, FSO_ENGINE.fbo.get(0)); line and return with error (see below) i am not very experienced with such error messages in java and didnt know what to do. i take a look at some examples,but all i found was written in c++/opengl and that could net help me ( my code was working , but monday...) maybe the IntBuffer could be a problem, is there anything to take care? Exception in thread "AWT-EventQueue-0" javax.media.opengl.GLException: Thread[AWT-EventQueue-0,6,main] glGetError() returned the following error codes after a call to glBindFramebuffer(<int> 0x8D40, <int> 0x1): GL_OUT_OF_MEMORY ( 1285 0x505), at javax.media.opengl.DebugGL2.checkGLGetError(DebugGL2.java:24207) at javax.media.opengl.DebugGL2.glBindFramebuffer(DebugGL2.java:9980) at org.unterhaltungsuniversum.OPEN_GL.initializeFBO(OPEN_GL.java:1125) at org.unterhaltungsuniversum.FSO_ENGINE.init(FSO_ENGINE.java:994) at com.sun.opengl.impl.GLDrawableHelper.init(GLDrawableHelper.java:88) at javax.media.opengl.awt.GLCanvas$InitAction.run(GLCanvas.java:603) at com.sun.opengl.impl.GLDrawableHelper.invokeGL(GLDrawableHelper.java:149) at javax.media.opengl.awt.GLCanvas.maybeDoSingleThreadedWorkaround(GLCanvas.java:553) at javax.media.opengl.awt.GLCanvas.display(GLCanvas.java:290) at javax.media.opengl.awt.GLCanvas.paint(GLCanvas.java:368) at sun.awt.RepaintArea.paintComponent(RepaintArea.java:248) at sun.awt.RepaintArea.paint(RepaintArea.java:224) at sun.awt.windows.WComponentPeer.handleEvent(WComponentPeer.java:301) at java.awt.Component.dispatchEventImpl(Component.java:4489) at java.awt.Component.dispatchEvent(Component.java:4243) at java.awt.EventQueue.dispatchEvent(EventQueue.java:599) at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:273) at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:183) at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:173) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:168) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:160) at java.awt.EventDispatchThread.run(EventDispatchThread.java:121)
|
|
|
|
|
11
|
Java Game APIs & Engines / JOGL Development / RenderToTexture Question
|
on: 2010-05-26 08:56:46
|
hello @all, i got an strange problem with the fbo's since a short time, it was working a long time but yesterday the code stops with an out_of_memory. the only thing that changed was an update of java. i dont know if my code was unstable or is there any other method? much greetings and thanks for any help 
import com.sun.opengl.util.FBObject; ...
static IntBuffer fbo = BufferUtil.newIntBuffer(1); static IntBuffer depth = BufferUtil.newIntBuffer(1); static IntBuffer fbo_texture = BufferUtil.newIntBuffer(1); ...
static void initializeFBO(GLAutoDrawable drawable,int width, int height) { GL2 gl = drawable.getGL().getGL2();
gl.glGenFramebuffers(1, FSO_ENGINE.fbo); !->> gl.glBindFramebuffer(GL2.GL_FRAMEBUFFER, FSO_ENGINE.fbo.get(0)); << -at this point the app gets memory error! gl.glGenRenderbuffers(1, FSO_ENGINE.depth);
gl.glBindRenderbuffer(GL2.GL_RENDERBUFFER, FSO_ENGINE.depth.get(0)); gl.glRenderbufferStorage(GL2.GL_RENDERBUFFER, GL2.GL_DEPTH_COMPONENT24, width, height); gl.glBindRenderbuffer(GL2.GL_RENDERBUFFER, 0); gl.glFramebufferRenderbuffer(GL2.GL_FRAMEBUFFER, GL2.GL_DEPTH_ATTACHMENT, GL2.GL_RENDERBUFFER, FSO_ENGINE.depth.get(0)); gl.glGenTextures(1, FSO_ENGINE.fbo_texture); gl.glBindTexture(GL.GL_TEXTURE_2D, FSO_ENGINE.fbo_texture.get(0)); gl.glTexParameteri(GL.GL_TEXTURE_2D, GL2.GL_TEXTURE_MAG_FILTER, GL2.GL_LINEAR); gl.glTexParameteri(GL.GL_TEXTURE_2D, GL2.GL_TEXTURE_MIN_FILTER, GL2.GL_LINEAR); gl.glTexParameterf(GL.GL_TEXTURE_2D, GL2.GL_TEXTURE_WRAP_S , GL2.GL_CLAMP); gl.glTexParameterf(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_WRAP_T , GL2.GL_CLAMP);
gl.glTexParameterf(GL.GL_TEXTURE_2D, GL2.GL_TEXTURE_WRAP_S , GL2.GL_CLAMP_TO_EDGE); gl.glTexParameterf(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_WRAP_T , GL2.GL_CLAMP_TO_EDGE);
gl.glTexEnvi(GL2.GL_TEXTURE_ENV, GL2.GL_TEXTURE_ENV_MODE, GL2.GL_REPLACE); gl.glTexImage2D(GL.GL_TEXTURE_2D, 0, GL.GL_RGBA, wid,hei, 0, GL.GL_RGBA, GL.GL_UNSIGNED_BYTE, null); gl.glViewport(0,0,width,height); ... ... ...
|
|
|
|
|
13
|
Java Game APIs & Engines / JOGL Development / Basic question about Jogl
|
on: 2010-05-01 13:44:47
|
|
Hello @all,
i am a bit confused about jogl.. i like it very much..its easy to use and my project now runs perfect after some startproblems. (jogl/java is a perfect combination of develop a multiplatform 3d game)
but my question is:is jogl frozen or dead or what is with jogl/jogl2..is it from sun or belongs to someone else..can i still use it for bigger projects.. will the develompemt of jogl continue?
so much different reports.. and jocl... is it another name for "jogl"?
hope someone can explain it a bit to me ?
much greetings theri
|
|
|
|
|
14
|
Java Game APIs & Engines / JOGL Development / Fullscreen Problem VISTA/XP
|
on: 2010-03-09 09:46:33
|
Hi, i am using Jogl2 and got a little problem with the fullscreen mode (specially at vista) first i got first the same problem with the white screen and stopped application at vista when trying fullscreen mode. i modify the code that it runs in an very bad way...but it runs.. when starting the application i get "black" screen..but the application is running (i hear sound effects for controlling). now i need to (alt-tab) to the background/desktop of vista..and then switch (alt-tab) back to the application..now it runs absolut good. can anybody take a quick look at my init code what i am doing wrong? (its not cleanup and the window mode is not used at moment) thanks for any help  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 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105
| public static void main(String[] args) {
Frame frame = new Frame("FSO");
frame.setVisible(false);
Cursor invisibleCursor = Toolkit.getDefaultToolkit(). createCustomCursor(Toolkit.getDefaultToolkit().getImage(""), new Point(0,0), "invisibleCursor");
screenWidth = Toolkit.getDefaultToolkit().getScreenSize().width; screenHeight = Toolkit.getDefaultToolkit().getScreenSize().height;
GLCapabilities capabilities = new GLCapabilities(GLProfile.get(GLProfile.GL2));
capabilities.setNumSamples(2); capabilities.setSampleBuffers(true);
GLCanvas canvas = new GLCanvas(capabilities);
animator = new Animator(canvas);
canvas.addGLEventListener(new FSO_ENGINE());
System.out.println("Vollbildmodusverfügbar :? "+GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().isFullScreenSupported()); System.out.println("Refresh :? "+GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().getDisplayMode().getRefreshRate()); System.out.println("Bitdepth :? "+GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().getDisplayMode().getBitDepth()); System.out.println("Width :? "+GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().getDisplayMode().getWidth()); System.out.println("Height :? "+GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().getDisplayMode().getHeight());
screenWidth=GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().getDisplayMode().getWidth(); screenHeight=GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().getDisplayMode().getHeight(); screen_x=screenWidth; screen_y=screenHeight;
frame.add(canvas);
System.out.println("isActive :? "+ frame.isActive());
frame.addWindowListener(new WindowAdapter() {
@Override public void windowClosing(WindowEvent e) { new Thread(new Runnable() {
public void run() { animator.stop(); System.exit(0); } }).start(); } }); canvas.addKeyListener(new FSO_ENGINE()); canvas.addMouseListener(new FSO_ENGINE()); canvas.addMouseWheelListener(new FSO_ENGINE()); canvas.addMouseMotionListener(new FSO_ENGINE());
frame.setUndecorated(true); frame.setSize(screen_x, screen_y);
frame.setLocationRelativeTo(null); GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().setFullScreenWindow(frame); GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().setDisplayMode((new DisplayMode(screen_x,screen_y, 32, 60))); canvas.requestFocus();
canvas.setFocusable(true); canvas.setVisible(true);
fbo_width =(int) (screen_x*0.25f); fbo_height=(int) (screen_y*0.25f);
frame.pack(); frame.setVisible(true); canvas.display(); canvas.requestFocus(); frame.requestFocus();
Thread.yield(); animator.start();
} |
|
|
|
|
|
15
|
Java Game APIs & Engines / JOGL Development / Jogl2 Netbeans8 Problems
|
on: 2010-01-05 09:13:41
|
|
Hello @all,
i got a lot of problems with Jogl2. i was using netbeans 6.7 and i dont know where i loaded the plugin for jogl2 and the projects were working (inside the IDE). now i came to the bad idea to make the projects to run outside the ide..bad idea...
when i was using jogl1 i got after using the build functions some folder with dist_solaris,dist_windows..etc..inside this folders the jars where running without any problem (the -Xmx -Xms is not a problem)
now i got only a dist folder..and i cannot start it.
this night i came to the next bad idea...install netbeans 8 und load from the netbeans site the jogl plugin again.. the problems stays..plus: there is no jogl2
there is a kenai site there are some download files..but i ont know what to load there (i miss something lite a "latest release with everything inside zip")
my nightmare... with netbeans 6.5 i got also a reinstall problem with jogl1...after trying to remove jogl and reinstall it the netbeans was not working anymore.. need complete reinstall.
my goal.. a simple OPENGL (jogl2) application (no webstart) that is running without netbeans
like compile and run
can anybody help me please?
|
|
|
|
|
17
|
Java Game APIs & Engines / JOGL Development / Need little help getting startet
|
on: 2008-03-28 10:14:05
|
Hello, i hope i am right here.. i was coding c++ and actionscript, but for games i need an openGL system...but i am not very expericened in the java. i found jogl/java(eclipse) and installed it..first 2 example on the wiki work perfekt but i got some litte questions about it. But a little thing i cant find in the tutorials. you see in the code, i try a bit helpless to use an call for an renderer loop to the opengl thing, but i dont know how to access/handle it . i know that every opengl things must be in the-> "class SceneView implements GLEventListener" but how can i implement a render loop call to update the scene every frame. thanks for any help  (and sorry for my bad english) 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 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134
| import javax.swing.*; import javax.media.opengl.*; import com.sun.opengl.util.GLUT; import java.awt.geom.*; import java.awt.event.*; import java.io.*; import javax.swing.*; import com.sun.opengl.util.texture.*;
import java.applet.*; import java.awt.*;
public class fso extends JFrame { GLCanvas canvas;
static Thread t = null; static int i=0; public fso() { GLCapabilities cap = new GLCapabilities(); canvas = new GLCanvas(cap);
canvas.addGLEventListener(new SceneView()); getContentPane().add(canvas); setTitle("Game Scene"); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setSize(900, 600); setVisible(true);
}
public static void run() { while(true) { i++; renderer(); try { t.sleep(1000/30); } catch (InterruptedException e) { ; } } }
private static void renderer() {
}
class SceneView implements GLEventListener {
public void init(GLAutoDrawable arg0) { GL gl = arg0.getGL(); float l_position[] = {100.0f, 100.0f, 200.0f, 1.0f}; gl.glEnable(GL.GL_LIGHTING); gl.glEnable(GL.GL_LIGHT0); gl.glEnable(GL.GL_COLOR_MATERIAL); gl.glEnable(GL.GL_DEPTH_TEST); gl.glEnable(GL.GL_NORMALIZE); gl.glEnable(GL.GL_POLYGON_SMOOTH); gl.glLightfv(GL.GL_LIGHT0, GL.GL_POSITION, l_position, 0); gl.glClearColor(0.7f, 0.7f, 0.7f, 0.0f); gl.glMatrixMode(GL.GL_PROJECTION); gl.glOrtho(-100, 100, -100, 100, -100, 100); int i=120; gl.glMatrixMode(GL.GL_MODELVIEW); gl.glRotatef(i, 1.0f, 0.0f, 0.0f); gl.glRotatef(-25.0f, 0.0f, 1.0f, 0.0f); }
public void renderer(GLAutoDrawable arg0) { }
public void display(GLAutoDrawable arg0) { GL gl = arg0.getGL(); GLUT glut = new GLUT(); gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT); gl.glColor3f(0.2f, 0.0f, 0.3f); glut.glutSolidTeapot( 50.0 ) ; }
public void reshape(GLAutoDrawable arg0, int arg1, int arg2, int arg3, int arg4) { }
public void displayChanged(GLAutoDrawable arg0, boolean arg1, boolean arg2) { } }
public static void main(String args[]) {
new fso(); run(); } } |
|
|
|
|
|
|
Add your game by posting it in the WIP section,
or publish it in Showcase.
The first screenshot will be displayed as a thumbnail.
|
|