Java-Gaming.org    
Featured games (81)
games approved by the League of Dukes
Games in Showcase (487)
Games in Android Showcase (110)
games submitted by our members
Games in WIP (553)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  Achieving such effect  (Read 1911 times)
0 Members and 1 Guest are viewing this topic.
Offline Quarry
« Posted 2012-10-21 05:24:32 »

What I got is 2, what I want is 1, how do

Offline Phased
« Reply #1 - Posted 2012-10-21 05:27:25 »

Cant tell the difference? I'm assuming the top one is drawn with some graphic  program. maybe explain more then.

Quote
how do
Offline Quarry
« Reply #2 - Posted 2012-10-21 05:30:55 »

The image got scaled so it might not be clearly visible if that's what you mean

http://user-generated-content.java-gaming.org/img-vault/26e8105fcf41659c1cbb927dd0ff6b8c136093f795fe7d71f3c5ca150cd77a5e.png

However if you are asking how I got the top image, I simply resized the second image down by 2 and then resized it back up

I want to get the pixellation effect of 1
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline DazKins
« Reply #3 - Posted 2012-10-21 06:21:22 »

The pixellation effect of 1 would only have been created when you scaled the image around. If you want to achieve a pixelly 3d style you have two options, use AWT to write out a basic 3D environment using Math, or use some kind of shader in OpenGL to make it look pixelly. Im not entirely sure how you would do that, im not that experienced with GLSL

DazKins

Check out my Dev Blog: http://dazkins.tumblr.com
Offline Quarry
« Reply #4 - Posted 2012-10-21 06:29:00 »

I know what I should be using however I'm not sure how I'll do that
Offline kappa
« League of Dukes »

JGO Kernel


Medals: 76
Projects: 15


★★★★★


« Reply #5 - Posted 2012-10-21 06:42:06 »

A nice simple way to get a pixelated effect is using render to texture (using a Frame Buffer Object or PBuffer). Render to a smaller texture size then the window size and then drawing the texture stretched to the window size (using GL_NEAREST filtering). This should give you a pixelated effect. The smaller the texture the larger the pixels will be.

There is an example on how to Render to Texture on the LWJGL wiki here.
Offline StumpyStrust
« Reply #6 - Posted 2012-10-21 06:51:17 »

kappa you beat me to the punch was a bout to say go for a frame buffer.  Undecided

Offline Quarry
« Reply #7 - Posted 2012-10-21 07:18:22 »

It turned out way too good! Almost exactly the same as my mockup



Anyways, here's the code, I would like to know if I put things in a wrong order or something (the Cube class is simply an utility class for drawing cubes)

http://pastebin.com/FeuymYkg
Offline Danny02
« Reply #8 - Posted 2012-10-21 08:20:49 »

btw, there is no need to draw a fullscreen quad, you can easily copy a framebuffers data to another one(which is handy, because you won't need any shaders for that and probably faster)


requires the framebuffer blit extension
1  
2  
3  
glBindFramebuffer(GL_READ_FRAMEBUFFER, frameBufferID);
glBindFramebuffer(.GL_DRAW_FRAMEBUFFER, 0);//0 is the id of the default framebuffer
glBlitFramebuffer(0, 0, framebufferWidth, framebufferHeight, 0, 0, monitorWidth, monitorHeight, GL_COLOR_BUFFER_BIT, GL_NEAREST);
Offline Quarry
« Reply #9 - Posted 2012-10-21 08:51:41 »

Ooh! That's really neat too
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Quarry
« Reply #10 - Posted 2012-10-21 14:16:27 »

Shameful revival, I recently attempted to rewrite the whole thing to make it look neater

http://pastebin.com/MqKWphyt

However it doesn't seem to work, did I miss something? I did a completion check on it and it all seemed quite fine
Offline Danny02
« Reply #11 - Posted 2012-10-21 17:22:30 »

I think you are doing the blitting wrong, because you bind the default framebuffer as read and write buffer (glBindFramebuffer(GL_FRAMEBUFFER, 0))

what you want to do is only change the write buffer. At the programm start bind your fbo as read an write buffer(with GL_FRAMEBUFFER) and then only change the write buffer with GL_DRAW_FRAMEBUFFER
Offline Quarry
« Reply #12 - Posted 2012-10-21 18:41:55 »

I have no idea how I'm supposed to do that, but I noticed that I didn't set a depth buffer

http://pastebin.com/Eb4cbh7N

Still no luck though
Offline Quarry
« Reply #13 - Posted 2012-10-22 13:55:27 »

1  
2  
3  
4  
5  
6  
7  
   public void renderScaledFBO() {
      glViewport(0, 0, S_WIDTH * S_SCALE, S_HEIGHT * S_SCALE);
      glBindFramebuffer(GL_READ_FRAMEBUFFER, drawFBO);
      glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0);
      glBlitFramebuffer(0, 0, S_WIDTH, S_HEIGHT, 0, 0, S_WIDTH * S_SCALE,
            S_HEIGHT * S_SCALE, GL_COLOR_BUFFER_BIT, GL_NEAREST);
   }


Changed the stuff to what you asked but still no luck
Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

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

The first screenshot will be displayed as a thumbnail.

CopyableCougar4 (23 views)
2014-08-22 19:31:30

atombrot (34 views)
2014-08-19 09:29:53

Tekkerue (30 views)
2014-08-16 06:45:27

Tekkerue (28 views)
2014-08-16 06:22:17

Tekkerue (18 views)
2014-08-16 06:20:21

Tekkerue (27 views)
2014-08-16 06:12:11

Rayexar (65 views)
2014-08-11 02:49:23

BurntPizza (41 views)
2014-08-09 21:09:32

BurntPizza (33 views)
2014-08-08 02:01:56

Norakomi (42 views)
2014-08-06 19:49:38
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

List of Learning Resources
by SilverTiger
2014-07-31 11:54:12

HotSpot Options
by dleskov
2014-07-08 01:59:08
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!