Loading image/Texture Mapping in LWJGL

box

Hola everyone.

I am currently working on my own two game projects: one project is of mobile phone game and other is 2.5 or side-scrolling 3d game, not much sure. So for second project i am making an small engine that will be used to make 2.5D game or side scrolling 3d game, Just simple and fun game. I have chosen LWJGL, which is a java binding for Opengl to make my game. So first thing i need to work on loading images.texture mapping in lwjgl. I found some pretty much useful tutorials and great help from lwjgl forums. But atlast i got something that i was looking for from the forum.

I came to know about slick-util which is free and open source lib to load images and play sounds. Its very easy to pick up and implement it. Its just worked flawlessly and smoothly for me. You can download the slick-util from here. PNG, GIF, JPG, TGA are supported and WAV, OGG, XM sounds are supported by slick-util.

So here i’l show u how easily i loaded images and mapped to a 3D BOX. First u have to setup lwjgl and slick-util with netbeans. Yeah i am using netbeans to write my program. You can see my post to setup lwjgl with netbeans. Now we will set up slick-util, its a continuation to the steps that we did to setup lwjgl.

Continued…

Step 1: We just have to configure the project properties so that project can find the lib to compile and run.

1

2

Ok that was it. Now slick-util lib has been set up.Now first i’l show u how to load image and bind it , full source will be at the end.

Texture texture;

Texture is an interface having description of texture which will be loaded.

texture = TextureLoader.getTexture(“PNG”, new FileInputStream(“Data/Crate.png”));

now we are loading the texture using TextureLoader utility class. Just smooth and simple.

texture.bind();

Now we are binding the texture.

So thats what u need to load the image and map them to objects. Download this image to use it in this program.

Crate

Full Code:

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.gaanza.engine.test2;

import java.io.FileInputStream;
import java.io.IOException;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.lwjgl.LWJGLException;
import org.lwjgl.Sys;
import org.lwjgl.opengl.Display;
import org.lwjgl.opengl.DisplayMode;
import org.lwjgl.opengl.GL11;
import org.lwjgl.util.glu.GLU;
import org.newdawn.slick.opengl.Texture;
import org.newdawn.slick.opengl.TextureLoader;

/**
 *
 * @author Java Guy
 */

public class EngineTest {

    private static boolean gameRunning=true;
    private static int targetWidth = 800;
    private static int targetHeight = 600;

    private float xrot=0.1f;
    private float yrot=0.1f;
    private float zrot=0.1f;

    /** The texture that’s been loaded */
        private Texture texture;

    public static void main(String[] args){
        EngineTest app=new EngineTest();
        initDisplay(false);
        initGL();
        app.init();
        app.run();
    }

    private static void initDisplay(boolean fullscreen){

        DisplayMode chosenMode = null;

        try {
                DisplayMode[] modes = Display.getAvailableDisplayModes();

                for (int i=0;i<modes.length;i++) {
                    if ((modes[i].getWidth() == targetWidth) && (modes[i].getHeight() == targetHeight)) {
                        chosenMode = modes[i];
                        break;
                    }
                }
            } catch (LWJGLException e) {
        Sys.alert(“Error”, “Unable to determine display modes.”);
        System.exit(0);
    }

        // at this point if we have no mode there was no appropriate, let the user know
    // and give up
        if (chosenMode == null) {
            Sys.alert(“Error”, “Unable to find appropriate display mode.”);
            System.exit(0);
        }

        try {
            Display.setDisplayMode(chosenMode);
            Display.setFullscreen(fullscreen);
            Display.setTitle(“LWJGL window”);
            Display.create();
        }
        catch (LWJGLException e) {
            Sys.alert(“Error”,“Unable to create display.”);
            System.exit(0);
        }

}

    private static boolean initGL(){
        GL11.glMatrixMode(GL11.GL_PROJECTION);
        GL11.glLoadIdentity();

//        Calculate the aspect ratio of the window
        GLU.gluPerspective(45.0f,((float)targetWidth)/((float)targetHeight),0.1f,100.0f);
        GL11.glMatrixMode(GL11.GL_MODELVIEW);
        GL11.glLoadIdentity();

        GL11.glEnable(GL11.GL_TEXTURE_2D);                                    // Enable Texture Mapping ( NEW )
        GL11.glShadeModel(GL11.GL_SMOOTH);
        GL11.glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
        GL11.glClearDepth(1.0f);
        GL11.glEnable(GL11.GL_DEPTH_TEST);
        GL11.glDepthFunc(GL11.GL_LEQUAL);
        GL11.glHint(GL11.GL_PERSPECTIVE_CORRECTION_HINT, GL11.GL_NICEST);
        return true;
    }

