• 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.

Knut

Members
  • Content count

    5
  • Joined

  • Last visited

Community Reputation

107 Neutral

About Knut

  • Rank
    Newbie
  1. Hi all, I am trying to render a textured quad in ortho mode. When I render it as a rectangle, it works fine, as this picture shows: [img]https://knut80.files.wordpress.com/2012/09/square11.png?w=404[/img] However, when I try to move one corner half way to the center, the texture gets weirdly skeeved: [img]https://knut80.files.wordpress.com/2012/09/square21.png?w=405[/img] Notice the red line going up. I would think that it should be sloped towards the upper right corner, but it's rendered straight up. Is this normal? There is only one textured quad in this picture, rendered using fixed function pipeline. The texture coords are all either 0 or 1 in the corners. Why is the texture rendered like this? Thanks in advance. Knut
  2. Solved this issue like this: [source lang="java"]screenPos.z = -(screenPos.z * (zFar - zNear) + zNear);[/source]
  3. Yes, depth test is enabled. Are you sure I should add +/- 10 after gluProject? I want to draw a range indicator around the cube, so I would imagine I want to add some offset to the cube position, and then project that?
  4. Oh, sorry...I have attached the pictures here. The first picture shows a cube rendered at [0,0,0], and selection markers which are rendered in ortho mode. They are rendered with z value 0.0, and the x and y values calculated using gluProject. This is working fine. [img]https://knut80.files.wordpress.com/2012/09/cube14.png?w=351[/img] In the second picture I try to render a quad. I give gluProject x and z values of -10 and +10, and y value 0, so it should intersect the cube. The quad is textured with a cross, which should end up inside the cube, and depth testing is enabled (I hoped some would end up behind the cube). However, as you can see from the second picture, it is distorted. [img]https://knut80.files.wordpress.com/2012/09/cube24.png?w=450[/img] The distortion seems to be less if I move the camera further away. Any ideas what might cause this effect? Any help would be greatly appreciated. I posted it here because I consider myself a beginner, at least to game programming, and I think this function (gluProject) is quite basic. If I posted it wrong, I appologise for that. Thanks Knut
  5. Hi guys, I'm having some trouble with gluProject. I'm working on a small game, and I need the user to be able to click on entities and get information etc about them. To archieve this, I have been trying to mix 3d graphics (for the entities) with 2d graphics (for the GUI parts). The entities are rendered in perspective mode, while the GUI parts are rendered in ortho mode. When rendering the entities, the model-view matrix is set according to the camera position and rotation, and passed to the shaders. For each model, the models position and rotation is also passed to the shader separately. So to archieve things like selection marker, I have been using gluProject. The projection and view-port matrices are stored in the beginning of the program execution, and the model-view matrix is stored during each frame. The matrices are read from OpenGL itself. They are all used in this method: [source lang="java"] /* * (non-Javadoc) * @see no.bog.starship.services.Renderer#project(no.bog.starship.glutil.GLVector) */ @Override public GLVector project(GLVector worldSpaceVector) { GLU.gluProject(worldSpaceVector.x, worldSpaceVector.y, worldSpaceVector.z, this.mvMatrixBuffer, this.projectionMatrixBuffer, this.viewPortMatrixBuffer, this.screenPositionBuffer); GLVector rc = new GLVector(new float[]{this.screenPositionBuffer.get(), this.screenPositionBuffer.get(), this.screenPositionBuffer.get()}); this.screenPositionBuffer.rewind(); return rc; } [/source] To switch between 3D and 2D mode, I have these functions, which are called before rendering: [source lang="java"] /** * Prepare for 3D rendering. */ protected void prepare3D() { GL11.glMatrixMode(GL11.GL_PROJECTION); GL11.glLoadIdentity(); GLU.gluPerspective( 45.0f, (float) this.windowWidth / (float) this.windowHeight, 1.0f, 1000.0f); GL11.glMatrixMode(GL11.GL_MODELVIEW); GL11.glLoadIdentity(); } /** * Prepare for 2D rendering. */ protected void prepare2D() { //Prepare projection matrix to render in 2D GL11.glMatrixMode(GL11.GL_PROJECTION); GL11.glLoadIdentity(); // clear the perspective matrix GL11.glOrtho( // turn on 2D mode 0, this.windowWidth, // left, right 0, this.windowHeight, // bottom, top -1, 1); // Zfar, Znear //Prepare the modelview matrix GL11.glMatrixMode(GL11.GL_MODELVIEW); GL11.glLoadIdentity(); //Clear the Modelview Matrix } [/source] When using this, I have managed to create some selection markers, which I have simply implemented as quads with a texture aligned next to the model, as you can see in this picture. These quads are all rendered with z-value set to zero. (In other words, I am using gluProject to simply find the x and y coordinates to use). I am now trying to add a feature where the user is shown a "map" around the selected entity (think move range or something like this). I want to draw it in ortho so the texture on it is not distorted by perspective. However, I am having trouble when I try to use gluProject to do this. I am trying to add a simple quad with the same y-coord as the entity and the x and z set to +/- 10...but the values returned by gluProject does not make sence to me...it seems the center of this quad is not in the same position as the entity (a simple cube in 0,0,0), especially when the camera is close to 0,0,0. Can anyone tell me what I need to do with the z value to be able to use it? I am thinking of rendering with depth test...will this work? Is there any other way of rendering these kinds of things which are easier/nicer? Thank you in advance