Java-Gaming.org    
Featured games (91)
games approved by the League of Dukes
Games in Showcase (579)
games submitted by our members
Games in WIP (500)
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 / Re: Offscreen rendering: doing a little better on: 2003-11-26 19:51:30
In the future, will there be a pure software solution? Seems like there ought to be one. (BTW, how does Java3D do it?)
2  Java Game APIs & Engines / JOGL Development / Offscreen rendering: doing a little better on: 2003-11-24 06:55:17
Hi,

I would be happy to get a couple of opinions on my previous post, but in the act of desperation, I started everything from scratch working from the PBDemo posted by Ken Russell or GKW - sorry don't remember.

It now kind of works (not really). Here are the problems.

1. I seem to be limited to powers of 2 for sizes. I seem to recall from previous posts that this may not need to be the case. Is this so? Does it depend on my video card? Are there plans to change that? (Java3D - something I've been using, but grown to dread - does not have this limitation.)

2. My second, more significant problem is summarized on the following page:

http://www.geocities.com/dolachin/offscreen.html

Basically, something goes very wrong at higher resolutions.

Once again, thank you for all the help.

Dola
3  Java Game APIs & Engines / JOGL Development / Offscreen rendering revisited on: 2003-11-24 04:50:47
Hi,

I'm revisiting a topic from three months ago. I've been trying to incorporate the advice I got at this forum at get it to work on my own - and failed!!!

I'm working on a scientific application which shows the evolution of a shape. Every once in a while I want to be able to snap a picture of what's going on. I don't want to overload you, potential helpers, with code so I will just present the code for my takeAPicture procedure (with comments) and may be you will be able to spot something. I am very happy to post more code.


Many thanks in advance for any advice.


 public BufferedImage takeAPicture(int inWidth, int inHeight) {

   if (myOffScreenBuffer == null) { // class member elem
     GLCapabilities pbCaps = new GLCapabilities();
     pbCaps.setDoubleBuffered(false);
     myOffScreenBuffer = myCanvas3D.createOffscreenDrawable(pbCaps, inWidth, inHeight);
     myOffScreenBuffer.addGLEventListener(new OffScreenGLEventListener());

// I have a hard time getting init() to be called in
// OffScreenGLEventListener. I have to resize the live
// window, call takeAPicture again, and only then it
// gets called.

   }

   BufferedImage pbImage = new BufferedImage(inWidth, inHeight, BufferedImage.TYPE_3BYTE_BGR);
   DataBufferByte dbByte = (DataBufferByte) pbImage.getRaster().getDataBuffer();
   myOffScreenBuffer.display();

   myOffScreenBuffer.getGL().glReadPixels(0, 0, inWidth, inHeight, GL.GL_BGR, GL.GL_UNSIGNED_BYTE, dbByte.getData());

   return pbImage; // returns nothing but black pixels
 }

Would you like to see my OffScreenGLEventListener?
4  Java Game APIs & Engines / JOGL Development / Re: Off-screen rendering - help me get started on: 2003-09-29 19:28:47
Thank you so much for addressing each one of the questions. You guys are great!

One more though (since I don't seem to get this to work in the context of my application).

Does the canvas and the pbuffer each need its own GLEventListener you can they share one? Especially in my case where the drawing is presumably the same.

Thanks.
5  Java Game APIs & Engines / JOGL Development / Re: Off-screen rendering - help me get started on: 2003-09-28 09:07:21
Wow, thank you very much for the post! I'm sorry I only got to testing it yesterday, got sidetracked by an urgent project.

I tested the code on my system and it works. I was able to save the scene as an image which is precisely what I want!


But a whole lot of new questions arose and I would like to describe one of my applications in some detail so I can my questions in context. I have an application which has live 3d rendering so I have a bona fide canvas in a real window, etc. There are massive vertex list which were constructed with the canvas as the GLDrawable input. Now every once in a while (often!) I have a need to "take a picture" of the scene, usually with identical view and projection settings but with different aspect ration and dramatically different resolutions. So that's the situation and here are my questions:

1. Do I have to regenerate the lists with the pbuffer as the GLDrawable?
2. If yes, can I change the dimensions of the pbuffer without regenerating the lists? It would be a significant drag on the resources  if I had to regenerate the lists every time I change the resolution.
3. Can I have my regular canvas createOffscreenDrawable()?
4. What does it mean that "PBuffers are lazily created"?
5. Finally, do I have to have a GLEventListener? Since I have my GLDrawable (the pbuffer!) can I just give gl commands?

Once again, very many thanks. It's beginning to look like the switch to Jogl will actually work!!!

Dola
6  Java Game APIs & Engines / JOGL Development / Re: Off-screen rendering - help me get started on: 2003-09-19 22:55:51
In response to GKW's last message...

Great! I'll wait for your example with baited breath!
7  Java Game APIs & Engines / JOGL Development / Re: Off-screen rendering - help me get started on: 2003-09-19 04:56:11
That would be great.

Actually, I'm personally constrained to a Win32 system.

A question about what you said about resolution. I need to produce production quality (600 dpi)  8"x8" images.

I have a thinkpad with a Fire GL 9000 card. Will I be in luck?
8  Java Game APIs & Engines / JOGL Development / Re: Off-screen rendering - help me get started on: 2003-09-19 02:08:42
Thanks for the reply.

But would that let me draw at a resolution different from that of the canvas?

(Is this question appropriate for a new thread? Maybe an example which renders offscreen and saves the result to an image - which can then be converted to java's buffered image - would be very useful and appreciated!)
9  Java Game APIs & Engines / JOGL Development / Re: Off-screen rendering - help me get started on: 2003-09-18 05:40:32
Oh, I must be color blind, I didn't realizer that "here" was a link.

Thanks for posting the demo. I'm afraid that I kind of miss the point. You seem (although I'm not sure that is the case) to draw to an offscreen buffer, but then display that buffer in the gl window. Am I correct? And if so, can you point out the four or five critical lines of code where the connection the offscreen buffer and the onscreen buffer is made. If I'm correct, that this is a very very cool feature.

Actually, I'm afraid that I may have been to vague when I said "off-screen rendering". What I really want to do is to get an image out of the hole thing. I want to do the rendering on a web server which may not even have a video card and output an image. I apologize profusely if I caused you to answer a wrong question or if you answered the right question and I totally missed the answer.

I appreciate your time,


Dola
10  Java Game APIs & Engines / JOGL Development / Re: Off-screen rendering - help me get started on: 2003-09-17 14:31:54
I'm sorry, this is probably a very ignorant question, but where do I find it?
11  Java Game APIs & Engines / JOGL Development / Re: Off-screen rendering - help me get started on: 2003-09-15 19:35:40
Thanks for the clarification! So I'll just wait for your demo.
12  Java Game APIs & Engines / JOGL Development / Re: Off-screen rendering - help me get started on: 2003-09-15 06:40:49
Thanks in advance for posting that demo!

So just out of curiosity, will I be constrained to the powers of 2 if I have a generic video card. I remember using Mesa in Linux and that was definitely not the case.
13  Java Game APIs & Engines / JOGL Development / Re: Off-screen rendering - help me get started on: 2003-09-14 17:41:02
Yes, please do! If that's the right way to do off-screen rendering, then sure. But the fact that you mentioned textures, doesn't mean that I'm limited to powers of 2 as far as dimensions, does it?

Thank you very much!

Pavel
14  Java Game APIs & Engines / JOGL Development / Re: Off-screen rendering - help me get started on: 2003-09-13 16:50:41
Wow, no takers? I though this would be an easy one. Still, I would very much appreciate a response, because I desperately need this functionality.

Dola
15  Java Game APIs & Engines / JOGL Development / Off-screen rendering - help me get started on: 2003-09-12 17:31:58
Hi,

Can someone point to a "Hello, World" type program for off-screen rendering in jogl? An OpenGL example would be a good start if it carries over into jogl easily.

Many thanks in advance!

Dola
16  Java Game APIs & Engines / JOGL Development / Re: GL_BACK properties. (Getting Interesting.) on: 2003-09-10 17:32:09
Yes, it all turns red.

I have a Mobility Fire GL 9000.
Chip type: Mobility Radeon 9000 (LF).

And here's an interesting thing: When I switch to

     gl.glPolygonMode(GL.GL_FRONT, GL.GL_LINE);
     gl.glPolygonMode(GL.GL_BACK, GL.GL_FILL);

the program crashes with the following error message:

http://www.geocities.com/bura3no/error.txt


17  Java Game APIs & Engines / JOGL Development / Re: GL_BACK material properties. on: 2003-09-10 13:59:11
EVERYTHING goes black.
18  Java Game APIs & Engines / JOGL Development / Re: GL_BACK material properties. on: 2003-09-09 15:26:17
Hi,

I would very much like to post more code, but I'm not quite sure what part of my program to quote. If I have

     gl.glMaterialfv(GL.GL_FRONT, GL.GL_AMBIENT_AND_DIFFUSE, Color.GREEN.getComponents(null) );

and

     gl.glMaterialfv(GL.GL_BACK, GL.GL_AMBIENT_AND_DIFFUSE, Color.RED.getComponents(null) );

right next to each other and green works but red doesn't, can you give me an idea of I might be doing wrong?

Thanks!

Pavel
19  Java Game APIs & Engines / JOGL Development / Re: GL_BACK material properties. on: 2003-09-08 18:21:32
Thanks for response.

Your suggestion helped with lighting of the back side (something I did need), but not with the coloring. It's still green rather than some other color.
20  Java Game APIs & Engines / JOGL Development / GL_BACK material properties. on: 2003-09-08 03:45:53
Hi,

Thanks for helping me figure out the previous question about lighting.

I'm still having trouble giving the back side of polygons a color different from the front side. The same sphere (with fixed lighting!) with half the triangles missing so you can see through can be found.

http://www.geocities.com/bura3no/index.htm

The relevant code is here:

     gl.glMaterialfv(GL.GL_FRONT, GL.GL_AMBIENT_AND_DIFFUSE, Color.GREEN.getComponents(null) );
     gl.glMaterialfv(GL.GL_BACK, GL.GL_AMBIENT_AND_DIFFUSE, Color.RED.getComponents(null) );

     gl.glMaterialfv(GL.GL_FRONT_AND_BACK, GL.GL_EMISSION, Color.BLACK.getComponents(null));

     gl.glMaterialfv(GL.GL_FRONT_AND_BACK, GL.GL_SPECULAR, Color.WHITE.getComponents(null) );
     gl.glPolygonMode(GL.GL_FRONT_AND_BACK, GL.GL_FILL);

     gl.glBegin(GL.GL_TRIANGLES);
     for (int t = 0; t < myMesh.pGetNumberOfElements()/2; t++) {
       Element elem = myMesh.pGetElement(t);
       for (int v = 0; v < elem.pGetNumberOfNodes(); v++) {
         VDouble x = myMesh.pGetX(elem.pGetNode(v));
         VDouble n = normals[elem.pGetNode(v)];
         gl.glNormal3d(n.pGet(0), n.pGet(1), n.pGet(2));
         gl.glVertex3d(x.pGet(0), x.pGet(1), x.pGet(2));
       }
     }
     gl.glEnd();

   }

   gl.glEndList();
21  Java Game APIs & Engines / JOGL Development / Re: Does lighting work? on: 2003-09-07 18:06:12
Thank you very much! You guys nailed it, of course. I'm now getting beautiful spheres and other shapes.

I've put the image with the solution on my index page:

http://www.geocities.com/bura3no/index.htm

to obey the geocities policies so everyone can see the answer. Feel free to use my images if anyone is going to put together that "common OpenGL mistakes and what they look like" page.
22  Java Game APIs & Engines / JOGL Development / Re: Does lighting work? on: 2003-09-07 03:41:51
Hi,

I'll start in little specs. I have a concept of a mesh which consists of triangles. The mesh knows how to calculate the normals and I am assured that the normals are correct.

Actually, there only difference between the two spheres on the image is GL_FLAT vs. GL_SMOOTH and I would argue that even on the left GL_FLAT image the shading is wrong.


     gl.glMaterialfv(GL.GL_BACK, GL.GL_AMBIENT_AND_DIFFUSE, myAmbientColorBack.getComponents(null) );
     gl.glMaterialfv(GL.GL_FRONT, GL.GL_AMBIENT_AND_DIFFUSE, myAmbientColorFront.getComponents(null) );

     gl.glMaterialfv(GL.GL_FRONT_AND_BACK, GL.GL_EMISSION, ZERO );

     gl.glMaterialfv(GL.GL_FRONT_AND_BACK, GL.GL_SPECULAR, Color.WHITE.getComponents(null) );
     gl.glPolygonMode(GL.GL_FRONT_AND_BACK, GL.GL_FILL);

     for (int t = 0; t < myMesh.pGetNumberOfElements(); t++) {
       Element elem = myMesh.pGetElement(t);
       gl.glBegin(GL.GL_TRIANGLES);
       for (int v = 0; v < elem.pGetNumberOfNodes(); v++) {
         VDouble x = myMesh.pGetX(elem.pGetNode(v));
         VDouble n = normals[elem.pGetNode(v)];
         gl.glVertex3d(x.pGet(0), x.pGet(1), x.pGet(2));
         gl.glNormal3d(n.pGet(0), n.pGet(1), n.pGet(2));
       }
       gl.glEnd();
     }
   }