    private void init(){
        try {
            texture = TextureLoader.getTexture(“PNG”, new FileInputStream(“Data/grass.png”));
        } catch (IOException ex) {
            Logger.getLogger(EngineTest.class.getName()).log(Level.SEVERE, null, ex);
        }
    }

    private void run(){
        while(gameRunning){
            update();
            render();
            Display.update();

            // finally check if the user has requested that the display be
            // shutdown
            if (Display.isCloseRequested()) {
                    gameRunning = false;
                    Display.destroy();
                    System.exit(0);
                }
            }
    }

    private void update(){
        xrot+=0.1f;
        yrot+=0.1f;
        zrot+=0.1f;
    }

    private void render(){
        GL11.glClear(GL11.GL_COLOR_BUFFER_BIT|GL11.GL_DEPTH_BUFFER_BIT);
        GL11.glLoadIdentity();

        GL11.glTranslatef(0.0f,0.0f,-5.0f);                              // Move Into The Screen 5 Units
        GL11.glRotatef(xrot,1.0f,0.0f,0.0f);                        // Rotate On The X Axis
                GL11.glRotatef(yrot,0.0f,1.0f,0.0f);                        // Rotate On The Y Axis
                GL11.glRotatef(zrot,0.0f,0.0f,1.0f);                        // Rotate On The Z Axis

        texture.bind(); // or GL11.glBind(texture.getTextureID());

        GL11.glBegin(GL11.GL_QUADS);

                // Front Face
                GL11.glTexCoord2f(0.0f, 0.0f);
                GL11.glVertex3f(-1.0f, -1.0f,  1.0f);   // Bottom Left Of The Texture and Quad
                GL11.glTexCoord2f(1.0f, 0.0f);
                GL11.glVertex3f( 1.0f, -1.0f,  1.0f);   // Bottom Right Of The Texture and Quad
                GL11.glTexCoord2f(1.0f, 1.0f);
                GL11.glVertex3f( 1.0f,  1.0f,  1.0f);   // Top Right Of The Texture and Quad
                GL11.glTexCoord2f(0.0f, 1.0f);
                GL11.glVertex3f(-1.0f,  1.0f,  1.0f);   // Top Left Of The Texture and Quad

                // Back Face
                GL11.glTexCoord2f(1.0f, 0.0f);
                GL11.glVertex3f(-1.0f, -1.0f, -1.0f);   // Bottom Right Of The Texture and Quad
                GL11.glTexCoord2f(1.0f, 1.0f);
                GL11.glVertex3f(-1.0f,  1.0f, -1.0f);   // Top Right Of The Texture and Quad
                GL11.glTexCoord2f(0.0f, 1.0f);
                GL11.glVertex3f( 1.0f,  1.0f, -1.0f);   // Top Left Of The Texture and Quad
                GL11.glTexCoord2f(0.0f, 0.0f);
                GL11.glVertex3f( 1.0f, -1.0f, -1.0f);   // Bottom Left Of The Texture and Quad

                // Top Face
                GL11.glTexCoord2f(0.0f, 1.0f);
                GL11.glVertex3f(-1.0f,  1.0f, -1.0f);   // Top Left Of The Texture and Quad
                GL11.glTexCoord2f(0.0f, 0.0f);
                GL11.glVertex3f(-1.0f,  1.0f,  1.0f);   // Bottom Left Of The Texture and Quad
                GL11.glTexCoord2f(1.0f, 0.0f);
                GL11.glVertex3f( 1.0f,  1.0f,  1.0f);   // Bottom Right Of The Texture and Quad
                GL11.glTexCoord2f(1.0f, 1.0f);
                GL11.glVertex3f( 1.0f,  1.0f, -1.0f);   // Top Right Of The Texture and Quad

                // Bottom Face
                GL11.glTexCoord2f(1.0f, 1.0f);
                GL11.glVertex3f(-1.0f, -1.0f, -1.0f);   // Top Right Of The Texture and Quad
                GL11.glTexCoord2f(0.0f, 1.0f);
                GL11.glVertex3f( 1.0f, -1.0f, -1.0f);   // Top Left Of The Texture and Quad
                GL11.glTexCoord2f(0.0f, 0.0f);
                GL11.glVertex3f( 1.0f, -1.0f,  1.0f);   // Bottom Left Of The Texture and Quad
                GL11.glTexCoord2f(1.0f, 0.0f);
                GL11.glVertex3f(-1.0f, -1.0f,  1.0f);   // Bottom Right Of The Texture and Quad

                // Right face
                GL11.glTexCoord2f(1.0f, 0.0f);
                GL11.glVertex3f( 1.0f, -1.0f, -1.0f);   // Bottom Right Of The Texture and Quad
                GL11.glTexCoord2f(1.0f, 1.0f);
                GL11.glVertex3f( 1.0f,  1.0f, -1.0f);   // Top Right Of The Texture and Quad
                GL11.glTexCoord2f(0.0f, 1.0f);
                GL11.glVertex3f( 1.0f,  1.0f,  1.0f);   // Top Left Of The Texture and Quad
                GL11.glTexCoord2f(0.0f, 0.0f);
                GL11.glVertex3f( 1.0f, -1.0f,  1.0f);   // Bottom Left Of The Texture and Quad

                // Left Face
                GL11.glTexCoord2f(0.0f, 0.0f);
                GL11.glVertex3f(-1.0f, -1.0f, -1.0f);   // Bottom Left Of The Texture and Quad
                GL11.glTexCoord2f(1.0f, 0.0f);
                GL11.glVertex3f(-1.0f, -1.0f,  1.0f);   // Bottom Right Of The Texture and Quad
                GL11.glTexCoord2f(1.0f, 1.0f);
                GL11.glVertex3f(-1.0f,  1.0f,  1.0f);   // Top Right Of The Texture and Quad
                GL11.glTexCoord2f(0.0f, 1.0f);
                GL11.glVertex3f(-1.0f,  1.0f, -1.0f);   // Top Left Of The Texture and Quad
        GL11.glEnd();
    }
}

