• Announcements

    • khawk

      Download the Game Design and Indie Game Marketing Freebook   07/19/17

      GameDev.net and CRC Press have teamed up to bring a free ebook of content curated from top titles published by CRC Press. The freebook, Practices of Game Design & Indie Game Marketing, includes chapters from The Art of Game Design: A Book of Lenses, A Practical Guide to Indie Game Marketing, and An Architectural Approach to Level Design. The GameDev.net FreeBook is relevant to game designers, developers, and those interested in learning more about the challenges in game development. We know game development can be a tough discipline and business, so we picked several chapters from CRC Press titles that we thought would be of interest to you, the GameDev.net audience, in your journey to design, develop, and market your next game. The free ebook is available through CRC Press by clicking here. The Curated Books The Art of Game Design: A Book of Lenses, Second Edition, by Jesse Schell Presents 100+ sets of questions, or different lenses, for viewing a game’s design, encompassing diverse fields such as psychology, architecture, music, film, software engineering, theme park design, mathematics, anthropology, and more. Written by one of the world's top game designers, this book describes the deepest and most fundamental principles of game design, demonstrating how tactics used in board, card, and athletic games also work in video games. It provides practical instruction on creating world-class games that will be played again and again. View it here. A Practical Guide to Indie Game Marketing, by Joel Dreskin Marketing is an essential but too frequently overlooked or minimized component of the release plan for indie games. A Practical Guide to Indie Game Marketing provides you with the tools needed to build visibility and sell your indie games. With special focus on those developers with small budgets and limited staff and resources, this book is packed with tangible recommendations and techniques that you can put to use immediately. As a seasoned professional of the indie game arena, author Joel Dreskin gives you insight into practical, real-world experiences of marketing numerous successful games and also provides stories of the failures. View it here. An Architectural Approach to Level Design This is one of the first books to integrate architectural and spatial design theory with the field of level design. The book presents architectural techniques and theories for level designers to use in their own work. It connects architecture and level design in different ways that address the practical elements of how designers construct space and the experiential elements of how and why humans interact with this space. Throughout the text, readers learn skills for spatial layout, evoking emotion through gamespaces, and creating better levels through architectural theory. View it here. Learn more and download the ebook by clicking here. Did you know? GameDev.net and CRC Press also recently teamed up to bring GDNet+ Members up to a 20% discount on all CRC Press books. Learn more about this and other benefits here.

tRicky060606

Members
  • Content count

    7
  • Joined

  • Last visited

Community Reputation

121 Neutral

About tRicky060606

  • Rank
    Newbie