Then elsewhere in my init() I have:

     GL gl = inDrawable.getGL();

     gl.glClearColor(1f, 1f, 1f, 1f);

     gl.glEnable(GL.GL_DEPTH_TEST);
     gl.glEnable(GL.GL_POLYGON_OFFSET_FILL);
     gl.glEnable(GL.GL_POLYGON_OFFSET_LINE);

     // Lights
     gl.glEnable(GL.GL_LIGHTING);
     gl.glLightModelfv(GL.GL_LIGHT_MODEL_AMBIENT, new float[] { .6f, .6f, .6f, 1f });

     myLight0 = new GLUtils.Light(myCanvas3D,  // Self-explanatory, really
GL.GL_LIGHT0,
                                  0f, 0f, 3f,
                                  Color.GRAY,
                                  Color.BLACK);

// Uncomment for FLAT.
//      gl.glShadeModel(GL.GL_FLAT);


Thanks for taking a look at this.

Dola
23  Java Game APIs & Engines / JOGL Development / Does lighting work? on: 2003-09-05 20:44:55
Hi,

1. I may be making an OpenGL mistake or it might be a JOGL bug. I am lighting a sphere, composed exclusively of triangles. I compute the normals on my own and I am very confident that my normals are OK.

http://www.geocities.com/bura3no/lighting.png