Gracias.

Posted in Tutorials, developer, java, opengl | Tagged , , , | Leave a comment

Diving into Mobile Gaming !!

Recently my friends suggested me to make games for mobile phones. I haven’t done any formal course for mobile programming so i did a some search on mobile game development on google and gone through some articles like The Clash of Mobile Platforms: J2ME, ExEn, Mophun and WGE

I have a Nokia N70ME handset and most of my friends have same kinda(specifications) handset. All of them are java enabled. I did a search on their specifications and found that almost all were midp 2.0 enabled. After doing some research on mobile gaming i chose J2ME for developing mobile games because majority of the phones of my target audience are java-enabled so i can reach to masses. Secondly, SUN provides you all the development tools for free. And thirdly i am more comfortable in java programming language so it would be easier for me to pick up things more fast and easily. So i am using netbeans IDE 6.7 with the mobility pack to write my app and its pretty productive and reliable. My next step was to find some good online tutorial to just get started, all basic things. I searched the google and found many useful stuff there:

http://developers.sun.com/mobility/midp/articles/gameapi/

http://developers.sun.com/mobility/midp/articles/game/

http://today.java.net/pub/a/today/2005/07/07/j2me3.html

http://www.devx.com/wireless/Article/27167/1954

So i got many stuffs to get started making midp 2.0 games. It didn’t take too much time to pick up things. I got the concepts easily and started implementing them. I just started with testing codes like drawing images, moving them, rotation etc. After testing all those codes i decided to make very simple 2d side scrolling game. Then i searched for some free sprites on google and got some stuffs on world war 2 theme. Then i asked my friend to make some background images for me and he made some pretty good backgrounds. So then i was off to fly and started making the game.

This is my current progress on game and i am pretty sure that soon i’ll complete the game and upload here for the download.

jungleMobile

This is my mobile game project that i am working. Soon i’l finish it. And important thing is that i am enjoying very much making game for mobile phones. I tested it on my Nokia N70 handset and it worked flawlessly. I am very excited regarding this project.

Gracias.

Posted in developer, games, java | Tagged , , | Leave a comment

Setting Up LWJGL with Netbeans

On Forums, people keeps asking about setting up lwjgl library with netbeans. So here i am going to show the steps to do that.

STEP 1: Go to Tools-> Libariries.Now create new library. Give it a name say “lwjgl21″.

step1

STEP 2: Now we have to configure the library. Click the classpath tab, then click add jars, and add all the jars shown below:

step2

