LWJGL - Blurry Images When Rendered

Jan 20, 2014

I wanted to use 16x16 pixel images in my game to make it look more "pixely", but the images get really blurry when they're rendered. How do I make them clearer?

Java Code:

import static org.lwjgl.opengl.GL11.*;
import org.lwjgl.opengl.*;
import org.lwjgl.*;
import org.lwjgl.input.Mouse;
import org.lwjgl.input.Keyboard;
import org.newdawn.slick.opengl.Texture;
import org.newdawn.slick.opengl.TextureLoader;
import java.io.*;
public class Test{
int DISPLAY_WIDTH = 1000, DISPLAY_HEIGHT = 500;

[Code] ....

View Replies


ADVERTISEMENT

JSP :: Navigation System Putting Two Headers In HTML File When Fully Rendered In Browser

Oct 21, 2014

I inherited a navigation system which is like this:

index.jsp
homepage.jsp

When I click on the "view source" in the browser, I get two headers like this:

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html lang="en_US">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<meta http-equiv="X-UA-Compatible" content="IE=edge">

[Code] ....

I know this is not good. I have inherited the nav system from someone else and I have a lot of complicated AJAX and JQuery going on inside my module. I am not sure how to resolve.

View Replies View Related

Putting Images In GUI / Images In Source File Don't Seem To Be Recognized

Jun 7, 2014

This is my class with the GUI:

import java.awt.FlowLayout;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import javax.swing.JFrame;
import javax.swing.JTextField;
import javax.swing.JPasswordField;

[code]....

Eclipse error message:

Exception in thread "main" java.lang.NullPointerException
at javax.swing.ImageIcon.<init>(ImageIcon.java:205)
at GUI.<init>(GUI.java:26)
at Apples.main(Apples.java:7)

i think the problem is to do with my images not being recognised. I put them in my source in User>...>workspace>src which is correct as far as i know. From what i know the images should show up if i look at my src file in eclipse but they dont. I tried changing the file type from .png to .jpg but it makes no difference.

View Replies View Related

LWJGL Keyboard Inputs Not Recognized

May 10, 2014

I wanted to create a simple window with the LWJGL and a key input request which closes the window.I also wanted to create the classes in seperated packages, so it's more organized.The window displays but if I press that certain key nothing happens.Here is the Main class:

package bb.main;
import bb.input.Input;
import bb.main.render.SimpleRenderer;
public class Main {
public static void main(String[] args){
SimpleRenderer createWindow = new SimpleRenderer();
Inputinput= new Input();

[code]....

View Replies View Related

Shadow Mapping Using LWJGL And Shaders

Jun 25, 2014

I'm looking for a working example of shadow mapping with java code using shaders. There are so many c++ or c tutorials out there but i haven't managed to rewrite them since I'm too bad in c/c++. I've been trying to implement this a long time but can't get the hang of it. Any example out there? Preferably as sstripped down as possible except for the shadow mapping.

View Replies View Related

LWJGL - Selecting Specific Region Of Image

Jan 20, 2014

I want to render a specific region of an image in LWJGL,

View Replies View Related

Export Runnable Jar File That Requires LWJGL

Aug 13, 2014

I'm trying to export a runnable jar file that requires lwjgl. Everything works in eclipse as I'm using

-Djava.library.path=nativewindows

as a VM Argument for the jinput .dll files.

After exporting & launching the jar it doesn't work of course! I get this error:

java.lang.UnsatisfiedLinkError: no junput-dx8 in java.library.path

I'm not sure how to make it work outside of eclipse....

View Replies View Related

3D Graphics - Inaccurate Results Using GluLookAt (LWJGL)

Jun 16, 2014

I've recently started programming with lwjgl, playing around with some 3D graphics. I've built a house and now I'm trying to render a view looking straight onto the center of the roof, but with current configuration it's slightly off.

As you can see in the image the edges on the roof aren't perfetly straight which would be the case if I was looking straight to the center from a point on the roof normal vector. I'm using gluLookAt to get the view, using the following code:

gluLookAt(house.getRoofCenter().x + house.getRoofNormal().x * 0.25f,
house.getRoofCenter().y + house.getRoofNormal().y * 0.25f,
house.getRoofCenter().z + house.getRoofNormal().z * 0.25f,
house.getRoofCenter().x, house.getRoofCenter().y, house.getRoofCenter().z, 0.0f, 1.0f, 0.0f);

And for the normals:

Vector3f.sub(p2, p1, a);
Vector3f.sub(p3, p1, B)/>/>/>;
Vector3f.cross(a, b, c);
roofNormal = new Vector3f(-c.x, -c.y, -c.z);

and center:

roofCenter = new Vector3f((p3.x + p1.x) / 2, (p3.y + p1.y) / 2, (p3.z + p1.z) / 2);

My question is: Is this due to errors in the rendering methods or is my math off?

View Replies View Related

LWJGL - Minecraft Clone / Drawing Just ONE Simple Dirt Block

Feb 21, 2015

I am currently working on a Minecraft clone (called "Build"), and I'm trying draw just ONE simple dirt block, but it will only draw a square!

Here is the main class:

package game;
 import game.block.DirtBlock;
 import org.lwjgl.LWJGLException;
import org.lwjgl.opengl.Display;
import org.lwjgl.opengl.DisplayMode;
import org.lwjgl.opengl.GL11;
 
[Code] ....

And the Block class ( the one that all Block Types are based off of):

package game;
 import static org.lwjgl.opengl.GL11.*;
 import java.io.IOException;
import java.nio.FloatBuffer;
 import org.lwjgl.opengl.GL11;
import org.newdawn.slick.opengl.Texture;
import org.newdawn.slick.opengl.TextureLoader;
import org.newdawn.slick.util.ResourceLoader;
 
[Code] ....

And that is the code, I'll make updates as needed.

View Replies View Related

How To Add Images To Program

Dec 14, 2014

I just finished a tutorial on youtube that covers the basic java, and now i want to try and make a game / program thing, only problem is that i have never worked with graphics before (i have tried to make ovals, rectangles, and other things with the paint method tho )

I know how to make a jframe and a jpanel, and i feel like i can make a simple "game" (not a complicated one, just a simple one with a guy walking around on the screen) in fact i have already make a such game, where you are a oval walking around on the screen, so thats not really my problem.

My problem is that i want to draw an image on the screen that can walk around instead of the oval, but how to do that. I have made a new project and set up the jframe and jpanel, and my code looks like this:

(main)

import javax.swing.JFrame;
 public class main_class {
public static void main(String[] args){
 JFrame f = new JFrame();
f.setTitle("title");
f.setVisible(true);
f.setSize(800,600);

[code]...

but once again, i get a blank jframe with no image and no "test" string . How i can display images on the screen?

View Replies View Related

Scaling Images Using JAI

Sep 25, 2014

I have code to convert tiff image to PNG image.I want to scale my PNG image to 800X800 without losing quality.I use the below code but seems doesn't work.Its not resizing the image to specific height and width.

Java Code:

SeekableStream seekableStream = new FileSeekableStream(file);
ImageDecoder imageDecoder = ImageCodec.createImageDecoder(
Constants.TIFF, seekableStream, null);
RenderedImage renderedImage[] = new RenderedImage[imageDecoder
.getNumPages()];
for (int i = 0; i < imageDecoder.getNumPages(); i++) {

[code]...

View Replies View Related

Images Not Loading

Nov 15, 2011

I usually code in PHP, C++ and ActionScript.I'm trying to follow an example of how to add images to a full screen application. What he does is that he adds a JPG background image, and then 4 PNG images. I tried to do it like I always do, by writing the code by myself looking at the book. It didn't work. I searched for errors in the code, changed some things, tried different things, but it didn't work. Then I tried to use his own code, that I downloaded from his website. That didn't work either.. I tried to find another way to add an image, and I can't seem to figure out a way to implement images in any other way into this class that's written in this book.. My Java programming level isn't just high enough.

Here's the code for the file where the images load, downloaded from the authors website (I've modified the brackets and some spaces so that it becomes easier to read):

Java Code:

import java.awt.*;
import javax.swing.ImageIcon;
import javax.swing.JFrame;
public class ImageTest extends JFrame {
public static void main(String[] args) {
DisplayMode displayMode;

[code]....

View Replies View Related

How To Get Images From Jsoup

May 12, 2014

I know how to get the link for the GIF but how do I get the image and use it in java?

View Replies View Related

Changing JPG DPI Value For Some Images

Sep 25, 2014

I am currently working on Java software which resize jpeg images and change DPI also. For JPEG images having app0JFIF node it works fine and the images new DPI is reflected in Photoshop. But if app0JFIF node not exist, I am trying to create a new one and set the DPI value there. Everything is going proper but if I open these images in photoshop it does not reflect new DPI but the size changes.

Java Code:

double dpi_in_inch = 0.393701 * newres;
File file1 = new File(imgName);
image = ImageIO.read(file1);
int wd, hi;
wd = (int) (newsize * dpi_in_inch);

[Code] ...

View Replies View Related

Using Images As Buttons In Processing

May 5, 2015

I'm just wondering whether it is possible to use images as a button in Java. I have two images that I want to use to create a rollover effect, is this possible? And then I would like to reset my java program when the button is clicked, is this also possible?

View Replies View Related

Error When Adding Images?

Jan 16, 2014

I have been trying my hand at making 2d top down view games and have found myself repeatedly using the same code so i created a file with all the functions so when it is down i just import the jar and dont have to keep rewriting functions. I have trouble because the background is loaded on the screen and i dont know why as i didn't tell it to load. In fact I set the panels visiblity to false. Both of my classes are in the same package. Why I still get the Image.

Walking Turtle
Java Code: import javax.swing.*;
import java.awt.event.*;
public class turtleWalker extends JFrame{
public static void main(String[] args){
JFrame frame = new JFrame("Walking Turtle");

[code]....

View Replies View Related

How To Import Many Images Into Array

Feb 24, 2015

I am still playing around with decks of cards, and am now trying to implement some visualizations using Applets.

Here is how I enter my deck of cards into an array list: this works just fine:
 
String[] Suits = new String[]{"S","H","D","C"};
String[] Values = new String[]{"A","2","3","4","5","6","7","8","9","10","J","Q","K"};
ArrayList<String> deck = new ArrayList<String>();
for(String suit : Suits) {
for(String value : Values) {
deck.add(suit+"_"+value);
}
}

The end result of this is an array 'deck' which contains a string representing each of the 52 playing cards. Great.

Now I would also like to use some pictures for future implementations I am working on. I have 52 images (.png, though I doubt it matters) stored in the right place. They are named as "H_5.png", and "S_A.png", for example, just as I named the cards in the previous array. I would like to do something as follows

ArrayList<Image> deckpic = new ArrayList<Image>();
for(String suit : Suits) {
for(String value : Values) {
deckpic.add(getImage(suit+"_"+value+".png"));
}
}

Now of course this doesn't work. The line

suit+"_"+value+".png"

is a string, not the name of a file. How I have previously loaded images is to use something like this:

the_pic = getImage("picture_of_pony.jpg");

but of course I can't use the quotations in my card loop, since I want "suit" and "value" to range and not just be the strings suit and value.

View Replies View Related

Images Not Displaying Properly

Nov 16, 2014

My code:

import javax.imageio.ImageIO;
import javax.swing.*;
import java.io.*;
import java.awt.*;
import java.lang.*;
import java.awt.image.*;
import java.net.URLDecoder;

[Code] .....

I my images (including the one I created) are all 32x32. I'm trying to get a player Icon and have them be on a field of grass. Currently, I just get:

(see Attached)

I don't know where my Images are rendering.

B = blank
. = grass
p = player

.
.
.
.
. p
.
.
b

View Replies View Related

How To Use Images As Backgrounds For JPanel

May 20, 2014

I am trying to use images as my backgrounds for my JPanel.the problem is when I run the program the images don't show at first.T hey start to show after I have switched to another panel and then switch back. Here are my codes

//for loading image
static public Image LoadIcon(String file) {
URL icoURL = windows.class.getResource(file);
Image img = Toolkit.getDefaultToolkit().createImage(icoURL);
return img;

[Code] ......

View Replies View Related

Using Images In JLabel And JPanel

Sep 26, 2014

I read many posts online and watched tutorials on YouTube. I can't seem to get this work. Notice I am not using any drawing/graphics capabilities - I'd like to keep it this way as we have not gotten that far yet in my studies.The image is in a source folder titled Images under/in my project.

Java Code:

private JPanel jpImage = new JPanel();
private JLabel lblImage;
private ImageIcon image;
private Image img;
// All those above defined prior to method
// Within method (relevant to code above) ...

[code]....

View Replies View Related

Why Images In Applet Not Showing

Aug 30, 2014

So I am trying to make this java applet that will display a random image of three that is a sub folder of my src folder within my project.

When you run the project currently all you get is a white applet. Here is the code:

import java.applet.Applet;
import java. awt.*;
 public class myPictures extends Applet {
Image action;
public void paint(Graphics g){
int rint = (int)(Math.random() * 3);
if(rint == 0){
action = getImage(getDocumentBase(), "../../images/bee3.jpg");
} else if(rint == 1){
action = getImage(getDocumentBase(), "../../images/bee1.jpg");
} else {
action = getImage(getDocumentBase(), "../../images/bee2.jpg");
} } }

View Replies View Related

Background Overlapping Images

Jan 7, 2014

Java Code:

import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
public class sample{
public static void main(String args[]){
JFrame frame = new JFrame();
frame.setSize(300,300);

[code]....

To limit the amount of drawing done i want unmoving objects to be painted once. So i set a boolean. When it first load the boolean is false so it draws then after first draw i never want it to draw the objects agian but leave them on the screen. Now in this if you run it you get a black screen.

If you didnt have the "getContentPane().setBackground(Color.black)" it would work fine and show a blue brick. Is there something I don't understand about the setBackgound Function that makes it automatically redone even when not called? and if so how do i overwrite this?

View Replies View Related

Application For Images Duel

May 20, 2014

I need to make android app for image comparison. It has to show two images and user will choose which image he prefer by using radio button . After clicking one radio button app should save the result of a duel and show another pair of images.

If there is N images it will be ((n*n)-n)/2 duels. I think of something like this - [URL] .... but instead of 2 radio buttons it will be 9 - 4 for each image (depending on preference) and 1 neutral button(no preference).

How to achieve that. I started using java and eclipse recently only so it is all new to me. I made an activity in xml so far and I tried to make class for changing imageview 1 and 2 assuming that all images will be named a1,a2,a3 .

package com.example.ahp;
import android.support.v7.app.ActionBarActivity;
import android.support.v7.app.ActionBar;
import android.support.v4.app.Fragment;
import android.os.Bundle;
import android.view.LayoutInflater;

[code]....

View Replies View Related

Swing/AWT/SWT :: How To Develop Carousel For Images

Nov 6, 2014

how to develop carousel for images using java swing

View Replies View Related

Best Way To Deploy App With HTML And Images Files?

Feb 3, 2015

You basically paste a url Into a textarea and choose an Image for the link.The Image link Is then appended to a html file.

I'd like to put everything In a single jar file but I'm not sure what to do so the user can access the html file.

The only two options I can think of are:

a) create the html document on the fly when the jar runs.

b) Is to run a bat command when the jar Is executed that will extract the jar files.

The user can either choose from a number of Images In the logos folder for common websites or add new Images. Since the folder isn't empty , It seems like extracting the jar files Is necessary.

View Replies View Related

Swing/AWT/SWT :: Why Delays In Drawing Images

Jun 17, 2014

I have a question about the execution of code to draw images relative to code that comes after that. I don't normally do this sort of thinghere's the problematic code:

int stn = 0;
while (stn < 10)
{
glb1.xOfText += 20;
glb1.yOfText += 20;
gc1.drawImage(glb1.img1 , glb1.xOfText , glb1.yOfText);
TimeKeeper.pause(500);
stn++;
}

Where glb1 is a final reference to an object that holds common data for the game.while its x and y values say they are for text, they are also used for image placement (at least during this testing phase.)

gc1 is the "graphics context" of the canvas that the images are being drawn on.

The person who wrote this said, "When the attached code is run, the calls to TimeKeeper.pause(500), which in turn call Thread.sleep(500), are all executed in row, and then the results of drawing the image 10 times is displayed. (I know because some of the previous image pastes left some visual data behind.)"

I recall from reading about drawing graphics (a long time ago) that drawImage() could take time, but I don't know why the thread does not indeed sleep between calls to drawImage().

View Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved