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

paulg568

Members
  • Content count

    8
  • Joined

  • Last visited

Community Reputation

100 Neutral

About paulg568

  • Rank
    Newbie
  1. Well I want the obj reader to be able to handle objects from maya, max, blender and what ever else, so handling just my models won't be good enough( I downloaded the chess pieces from turbosquid.com ). I am trying to follow the format for the obj file spec so maybe I will try generating my normals the other way around like ashman. Thanks everyone I'll let you know my progress.
  2. I have been creating an obj loader. I have pretty much everything working except for smoothing groups. They partially work. I go through all the faces and check if their indicies are part of multiple smoothing groups. If so I mark what index was part of a separate smoothing group. Then I go through again and duplicate that vertex and update the faces array to use that new vertex. I hope that makes sense. Here is a screenshot of two chess pieces. In it you can see the knight and the rook have certain areas that are smoothing nicely and others that you can clearly see the polygons. I feel like I am duplicating vertices too many times if they are part of too many faces but I can't seem to fix it. If anyone has any idea what I am doing wrong I would greatly appreciate it. Code is below the picture. Thanks for the help. [img]http://i.imgur.com/FYXRj.png[/img] Here is the code for finding shared vertices and the how I duplicate them. It probably looks confusing and is.... so if you want me to explain it more I can. Thanks for the help. [CODE] void ObjFileReader::findSharedVertices(int numberOfObjects, int sizeOfVerts, QVector<int> *faces, QVector<int> *repeatedIndices, QVector<int> *repeatsInsideFaces, QVector<int> *smoothingGroups){ QVector<int> *smooths = new QVector<int>[numberOfObjects]; for(int i = 0; i < numberOfObjects; i++){ repeatedIndices[i].resize(sizeOfVerts); smooths[i].resize(sizeOfVerts); for(int j = 0; j < faces[i].size(); j++){ repeatedIndices[i][faces[i][j]]++; if(repeatedIndices[i][faces[i][j]] > 1){ if(smooths[i][faces[i][j]] == smoothingGroups[i][j]){ repeatedIndices[i][faces[i][j]]--; } else { repeatsInsideFaces[i].append(j); } } else { smooths[i][faces[i][j]] = smoothingGroups[i][j]; } } } } void ObjFileReader::duplicateSharedVertices(int numberOfObjects, QVector<int> *smoothingGroupIndices, QVector<int> *faces, QVector<Point3d> *m_points, QVector<int> *uvCoordinateIndexing, QVector<int> *repeatedIndices, QVector<int> *repeatsInsideFaces){ int total = 0; for(int i = 0; i < numberOfObjects; i++){ for(int j = 0; j < repeatsInsideFaces[i].size(); j++){ m_points->append((*m_points)[faces[i][repeatsInsideFaces[i][j]]]); faces[i][repeatsInsideFaces[i][j]] = m_points->size()-1; } } } [/CODE]
  3. Thanks for the replies. Using glWindowPos2i did the trick. I tried glVertex2f and the images showed up in the bottom left regardless of position. I am new to opengl and am going to make a guess as to why this didn't work. Don't you generally need veretex positions for polygons, not raster images or pixmaps? Lastly, how do I mark a post as solved? I have made two posts and in both cases I need to mark the posts solved/complete/closed. Thanks for everyones' help.
  4. Translating it to a negative spot didn't work. It stopped it at zero.
  5. So how do you draw an image partially off the screen? I am going to try what I am about to say and let you know if it works. If x is negative use glTranslafef to translate it partially offscreen. In the mean time if someone else has an idea how to draw image partially on screen let me know. Thanks. -Paul
  6. I wrote my own gui image renderer. I am having an issue with images not rendering if there position is negative even if part of the image is still on screen. Here is my code: [CODE] glEnable(GL_BLEND); glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glPushMatrix(); glRasterPos2f(xPos, yPos); glPixelZoom(xScale, yScale); glDrawPixels(originalWidth, originalHeight, GL_RGBA, GL_UNSIGNED_BYTE, imageData.bits()); glPopMatrix(); glDisable(GL_BLEND); glDisable(GL_ALPHA_TEST); [/CODE] Anyone know how to fix this? Thanks.
  7. OpenGL

    Thank you very much, texturing works now. Just to be clear in case someone else reads this though, the linked_tc would use the uv index from the obj file not the vertex index. Another thing that had me stumped for a bit was calculating normals after reorganizing the coordinates. Doing it after doesn't allow you to use adjacent vertices to calculate normals, so then you only have the normal of the face which will stop GL_SMOOTH from working. I had to calculate the normals before reorganization so that you can do it using adjacent vertices. Then when you reorganize the vertices with the indices from the obj file, you also have to reorganize the normal order using the same indices.
  8. OpenGL

    Just a small update, I tried to different wavefrot obj files, and in the one there are more uv coords than vertices and in the other there are more vertices than uv coords. So I don't know if retriangulating is the answer, maybe it is, I am not totally sure how to do that. Also some of my texture coordinates are not normalized. Most of them are between 0 and 1 some are as high as 20 and low as -20. I tried normalizing them all but it didn't fix the texturing issue.
  9. OpenGL

    Thanks very much I will give this a shot and repost if it worked or not.
  10. [size=3]Hi everyone this is my first post here, I think I am in the right area.[/size] [size=3]I am working on making my own opengl graphics engine. I am mostly trying to learn opengl.[/size] [size=3]To start off, [color=#363534][font=Verdana,]I downloaded the qt obj viewer a while ago from this link [url="http://qt.gitorious.org/qt-labs/modelviewer"]http://qt.gitorious....abs/modelviewer[/url][/font][/color][color=#363534][font=Verdana,]. I have been modifying it to fit my needs. It is my first time using opengl. Right now I am working on texturing objects. I cannot tell if it is my opengl code that is wrong or if I am writing my u v coordinates incorrectly. As it stands I write the u v coords in the same order as they are in the obj file. It appears that part of my texture is correct. Here is an image and below is my code.[/font][/color][/size] [color=#363534][font=Verdana,]As a side note, reading obj files with multiple objects and materials has worked just fine. The next step is texturing which is giving me some trouble.[/font][/color] [size=3][color=#363534][font=Verdana,][img]http://i.imgur.com/jMMqv.png[/img][/font][/color][/size] [left][size=3][color=#363534][font=Verdana,]As you can see the u v coords are going into a class Point3d. The u_v_coords is a QVector<Point3d>[/font][/color][/size][/left] [left][size=3][color=#363534][font=Verdana,][CODE] ... else if (id == "vt"){ Point3d p; for(int i = 0; i < 2; ++i){ ts >> p[i]; } u_v_coords << p; } ... [/CODE][/font][/color][/size][/left] [left][color=#363534][font=Verdana,]The opengl code for drawing a textures is below. I am using glTexCoordPointer with the stride of size Point3d.[/font][/color][/left] [left][CODE] void Model::renderHelper(int i) const{ if(texture != NULL){ glEnable( GL_TEXTURE_2D ); glBindTexture( GL_TEXTURE_2D, texture->texture ); glTexCoordPointer(2, GL_FLOAT, sizeof(Point3d), u_v_coords.data()); glEnableClientState(GL_TEXTURE_COORD_ARRAY); } glMaterialfv(GL_FRONT, GL_AMBIENT, materials[objectMaterialInt[i]].Ka); glMaterialfv(GL_FRONT, GL_DIFFUSE, materials[objectMaterialInt[i]].Kd); glMaterialfv(GL_FRONT, GL_SPECULAR, materials[objectMaterialInt[i]].Ks); glMaterialf(GL_FRONT, GL_SHININESS, materials[objectMaterialInt[i]].Ns); glShadeModel(GL_SMOOTH); glPushMatrix(); glTranslatef(position[0], position[1], position[2]); glEnableClientState(GL_NORMAL_ARRAY); glVertexPointer(3, GL_FLOAT, 0, (float *)m_points.data()); glNormalPointer(GL_FLOAT, 0, (float *)m_normals.data()); glDrawElements(GL_TRIANGLES, objects[i].size(), GL_UNSIGNED_INT, objects[i].data()); glPopMatrix(); if(texture != NULL){ glDisable(GL_TEXTURE_2D); glDisableClientState(GL_TEXTURE_COORD_ARRAY); } } [/CODE][/left] [left]Thanks for the help, let me know if you need more information.[/left]