STEP 3: If u want to add java doc than click the javadoc tab, and then add the javadoc folder. Then finally click oK and lwjgl21 library that we have just created is done.

STEP 4: Now create a empty java project.

step3

STEP 5: Now we have to set the properties so that our newly created project can find the lwjgl library and jar files. So Right-Click the project-> Properties. Now check the image carefully and configure accordingly. So first select libraries on the categories section and then click compile tab, and then add jar file for compilation step. This step is very important so check image properly below.

step4

STEP 6: Okie now click run tab, and add the library that we had just created. Check the image very properly.

step5

STEP 7: Now the final step. We have to provide the argument so that project cud find the necessary dll files. So first select the Run at caregories section then go to vm-options. Check the image properly and follow.

step6

Okie thats it. Now click ok. So you have just set up lwjgl with your netbeans ide. So now you can compile and run your lwjgl app. I am using netbeans ide 6.7.

Gracias

Posted in Tools, Tutorials, developer, java, opengl | Tagged , , | 1 Comment

Game Engines: A Quick Peek

Game Engines are the core libraries which is used as the architecture to develop the game. It cuts down the pressure on development teams as all the complex coding is already written in the engine. The core functions that Game Engine provides are rendering(2d or 3d), physics engine or collision detection, sound, scripting, artificial intelligence. They provide all the core functionalities needed to develop a game while reducing the costs, complexities and time.

There are libraries that are developed to provide only one specific functions, called Middleware. Like Havok is a middleware which offers developers the foundation for creating realistic physics simulation.

Developers  license the engines like id tech, unreal to develop their titles. Some developers use their in-house proprietry engines created by themselves for their own titles. And their are also some free open source engines out there like OGRE, JMonkeyEngine.

Now i’ll discuss about some very well known Game Engines, Middleware And Engines used in making next-gen games.

Unreal Engine:

Unreal is a game engine developed by Epic Games. The games made by this engine are Gears of War franchise, Bioshock, splintercell, MassEffect and many other. This Engine has won the Game Developer’s Front Line awards in engine category for three consecutive awards. This Engine is Game Developer’s Front Line Awards 2008 Hall Of Fame winner. You can read Why Unreal Engine was the Hall Of Fame Winner.

gears2vid01

Gears of War 2 made with Unreal engine

Havok

Havok is a physics engine developed by Havok. Havok offers developers the foundation for creating realistic physics simulation through efficient and optimized calculation. The Titles that used Havok engine are Crackdown, Assassin’s creed, F.E.A.R 2:Project Origin, Fallout 3, Halo 3 and many more. Havok won the Game Developer’s Front Line Awards 2008 in Middleware category. Read why Havok won the award ?.

company-of-heroes

Company of Heroes using Havok engine

cryEngine

Developed by CryTek is the force behind those killer graphics of crysis. They set a new standard for visuals. CryTek released a GDC demonstration movie for their latest all-in-one game development solution using cryEngine 3, premiered at GDC 2009 in san fransisco. cryEngine 3 is the first development platform for Xbox 360, Playstation 3, MMO, DX9/DX10 and includes cryEngine 3 Sandbox level editor and “What you see is what you play” tool designed for professional developers. 3 comes with significant feartures for consoles and next-gen game development.

crysis

crysis made with cryEngine

R.A.G.E (Rockstar Advanced Game Engine)

R.A.G.E is a game engine developed by a team called “Rage Technology Group” at Rockstar san diego. Rockstar has integrated a few third party middleware like euphoria character animation engine and Bullet physics engine. GTA4 was developed with this cool engine. Rockstar are working on a game Red Dead Redemption which uses R.A.G.E engine. The trailer of Read dead Redemption looks really cool with realistic horses, towns, prairies….with ralistic weather. R.A.G.E engine provides functionalities to handle realistic weather effects, complex A.I, large worlds..etc

Check this video of Red Dead Redemption, its jusshows you what R.A.G.E is capable of doing.

gta4

Grand Theft Auto 4 made with R.A.G.E engine

Naughty Dog Game Engine

This Engine is developed by Naughty Dog. This year naughty Dog showcased their upcoming title Uncharted 2 at sony playstation 3 conference, E3 2009 . I was awestruck by watching the trailer and demo. I had never seen such a cinematic game(demo) before, graphics looked so awesome and cool. Naughty Dog with Uncharted 2 really showed the world what Ps3 is capable to do. So i would say Naughty Dog maxed out the Ps3 with Uncharted 2. The demo showcased realistic environments, smooth animation-interaction, cinematic feel with cinematic camera work :D …seamless transition between cinematic and gameplay.

