Java-Gaming.org Hi !
Featured games (83)
games approved by the League of Dukes
Games in Showcase (522)
Games in Android Showcase (127)
games submitted by our members
Games in WIP (590)
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] 2
1  Java Game APIs & Engines / Java 2D / Re: Switch coordinate space(x,y) on: 2006-02-13 16:25:59
Oh, I'm pretty stupid... thank you!

bye

basti
2  Java Game APIs & Engines / Java 2D / Re: Switch coordinate space(x,y) on: 2006-02-13 09:52:34
Hmm, you're right... it is obviously flipped, thx.
I decided to let the (0/0)-point (how is this correctly called in english btw. ?) stay in the top-left corner and change the rest of the
stuff manually.

Thanks for all your help,

have a nice day

basti
3  Java Game APIs & Engines / Java 2D / Re: Switch coordinate space(x,y) on: 2006-02-09 23:49:17
Hello again...

thanks for the help and keeping this thread alive...   Smiley
I followed your suggestions and updated my code as follows :
 
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
                    Graphics2D g2d = (Graphics2D) g; //cast to Graphics2D
      img = image2d.getImage(); //fetch the BufferedImage from the Imaged2D-class
      w_displayed = (int) (img.getWidth() * zoom); //calculate the width of the image
      h_displayed = (int) (img.getHeight() * zoom);//caluclate the height of the image
      panelHeight = this.getHeight(); //get the height of the panel
      panelWidth = this.getWidth(); //and the width
      g2d.translate(0,panelHeight); // for the display-height
      g2d.scale(1.0,-1.0); //flip around the x-axis so +y is up
      g2d.translate(transformX, transformY); //translate to the current position(default 0/0)
      g2d.drawImage(img, 0, 0, w_displayed, h_displayed, null); //draw the resized image


The image is displayed with the wrong orientation (180°) and is pretty heavy on cpu if redrawn/resized.
This operations where working fine when doing this stuff without flipping the axis.
Anyone of you got an idea, if there's another mistake in my code?

greetings

basti
4  Java Game APIs & Engines / Java 2D / Re: Switch coordinate space(x,y) on: 2006-02-07 09:21:57
Quote
Why don't you do the reverse

The whole OpenGL-stuff is already finished, would take the same effort to change this one to a new coordinate system as it would take on Java2D (even though it's pretty easy to switch the space in GL)

I tried to do the whole affine-transformations on he graphics-object, but it seems to slow down the whole thing..

Thanks for your help guys,

greetings


basti
5  Java Game APIs & Engines / Java 2D / Re: Switch coordinate space(x,y) on: 2006-02-04 10:56:52
Thanks to both of you for answering!

Yes, the mathematical approach is clear to me, but I wonder if it would be possible do generally change the used coordinate space
in a panel, so that I can more or less copy all my OpenGL-calculations to Java2D. I hope i could make my intention a little more understandable Smiley

greetings

lebasti
6  Java Game APIs & Engines / Java 2D / Switch coordinate space(x,y) on: 2006-02-04 00:42:25
Good evening everyone!

Is there a way to change the standard java coordinate space
( in which (0/0) is situated in the top left corner with axes right = +x ,down = +y)
to something compatible to the default OpenGL one
((0/0) is situated in the bottom left corner; right = +x axe and up = +y axe)?

I think I need to apply an affine transformation on the coordinate space,
tried to figure this out via google,  but the results weren't satisfying...  Huh
If this would be possible, it could save me a lot of work converting some JOGL-stuff to Java2D.

Have a nice day & thx for reading,

lebasti

7  Java Game APIs & Engines / JOGL Development / glEnable() - silly question :) on: 2006-01-16 13:12:45
Hi there!

I've got a little question to explain some strange behaviour to myself :
When I draw my grid of textures (a bunch of quads with the splitted image as texture) in Linux, it works fine if I just call glEnable(GL.GL_TEXTURE_RECTANGLE_ARB) once at the beginnig of the texture-loading-process. If I run the same code in Win32, it totally screws the last row of my grid (the one which *really* contain the npot-textures). This behaviour disappears when I call glEnable(GL.GL_TEXTURE_RECTANGLE_ARB)  and glDisable(GL.GL_TEXTURE_RECTANGLE_ARB)  before and after every texture-operation. 

