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

beans222

Members
  • Content count

    79
  • Joined

  • Last visited

Community Reputation

1248 Excellent

About beans222

  • Rank
    Member

Personal Information

  1. The std130 layout will pad out the float to a vec4. The buffer won't be the right size for the uniform struct in the shader and the shader will read zero.
  2. OpenGL

    For example, let's make position 6 be 0,1,0. The faces would then be: f (0,1,0)/11 5/12 1/9  then later on f 7/15, (0,1,0)/16 ... Two faces can and do touch after all. They aren't assigned, the data is just used in that order. If any part of the full vertex (position + uv) doesn't match another full vertex they are unique even if part is the same (and get different indices for the GL element buffer). You will end up duplicating data, outputing a position multiple times if it appears with different uvs.   Also, easier to think of those v-lines as positions. Edit: if that's not terribly clear, I apologize. I'm exhausted. I'll post some code tomorrow if necessary.
  3. OpenGL

    If you need indices for your engine (or just want to always use indexed renders) Sponji has the right info. What I was getting at with a flat array is that you can build a flat array from the indices after you've read the file: std::vector<int> indices; // pairs: position, uv, position, uv, etc std::vector<vertex> vertices(indices.size()/2); for(int i = 0; i < indices.size()/2; ++i) { vertices[i].x = points[indices[i]].x; // and y, z vertices[i].u = texcoords[indices[i+1]].u // and v } // where points and texcoords are the v and vt from the obj file // and indices is all of the face data. and then 'vertices' is all you need into one vbo with glDrawArrays.
  4. OpenGL

    OpenGL only supports 1 index buffer, where an index refers to the "complete" vertex that includes all attributes (uv, normal, etc). The easiest way to go is to copy the position and uv coordinates to a buffer as you read (or after) the indices and just render using glDrawArrays without an element array buffer. Otherwise, you'll need to build a new index buffer based on unique pairs of position+uv.   Also, the binding of GL_ELEMENT_ARRAY_BUFFER is part of the state of a vertex array. Even if you set up glVertexAttribPointers later, you might as well bind the VAO before the element buffer and have that all set (and not messing up the previous VAO's state).
  5. The vertex shader input attributes need to be assigned a location, whether with layout or glBindAttribLocation.     There's a typo highlighted, that should be GL_UNIFORM_BUFFER. Also, I didn't try to get the lighting glsl to work, I just output red from the fragment shader to make sure there was output. It's a cube!
  6.   glBindBufferBase/Range also bind the generic target, so at least for just filling the buffer, those last two calls are the same.         This is where you need to glBindBufferBase to binding point 1 that you've set up for the block. No need to unbind it. And also stop using NULL when you mean zero.
  7. std140 layout pads a vec3 to 4.
  8. Are you just trying to implement a first person view/camera? If so, you either need to simply add the camera's look vector to position (for a floating camera); or need to cross multiply look with up (0,1,0), then the cross result with up, to get forward (for a character that can move and look in somewhat different directions).
  9. OpenGL

    My guess would be that the shader compiler is optimizing out the 'inNormal' attribute resulting in glEnableVertexAttribArray raising invalid value (-1 for an attribute index).
  10. Have you set up the depth buffer? Needs to be enabled, cleared each frame, and the most common clear value is 1.0. Here's a wiki page about is: http://www.opengl.org/wiki/Depth_Buffer   edit: also obj indices start at 1, need to adjust to 0 for gl elements if you haven't already.
  11. GL_POLYGON draws a *single* polygon. Try hitting 'triangulate' in blender before exporting to obj and rendering GL_TRIANGLES.
  12.   This. You are sending the 8 vertices of a cube to GL, but drawing triangles that's not going to work (cube has 6 faces that are quads = 12 total triangles). You need to make a GL_ELEMENT_ARRAY buffer out of the faces section of the obj file data.   If you haven't already seen this online book, stop now and read: http://arcsynthesis.org/gltut/
  13. 2904 / 3 = 968. (it is divisible)
  14. It sounds like instancing is extactly what you want. You can create a vertex array with only the instance attribute(s) enabled/setup and avoid using the 6 vertices all together, then in the shader use gl_VertexID? to determine which vertex of the quad it is. Use glDrawArraysInstanced normally [eg for 2 instances of the quad: glDrawArraysInstanced(GL_TRIANGLES, 0, 6, 2) ]
  15. How are you setting up the ModelView matrix to use instancing?