So there are other engines also that i haven’t mentioned like Valve’s Source engine which gave titles like half-life franchise, left 4 dead, Infinity Ward’s IW engine which gave Call Of Duty franchise(not all sequels), Ubisoft’s Anvil engine which was used for Assassin’s creed….and many more engines. I have just  quickly looked at just some good engines that took my interest. This post is not on best engines but tells about good engines.

Gracias.

Posted in consoles, developer, games | Tagged | Leave a comment

My Experience with Xbox 360 and PS3

consoles

Hola everyone.

I have seen many gamers on forums discussing on the debate: Xbox 360 vs PS3. Half section of gamers says Xbox 360 is best and other half says PS3 is superior and debate goes on and on. Many newbies gets confused and they do not know which consoles to buy.

I don’t have any of the consoles at my home. I have 2 friends, one of whom has got xbox 360 and other has got both 360 and ps3. So i just visit their places frequently to play games and experience the gaming on both consoles. So here i am going to share my experience with both consoles.

Before sharing my experience, i want the readers to know that this post is not on the debate: Xbox 360 vs PS3. This is post reflects just my experience so don’t make any issues with it. :D

So first i will give u a glance on inside the two consoles that run these amazing game titles:

PS3:

a) Seven Single Threaded Processors (3.2 GHz)

b) One Multi-Threaded cell processor (3.2 GHz)

c) Nvidia ‘RSX’ custom made graphic processor

Xbox 360:

a) Triple-Dual threaded core Xenon Processor (3.2 GHz)

b) ATI ‘Xenon’ GPU

That was the inside configuration of both systems.

I am not a fan of either consoles. I am a gamer and i love to play and enjoy games.

Many gamer says that they have played specific game titles on both consoles and they found Xbox 360 version better and superior than PS3’s for example: GTA 4. But i would like to mention that almost all multi-platform titles like GTA 4, Assasin’s creed..etc are a 360 to PS3 port, so these games may not look better on PS3 and look good in Xbox 360. Like GTA 4 is a 360 to PS3 port, so developers had to cut some corners in order to ship the title on market in time. So i would say if time and money was there then the games would have been absolutely identical.

Gears Of War was an amazing title which is a 360 exclusive title. I am a big big fan of gears of war franchise and i still play it with my friends on split-screen mode on his xbox system and i never get bored. But but i and ofcourse you will notice that the game was short because xbox 360 only had dual layer dvd to work with, whereas PS3 has more disc space to work with to make bigger and better games. When KillZone 2 came out, it had an amazing graphics and i noticed that PS3 totally outperformed 360. Uncharted was also amazing cinematic game. Killzone 2 is one of the best fps games that i have played. :D

gear_uncharted

I love Xbox live. The interface is excellent and interaction between player is damn awesome and feature like achievements is also cool. I liked Xbox live more the way than PSN. In PSN i cannont send message to my friend from within the game. I didn’t get the facility of voice chatting on PSN. On Xbox live i can reach my friends right away in a single button press, send them voice/text message and invite my friend to the server where i am playing. Xbox live is just very very cool. But PSN is free for most part and for Xbox live u have to subscribe dollars $$$ :D But i am really cool with Xbox live, its just very cool than PSN. :D

xbox_psn

Putting Games on side for the moment and talking about movies than thumbs UP to PS3. PS3 is undoubtely the superior movie player with its integrated Blu-Ray technology. It has also got amazing sound quality. So i would say here Ps3 is far more better than Xbox 360.

blu-ray-logo-400

Xbox 360 makes a annoying background sound which really annoys me while watching the movie. PS3 is quiet during the movie on.

One thing that my friend and i like is Xbox live arcade that provides variety of arcade games than PSN provides.

In past Xbox 360 had a good line-up of exclusive games than Ps3 had. In 2007 Xbox had exclusive hit titles like Halo 3, BioShock and Mass Effect, whereas PS3 had titles like Uncharted, ratchet and clank future:tools of destruction. Many gamers said that PS3 didn’t have good varied exclusive titles. But 2008 was the PS3’s years as they had the best game line up with titles like Metal Gear Solid 4, Resistance 2 and Litle Big Planet wheras 360 had a nice titles like Gears Of War 2. So varied of good games is no longer an issues for PS3 as it was in past.