Can anybody explain this thing to me shortly?

thanks for reading,

greetings

basti
8  Java Game APIs & Engines / Java 2D / Re: avoid clearing the screen in JComponent on: 2005-11-22 09:13:42
Thank you for the code! It's in general the same procedure as in mine, except for the creation of  the BI ... I'll update my code today and test it.

Greetings

bas
9  Java Game APIs & Engines / Java 2D / Re: avoid clearing the screen in JComponent on: 2005-11-19 20:14:33
No, I only flip the pages when the marker reached the right border of the screen, so the do not overlap at all... is there a "cheaper" way to draw a picture (I mean the BufferedImage i created before) every frame (30ms) than this way:
1  
2  
Graphics2D g2 = (Graphics2D) g;
g2.drawImage(bi,null,0,0);


I don't think it's necessary for me to calcualte the next "pages" in advantage cause it's ok for the app to have some CPU-spikes... what counts is that the steady cpu-consumption is pretty low (mainly because I don't want to hear my notebooks fan Wink ...

PS. I got some really strange behaviour in sense of cpu-usage... when I dispay the first "page" of the waveform it's rather high (near 100%) - when it comes to the second page it's only around 40% ... it raises again when I zoom in the waveform. strange.


greetings

basti

10  Java Game APIs & Engines / Java 2D / Re: avoid clearing the screen in JComponent on: 2005-11-19 02:02:24
You're right, I should give much more information, sorry.  The method redrawAll() checks for changes which make it necessary to redraw the whole image.... if redrawAll()  return false,
paintWave gets the g from the paintComponent and just draws the area round the marker.
The marker travels from left to right, I scroll the waveform page-wise (or if dragged by the user) so I assume that there's not advantage of shifting the old image an draw just the playahead. Hope I described it better this time... even though it's rather late here in germany Wink .
Thanks for your patience!