Personal Information

  • Location
    Dunstable, UK
  1. OpenGL

    @Thorim a 32~*32 colours is 1024 int and 4096 bytes using arga. So I don't know what you are thinling but thanks for trying. @Glass_Knife thank you for pointing out my stupidity. I'm such a fool!
  2. I am having problems with textures. Please tell me where I'm going wrong. Here is all the code I used. I'm trying to add a texture to the square. This will eventually be part of an object making program. package ObjectMaker; import com.sun.opengl.util.Animator; import java.awt.Frame; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; import java.nio.IntBuffer; import java.util.Random; import javax.media.opengl.GL; import javax.media.opengl.GLAutoDrawable; import javax.media.opengl.GLCanvas; import javax.media.opengl.GLEventListener; import javax.media.opengl.glu.GLU; /** * ObjectMaker.java <BR> * author: Brian Paul (converted to Java by Ron Cemer and Sven Goethel) <P> * * This version is equal to Brian Paul's version 1.2 1999/10/21 */ public class ObjectMaker implements GLEventListener { public static final Random rnd = new _Random( System.currentTimeMillis() ); public static final ObjectMaker objectmaker = new ObjectMaker(); private int[] textures, image; int width, height; private IntBuffer ib; private GLU glu; public ObjectMaker(){ width = 32; height = 32; image = new int[ width * height ]; for( int o = 0; o < image.length; o++ ){ int x = o % width, y = o / width; image[ o ] = (int)Math.floor( Math.sqrt(x * rnd.nextFloat() + y * rnd.nextFloat() )); } ib = IntBuffer.wrap( image ); glu = new GLU(); } public static void main(String[] args) { Frame frame = new Frame("Simple JOGL Application"); GLCanvas canvas = new GLCanvas(); canvas.addGLEventListener( objectmaker ); frame.add(canvas); frame.setSize(640, 480); final Animator animator = new Animator(canvas); frame.addWindowListener(new WindowAdapter() { @Override public void windowClosing(WindowEvent e) { // Run this on another thread than the AWT event queue to // make sure the call to Animator.stop() completes before // exiting new Thread(new Runnable() { public void run() { animator.stop(); System.exit(0); } }).start(); } }); // Center frame frame.setLocationRelativeTo(null); frame.setVisible(true); animator.start(); } public void init(GLAutoDrawable drawable) { // Use debug pipeline // drawable.setGL(new DebugGL(drawable.getGL())); GL gl = drawable.getGL(); System.err.println("INIT GL IS: " + gl.getClass().getName()); // Enable VSync gl.setSwapInterval(1); // Setup the drawing area and shading mode gl.glClearColor(0.0f, 0.0f, 0.0f, 0.0f); gl.glShadeModel(GL.GL_SMOOTH); // try setting this to GL_FLAT and see what happens. textures = new int[ ]{ 0 }; buildTestTexture(gl); } public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height) { GL gl = drawable.getGL(); GLU glu = new GLU(); if (height <= 0) { // avoid a divide by zero error! height = 1; } final float h = (float) width / (float) height; gl.glViewport(0, 0, width, height); gl.glMatrixMode(GL.GL_PROJECTION); gl.glLoadIdentity(); glu.gluPerspective(45.0f, h, 1.0, 20.0); gl.glMatrixMode(GL.GL_MODELVIEW); gl.glLoadIdentity(); } public void display(GLAutoDrawable drawable) { GL gl = drawable.getGL(); // Clear the drawing area gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT); // Reset the current matrix to the "identity" gl.glLoadIdentity(); // Move the "drawing cursor" around gl.glTranslatef(-1.5f, 0.0f, -6.0f); // Drawing Using Triangles gl.glBegin(GL.GL_TRIANGLES); gl.glColor3f(1.0f, 0.0f, 0.0f); // Set the current drawing color to red gl.glVertex3f(0.0f, 1.0f, 0.0f); // Top gl.glColor3f(0.0f, 1.0f, 0.0f); // Set the current drawing color to green gl.glVertex3f(-1.0f, -1.0f, 0.0f); // Bottom Left gl.glColor3f(0.0f, 0.0f, 1.0f); // Set the current drawing color to blue gl.glVertex3f(1.0f, -1.0f, 0.0f); // Bottom Right // Finished Drawing The Triangle gl.glEnd(); // Move the "drawing cursor" to another position gl.glTranslatef(3.0f, 0.0f, 0.0f); gl.glColor3f( 1.0f, 1.0f, 1.0f); gl.glBindTexture( GL.GL_TEXTURE_2D, textures[ 0 ] ); // Draw A Quad gl.glBegin(GL.GL_QUADS); gl.glTexCoord2i( 0, 0 ); gl.glVertex3f(-1.0f, 1.0f, 0.0f); // Top Left gl.glTexCoord2i( 1, 0 ); gl.glVertex3f(1.0f, 1.0f, 0.0f); // Top Right gl.glTexCoord2i( 1, 1 ); gl.glVertex3f(1.0f, -1.0f, 0.0f); // Bottom Right gl.glTexCoord2i( 0, 1 ); gl.glVertex3f(-1.0f, -1.0f, 0.0f); // Bottom Left // Done Drawing The Quad gl.glEnd(); // Flush all drawing operations to the graphics card gl.glFlush(); } public void displayChanged(GLAutoDrawable drawable, boolean modeChanged, boolean deviceChanged) { } private void buildTestTexture( GL gl ){ gl.glGenTextures( textures.length, textures, 0 ); gl.glBindTexture( GL.GL_TEXTURE_2D, textures[ 0 ] ); //gl.glPixelStorei( GL.GL_UNPACK_ALIGNMENT, textures.length ); gl.glTexParameteri ( GL.GL_TEXTURE_2D, GL.GL_TEXTURE_WRAP_S, GL.GL_REPEAT ); gl.glTexParameteri ( GL.GL_TEXTURE_2D, GL.GL_TEXTURE_WRAP_T, GL.GL_REPEAT ); gl.glTexParameteri ( GL.GL_TEXTURE_2D, GL.GL_TEXTURE_MAG_FILTER, GL.GL_LINEAR ); gl.glTexParameteri ( GL.GL_TEXTURE_2D, GL.GL_TEXTURE_MIN_FILTER, GL.GL_LINEAR ); gl.glTexEnvf ( GL.GL_TEXTURE_ENV, GL.GL_TEXTURE_ENV_MODE, GL.GL_MODULATE ); /*glu.gluBuild2DMipmaps( GL.GL_TEXTURE_2D, 3, width, height, GL.GL_RGBA, GL.GL_UNSIGNED_BYTE, ib );*/ gl.glTexImage2D ( GL.GL_TEXTURE_2D, 0, GL.GL_RGBA, width, height, 0, GL.GL_RGBA, GL.GL_UNSIGNED_BYTE, ib ); gl.glEnable( GL.GL_TEXTURE_2D ); } } package ObjectMaker; import java.util.Random; /** * * @author rda060606 */ public class _Random extends Random { private static final int MAXCOUNTB4RESEEDING = 1000; private int count; public _Random(long seed) { super( seed ); count = 0; //setuFlatteningArray(); } @Override protected int next(int i) { count++; count %= MAXCOUNTB4RESEEDING; if( count == 0 ) setSeed( System.currentTimeMillis() ); return super.next(i); } }
  3. I just realized that i did not do something very elementary. I should have used new MemoryImageSource! Unlike c++ you new new to create a class in Java!!
  4. I did not define a classpath but the path for my library project is OK and is not where MemoryImageSource should be anyway and thus irrelevant.
  5. Now it finds the package but not the class!! I've copied and pasted to no effect. Thanks for the help LJ_1102
  6. NetBeans puts a red wiggly line under it and says it can't find it. In other words it is not defined anywhere. I found it by looking in a zip file and found that out by looking for Image. Here are the imports: import java.awt.Image.*; import java.awt.Image.MemoryImageSource;   MemoryImageSource package and class do not exist according to NetBeans but it does! I downloaded NetBeans 7.3 and get the same problem but also can't find it manually. I'm creating a library so breakpoints are worthless. It is simple symbol not found issue.
  7. I'm in the process of writing an alternative to hardware acceleration without using raycasting. Its based on taking the screen as a sheet and moving that as a whole. While i have much done the thing that is a current problem is getting it on the screen. The problem is how. In c/c++ i could use createbitmapindirect, slow but possible and there might be a faster way but i want to do it in Java. The problem is how? In the manual it saysuse MemoryImageSource. Tried and failed. Why? Netbeans can't find it! I searched and found it easily and can't see why Netbeans can't. Its been imported correctly, even copied and paste. Does anyone have a clue what to next?