Well this was my experience till now, but there is more to experience. There is so much tight competition between the consoles. Each console has their advantages and disadvantages. I enjoy both system.

Gracias.

Posted in consoles | Tagged , | 1 Comment

List Of Good OpenGL and (ES) Books

These are the list of some popular books on OpenGl and (ES) preffered by many.

OpenGl SuperBible Fourth Edition

It begins by illuminating the core techniques of “classic” opengl programming, from drawing in space to geometric transformations, from lighting to texture mapping. The authors covers newer OpenGL capabilities, including OpenGL 2.1’s powerful programmable pipeline, vertex and fragment shaders, and advanced buffers. They also present thorough, up-to-date inroduction to opengl implementation on openl platforms, including windows,mac,linux and embedded systems.
Cove
rage includes

·         An entirely new chapter on OpenGL ES programming for handhelds

·         Completely rewritten chapters on OpenGL for Mac OS X and GNU/Linux

·         Up-to-the-minute coverage of OpenGL on Windows Vista

·         New material on floating-point color buffers and off-screen rendering

·         In-depth introductions to 3D modeling and object composition

·         Expert techniques for utilizing OpenGL’s programmable shading language

·         Thorough coverage of curves, surfaces, interactive graphics, textures, shadows, and much more

·         A fully updated API reference, and an all-new section of full-color images

superbible

The OpenGl Programming Guide: The Official Guide to Learning OpenGl Version 2.1

The OpenGL® Programming Guide, Sixth Edition, provides definitive and comprehensive information on OpenGL and the OpenGL Utility Library. The previous edition covered OpenGL through Version 2.0. This sixth edition of the best-selling “red book” describes the latest features of OpenGL Version 2.1. You will find clear explanations of OpenGL functionality and many basic computer graphics techniques, such as building and rendering 3D models; interactively viewing objects from different perspective points; and using shading, lighting, and texturing effects for greater realism. In addition, this book provides in-depth coverage of advanced techniques, including texture mapping, antialiasing, fog and atmospheric effects, NURBS, image processing, and more. The text also explores other key topics such as enhancing performance, OpenGL extensions, and cross-platform techniques.

This sixth edition has been updated to include the newest features of OpenGL Version 2.1, including:

  • Using server-side pixel buffer objects for fast pixel rectangle download and retrieval
  • Discussion of the sRGB texture format
  • Expanded discussion of the OpenGL Shading Language

This edition continues the discussion of the OpenGL Shading Language (GLSL) and explains the mechanics of using this language to create complex graphics effects and boost the computational power of OpenGL.

The OpenGL Technical Library provides tutorial and reference books for OpenGL. The Library enables programmers to gain a practical understanding of OpenGL and shows them how to unlock its full potential. Originally developed by SGI, the Library continues to evolve under the auspices of the OpenGL Architecture Review Board (ARB) Steering Group (now part of the Khronos Group), an industry consortium responsible for guiding the evolution of OpenGL and related technologies.

redbook

OpenGL Shading Language 2nd Edition

OpenGL® Shading Language, Second Edition, includes updated descriptions for the language and all the GLSL entry points added to OpenGL 2.0; new chapters that discuss lighting, shadows, and surface characteristics; and an under-the-hood look at the implementation of RealWorldz, the most ambitious GLSL application to date. The second edition also features 18 extensive new examples of shaders and their underlying algorithms, including

  • Image-based lighting

  • Lighting with spherical harmonics

  • Ambient occlusion

  • Shadow mapping

  • Volume shadows using deferred lighting

  • Ward’s BRDF model

The color plate section illustrates the power and sophistication of the OpenGL Shading Language. The API Function Reference at the end of the book is an excellent guide to the API entry points that support the OpenGLShading Language. Also included is a convenient Quick Reference Card to GLSL.

shading

OpenGL ES 2.0 Programming Guide

In the OpenGL® ES 2.0 Programming Guide, three leading authorities on the Open GL ES 2.0 interface—including the specification’s editor—provide start-to-finish guidance for maximizing the interface’s value in a wide range of high-performance applications. The authors cover the entire API, including Khronos-ratified extensions. Using detailed C-based code examples, they demonstrate how to set up and program every aspect of the graphics pipeline. You’ll move from introductory techniques all the way to advanced per-pixel lighting, particle systems, and performance optimization.