basti
11  Java Game APIs & Engines / Java 2D / Re: avoid clearing the screen in JComponent on: 2005-11-18 12:49:26
Ok, I just tried your second suggestion (since all my other approaches haven't been successful). It basically works, but it's god-damn slow... maybe I am doing something significantly wrong:
1  
2  
3  
4  
5  
6  
if(redrawAll())
            {
            bi = new BufferedImage(this.getWidth(),this.getHeight(),BufferedImage.TYPE_3BYTE_BGR
            g = bi.getGraphics();
            paintWave(g, offset, samples_per_pixel,0,w,true);
   }


this is called pretty often (something like every 30 ms to get instant feedback).
Maybe there are much better ways to handle this image?

greetings

basti
12  Java Game APIs & Engines / Java 2D / Re: avoid clearing the screen in JComponent on: 2005-11-17 14:33:02
Thanks for the immediate answer.
repaint() is called whenever something in the waveform changed, e.g. widht, height of the window or the region of the waveform to display. Because I'm doing the whole redraw-logic in my paintComponent() (which includes automatic detection of the area which needs a redraw) I want to override the whole swing-stuff. Your idea with image and the blit is nice, but if possible i would prefer my method. I remember this worked in earlier java-versions. I'll continue investigations,

greetings

basti
13  Java Game APIs & Engines / Java 2D / avoid clearing the screen in JComponent on: 2005-11-17 13:18:53
Hi,

I want to draw a custom JComponent (a waveform-display) with a "marker" indicating actual play position,the drawing is performed by an overidden paintComponent(). For performance-reasons i just wanna draw the area around the marker. This works just fine, but since the whole screen is deleted every frame, I just see this small area. I tried setOpaque(false) which should do the trick of not clearing the screen... but this didn't help.
The "old" method of overwriting update(Graphics g) wasn't successful,either.
The JComponent itself is situated on a JPanel.
Anyone here with a smart suggestion Smiley ?

greetings

basti
14  Java Game APIs & Engines / JOGL Development / Re: problem with glOrtho & glViewport on: 2005-08-31 11:26:53
This works just fine, thank you again  Grin

greetings

basti
15  Java Game APIs & Engines / JOGL Development / Re: problem with glOrtho & glViewport on: 2005-08-30 21:26:28
Thanks for the quick answer! I'll try that out later, heading to the club right now  Cool
Hope I'll figure out the math needed to correct the projection matrix. It's fundamental
that the displayed section of the image keeps it size and position when the JFrame is changes size.

greetings

basti
16  Java Game APIs & Engines / JOGL Development / problem with glOrtho & glViewport on: 2005-08-30 20:31:50
Hi there!

As stated in the topic i don't get the whole trick about these two. My aim is to display a rectangular texture with an orthographic projection, which should then be handled like pictues in photoshop for example (e.g. panning, zooming in % and so on). This works particulary with this code:
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
gl.glViewport(0, 0, img_width, img_height);
float zoom_x = zoom_borders_x*(1.0f/zoom);
zoom_x/=2.0f;
float zoom_y = zoom_borders_y*(1.0f/zoom);
zoom_y/=2.0f;
   
gl.glMatrixMode(GL.GL_PROJECTION);
gl.glLoadIdentity();
     
gl.glOrtho(-zoom_x, zoom_x,-zoom_y, zoom_y, .0f, 1000.0);

gl.glMatrixMode(GL.GL_MODELVIEW);
gl.glLoadIdentity();


where zoom_borders_* are initially set to img_height and img_width.
When zoom = 1.0 the displayed texture has exact the size of the image, great.

But now the whole area of the JFrame should be useable, which is not in this case, e.g. when I
pan the image to the right it disappears before the right end of the JFrame cause of the glViewport-setting,
same behaviour when I zoom in....

Anyone got an idea how i could use the whole JFrame without loosing the aspect-ratio and the right pixel-representation (one pixel of the image
= 1 pixel on the screen). I tried it with multiplying the values in glViewport, but this doesn't seem to work correctly Sad

thanks for reading, hope my problem is understandable and maybe solveable

greetings


basti
17  Java Game APIs & Engines / JOGL Development / Re: DebugGL on: 2005-08-23 14:16:05
Thank you! Just figured that out some seconds ago Wink .

greetings

basti
18  Java Game APIs & Engines / JOGL Development / DebugGL on: 2005-08-23 13:48:44
Hi everyone!

I can't get the debug-informations from DebugGL on my console. I added drawable.setGL( new DebugGL(drawable.getGL() )); to my init(), but I can't see anything.
Any help is appreciated,

greetings

bas
19  Java Game APIs & Engines / JOGL Development / Re: Swing and JOGL on: 2005-08-15 22:11:03
Hi!

I'm just testing the use of this nice framework for my "wave-editor"-project for the university, and came across a little problem
which I couldn't solve yet. Whenever I minimize a Dock containing a GLCanvas and maximize it again, the whole content is not displayed,
even though display() is called correctly. The only thing I see is the "frame" of the GLCanvas, in pure white. Anybody who had the same problem?
Thank you for reading.

Greetings


basti
20  Java Game APIs & Engines / JOGL Development / 2d-abstraction-layer with jogl on: 2005-04-07 11:47:06
Hello!

I have to code some sort of paint/waveeditor-application, which uses jogl for zooming and storing the large pictures in the texture memory. My problem now is that I find it pretty difficult to handle the whole 2d-stuff (eg. positioning the image in space, retrieve the position of the playmarker) in the 3d-space. I've read some resources about OpenGl, but I don't get the right direction of how to do such an abstraction-layer, which hides this whole 3d-stuff from me. I hope I succeded in describing my problem. Any help greatly appreciated, my brain won't do this for me right now. And sorry for my english Wink

greetings,

basti
21  Java Game APIs & Engines / JOGL Development / Re: determine if object is on screen on: 2005-03-17 18:22:56
ok, i think picking will do this job... hav a try... Cheesy
22  Java Game APIs & Engines / JOGL Development / determine if object is on screen on: 2005-03-17 08:16:00
Hello!

How can I determine that an object (an "playmarker" represented by an glquad) is still visible or has already left the visible area? My aim is to make some sort of auto-scrolling like in wave-editors; when the marker reaches the right edge, the whole screen (the "camera") should be shifted so that the marker is at the left edge of the screen again. Maybe i am too lazy, but I couldn't find anything here what could help me with this.

thanks for reading (and maybe answering Wink )

basti
23  Java Game APIs & Engines / JOGL Development / Re: I've tried JOGL on: 2005-03-16 06:54:40
What about GL.GL_TEXTURE_RECTANGLE_EXT?
I use this in my app and it works perfectly (except for mipmapping).
The only thing I don't know if this is hardware-accelerated. What is a good way to see if something is done in hard-/software?
24  Java Game APIs & Engines / JOGL Development / Loading of grayscale textures on: 2005-03-04 09:27:27
Hi!

Anybody out there who has got loaded 8-bit grayscale png's as a texture? Which settings should I choose for glTexImage2d and how should I transform the BufferedImage and copy it into ByteBuffer? I've tried some loaders from this forums (the one of big textures thread and some other), but I failed Sad.

cheers

basti
25  Java Game APIs & Engines / JOGL Development / Re: glDeleteTextures() not working... on: 2005-02-18 09:36:36
Ok, i just found the problem Smiley I was to lazy to read the syntax of glDeleteTextures() correctly . You just need to call gl.glDeleteTextures(tmp.length,tmp) once (not in a loop) to delete all textures previously loaded.

greetings

basti
26  Java Game APIs & Engines / JOGL Development / glDeleteTextures() not working... on: 2005-02-17 19:56:52
Hi!
I've got some problems with unbinding my textures:

I splitted up a large image in some small parts for displaying them with OpenGL as textures, works fine for the first loaded picture, but as soon as I load a new one, the old one is still displayed (the GlCanvas is properly refreshed,means I can move the image in space and so on). I try to unbind the textures with      
     
private void deleteTextures(GL gl){
           for(int i = 1;i<tmp.length;i++)
                        {
                 gl.glDeleteTextures(i,tmp);
                        }
}
where tmp is the intarray which holds the texturesnames.
After calling this function I bind the new texture the same way like the previous one, but with the effect described above. Any suggestions what I could have done wrong?

t.i.a.

basti

27  Java Game APIs & Engines / Java Sound & OpenAL / Playing 32bit/96khz data with 44/16 hardware on: 2005-01-30 10:51:30
Hi!
Is it possible to work internally with 32/96 or even higher rates and output to 44/16 soundcards with JavaSound?

Any help appreciated,

greetings

sebastian
28  Java Game APIs & Engines / JOGL Development / Re: Large Texture Handling on: 2005-01-24 09:50:18
thanks alot for this quick and helpful answer! I'm going to write the "texturesplitter" now, the only thing that I worry about is what happens at the edges of textures if i use some anti-aliasing... but I'll see...
big up

basti
29  Java Game APIs & Engines / JOGL Development / Large Texture Handling on: 2005-01-24 08:00:04
Hello everyone!

Today, I've got some more or less theoretical questions. My task is to code an application for displaying and editing large images in strange formats (from 16154*626 pixels to 4039*2501 pixels 8bit greyscale).[ btw.these images are result of gabor-analysis from audio-signals]. I want to do this in OpenGL cause I want to save resources for calculating the analysis.
My first question is :
Does it make sense to use OpenGL for such large images and if yes, how do I organize them in the texture-memory (texture compression)?
2nd :
I probably need to display up to 8 different images of this size in different canvases at the same time. Is this possible with JOGl?
3rd :
I need to handle those images like in photoshop etc. , eg. copy some parts from one to another or paint into the picture "live". Are there any applications which do similar things with OpenGl?

Ok, that was it for now. Any help or suggestion is highly appreciated, have a nice day

big up

basti
30  Game Development / Shared Code / Re: OggInputStream on: 2004-01-09 15:53:06
The only problem was that I've been to silly to get that ogg-stuff working for backgroundmusic Smiley. maybe i should smoke less and learn more...
Pages: [1] 2
 

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

The first screenshot will be displayed as a thumbnail.

trollwarrior1 (32 views)
2014-11-22 12:13:56

xFryIx (73 views)
2014-11-13 12:34:49

digdugdiggy (52 views)
2014-11-12 21:11:50

digdugdiggy (46 views)
2014-11-12 21:10:15

digdugdiggy (40 views)
2014-11-12 21:09:33

kovacsa (64 views)
2014-11-07 19:57:14

TehJavaDev (69 views)
2014-11-03 22:04:50

BurntPizza (67 views)
2014-11-03 18:54:52

moogie (82 views)
2014-11-03 06:22:04

CopyableCougar4 (82 views)
2014-11-01 23:36:41
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!