The figure on the left is GL_FLAT. The figure on the right is GL_SMOOTH.


2. Also, I can't get the back side of my polygons to be a different color from the front side. They both have the same color as GL_FRONT.

Are these known issues or should I post some code?

Many thanks in advance!

Dola
24  Java Game APIs & Engines / JOGL Development / Re: Why require context? on: 2003-09-05 20:22:43
Thank you very much for the reply. WHat you are saying makes sense.

But is my conclusion correct that if I want to have, say,  two views of the same object, I will need two display lists?

Thanks again,

Dola
25  Java Game APIs & Engines / JOGL Development / Why require context? on: 2003-09-04 18:11:38
Hi,

My life has taken me from OpenGL to Java3D and now to Jogl. And I have this question.

The way I've been organizing my code is by letting each object build itself and then sticking it into varous contexts. But with Jogl this seems not possible since any routine that does the building needs to have an instance of the GL class. This causes a couple "problems".

1. I need to build each object several times depending on the context.
2. I can't hide implementation (that fact that I'm using Jogl) since all of my routines have GLDrawable as an argument, and I have always been taught to separate logic from implementation.

Any thoughts?

Dola
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.

xsi3rr4x (34 views)
2014-04-15 18:08:23

BurntPizza (30 views)
2014-04-15 03:46:01

UprightPath (45 views)
2014-04-14 17:39:50

UprightPath (28 views)
2014-04-14 17:35:47

Porlus (45 views)
2014-04-14 15:48:38

tom_mai78101 (66 views)
2014-04-10 04:04:31

BurntPizza (126 views)
2014-04-08 23:06:04

tom_mai78101 (226 views)
2014-04-05 13:34:39

trollwarrior1 (191 views)
2014-04-04 12:06:45

CJLetsGame (199 views)
2014-04-01 02:16:10
List of Learning Resources
by SHC
2014-04-18 03:17:39

List of Learning Resources
by Longarmx
2014-04-08 03:14:44

Good Examples
by matheus23
2014-04-05 13:51:37

Good Examples
by Grunnt
2014-04-03 15:48:46

Good Examples
by Grunnt
2014-04-03 15:48:37

Good Examples
by matheus23
2014-04-01 18:40:51

Good Examples
by matheus23
2014-04-01 18:40:34

Anonymous/Local/Inner class gotchas
by Roquen
2014-03-11 15:22:30
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!