Coverage includes:

  • Shaders in depth: creating shader objects, compiling shaders, checking for compile errors, attaching shader objects to program objects, and linking final program objects

  • The OpenGL ES Shading Language: variables, types, constructors, structures, arrays, attributes, uniforms, varyings, precision qualifiers, and invariance

  • Inputting geometry into the graphics pipeline, and assembling geometry into primitives

  • Vertex shaders, their special variables, and their use in per-vertex lighting, skinning, and other applications

  • Using fragment shaders—including examples of multitexturing, fog, alpha test, and user clip planes

  • Fragment operations: scissor test, stencil test, depth test, multisampling, blending, and dithering

  • Advanced rendering: per-pixel lighting with normal maps, environment mapping, particle systems, image post-processing, and projective texturing

  • Real-world programming challenges: platform diversity, C++ portability, OpenKODE, and platform-specific shader binaries

    es2.0

OpenGL Distilled

OpenGL® Distilled provides the fundamental information you need to start programming 3D graphics, from setting up an OpenGL development environment to creating realistic textures and shadows. Written in an engaging, easy-to-follow style, this book makes it easy to find the information you’re looking for. You’ll quickly learn the essential and most-often-used features of OpenGL 2.0, along with the best coding practices and troubleshooting tips.

Topics include

  • Drawing and rendering geometric data such as points, lines, and polygons

  • Controlling color and lighting to create elegant graphics

  • Creating and orienting views

  • Increasing image realism with texture mapping and shadows

  • Improving rendering performance

Preserving graphics integrity across platforms

distilled

Gracias

Posted in books, developer, opengl | Tagged | Leave a comment

List Of OpenGL Based Games

These are the list of some top opengl based commercial games:

Call Of Duty 1

This game was developed by Infinity Ward and published by Activision. This game used the id tech 3 engine. Game is based on world war II. Its a first person shooter game. This game won the game of the year for 2003 from several reviewers.

cod-1

Commandos: Behind Enemy Lines

Game was developed by Pyro studios and published by Eidos Interactive. Its a single player real time startegy game.

commandos

Doom 3

Game was developed by id Software and published by Activision. The game uses id Tech 4 engine. Its a first person shooter horror game. The Game was a critical and commercial success for id software with more than 3.5 millions copy sold.

doom3

Half-Life 1

Game was developed by valve software and published by sierra studios. The game used modified version of Quake Engine called GoldSrc engine which is able to render in both OpenGl and Direct3D api. Its a First Person Shooter Game. On its release, critics hailed its overall presentation and numerous scripted sequences, and it won over 51 PC Game of the year awards. It is considered one of the greatest games of all time. This game also set the benchmark in the field off Game AI(Artificial Intellegence) at that period.

half-life

Hitman: Codename 47

Game was developed by IO Interactive and published by eidos interactive. The game uses Glacier engine. Its a third person shooter game.

Hitman1

Unreal Tournament 2004

Game was developed by Epic games. The game used Unreal Engine 2.5. Its a first person shooter game. Game received positive reviews on release. It also received multiplayer game of the year.

unreal

Return to Castle Wolfeinstein

Game was developed by Gray Matter Interactive(Single Player) and Nerve Software(multiplayer) and published by Activision. Games usd id tech 3 engine.

castle

PREY

Game was developed by Human Head Studios and published by 2k Games and 3d realms. The game used modified version of id tech 4 engine. Its a first person shooter game. It received positive reviews and was commercial success, sold more than 1 million copies.

prey

Soldier of Fortune (Series)

First 2 game of the franchise was developed by Raven Software, published by Activision. The game used quake 2 and quake 3 engine.

soldier_of_fortune

There are many other opengl based games. But these are one of my favorites.

Gracias.

Posted in games | Tagged , | 1 Comment

Playstation 3 and Xbox 360 sales numbers

consoles

In year 2008, xbox 360 and playstation 3 were head to head fighting for the top spot. According to the gamer.blorge.com both consoles sold/shipped approximately 10.8 million for the entire year.

The PS3 had a best games line up in year 2008:

METAL GEAR SOLID 4

Metal_Gear_Solid_4_US_Box_Art

RESISTANCE 2

1223352340-Resistance-2-PS3-01

Better games line up was the PS3’s saving grace. According to NPD PS3 sold more than doubled the sales of the XBOX 360 after the metal gear solid 4 was released.

The XBOX 360 also sold as many as the ps3 because of the massive price cut near the end of the year. The XBOX 360 also had a good games like Gears Of War 2 :

gears-of-war-2-coming-1

But the low price moved XBOX 360 head to head with PS3.

With PS3 and XBOX 360 getting sold same amount, the exclusive games: Gears of war 2 and metal gear solid 4 also sold around the same amount around 5 million.

So year 2009 will see the interesting race between xbox 360 and ps3 as ps3 is cutting their price.

According to nexgenwars.com , they are showing the current sales number of consoles:

console_sales

Posted in consoles | Tagged , , , | Leave a comment

My New Game Project : Jungle Riddle

At present i am working on a 2d side-scrolling platform game. It started as a course project but now i want to extend it and make it large.

I have used java and slick library to make this game project. I have put the game demo on my blog page. The project is still in development process. So you can download and play it. Please give the feedback. I am still new to game development so feedback( both positive and negative ) will be appreciated.

So download the game from http://gaanza.com/games/ and play it

please comment your feedback and suggestions here.

it’ll be great help for developing this game further.

Gracias.

Posted in Slick 2D, games, java | Tagged , , | 5 Comments

Getting started making games with java !!

Okie still there are people who thinks java is slow for making commercial and serious games and java is just for casual games. But here i’l show you that java has lot more potential to make serious games.

So now how to get started ??? What libraries or tools to use for making more efficient games ?? There are two libraries which gives you a lot more features to create real time graphics. You can make amazing cool games using these libraries. And what are these libraries ?? They are LWJGL (light weight java game library) and JOGL (java OpenGL). These two libraries gives you the power of opengl graphics library.

LWJGL

The Lightweight Java Game Library (LWJGL) is a solution aimed directly at professional and amateur Java programmers alike to enable commercial quality games to be written in Java. LWJGL provides developers access to high performance crossplatform libraries such as OpenGL (Open Graphics Library) and OpenAL (Open Audio Library) allowing for state of the art 3D games and 3D sound. Additionally LWJGL provides access to controllers such as Gamepads, Steering wheel and Joysticks.

So Is there any game made using LWJGL ??

Yes there is AAA tiltle that has been made using lwjgl. Its TRIBLE TROUBLE by oddlabs, an amazing cool 3d real time strategy game. You can read my post on this game.

source: http://tribaltrouble.com/screenshots?id=14

source: http://tribaltrouble.com/screenshots?id=14

Okie so now where i can find the lwjgl tutorials:

lwjgl tutorial site 1

lwjgl tutorial site 2

(Note: i’ll keep updating the tutorial sites of lwjgl )

JOGL

Java OpenGL (JOGL) is a wrapper library that allows OpenGl to be used in the Java programming language. JOGL is the Sun supported set of Java class bindings for OpenGL. Using OpenGL through JOGL, you will be able to make cool games or model situations that could be too expensive to create.

So any game made with JOGL ???

Yes. Its called JAKE 2. It is the port of Quake 2 game engine from id Software. Here is the screenshot from their ( bytonic Software) site:

source: http://bytonic.de/html/screenshots_1.html

source: http://bytonic.de/html/screenshots_1.html

Okie now i will tell you about some available good engines to make games. All the low level stuff has been done for you. You have to just use the library and take off.

First i’ll start with 2d game engines:

1) Slick 2D : This is the best java 2d game engine based on LWJGL available now. Its an free and Open Source 2d game engine. Many cool games has been made using this game.

2) Golden T Game Engine (GTGE) : Its an advanced cross-platform game programming library written in java programming language.

3) Stencyl

4) JGame

5) PulpCore

Now 3d java engines:

1) jMonkeyEngine : This is the one of the best and popular java 3d graphics engine available now. Its an free and open source engine. JME (jMonkey Engine) is a high performance scene graph based graphics API. Some videos of game made with jMonkeyEngine.

2) Espresso3D : Its an open source high performance real-time 3D engine for the Java(tm) programming language. It aims to be a complete solution for your application with OpenGL rendering, OpenAL audio, collision detection, input, and rendering support.

3) Xith3D : Xith3D is a Java-based 3D engine, centered on gaming.

4) JCPT : jPCT is a free 3D engine/API for Java. Here is one screenshot of games made with JCPT from there site.

source: http://www.jpct.net/screenshots.html

source: http://www.jpct.net/screenshots.html

Okie so thats it. I hope i have give you enough basic info on starting making games with java. So now you make a choice and get started.

Gracias.

Posted in games, java | Tagged , , | Leave a comment
  • Become a GaanZa Fan

    GaanZa on Facebook