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

chinu3d

Members
  • Content count

    3
  • Joined

  • Last visited

Community Reputation

126 Neutral

About chinu3d

  • Rank
    Newbie
  1. Hi everyone, I am just a noob to OpenGL and this is in fact my first OpenGL code written for Mac OSX. I really got stuck into an odd problem of this simple icosahedron not rendering up properly when I light it up. The problem could either be that the polys are not oriented properly or that the normal computations are incorrect. I checked both of the posdibilities but couldn't really figure out what went wrong. Here is the full code - #import "oglView.h" #import <GLUT/glut.h> #import "Utilities.h" #define X 52.5731112119133606 #define Z 85.0650808352039932 #define ORIGIN_X 200.0 #define ORIGIN_Y 200.0 #define ORIGIN_Z 0.0 @implementation oglView void reshape (int w, int h); void subdivide(float *v1, float *v2, float *v3, long depth); void drawtriangle(float *v1, float *v2, float *v3); void normalize(float *v); void scaleVector(float *v, float scaleFactor); - (id)initWithFrame:(NSRect)frameRect pixelFormat:(NSOpenGLPixelFormat *)format { self = [super initWithFrame:frameRect pixelFormat:format]; [self initOpenGL]; return self; } - (id)initWithCoder:(NSCoder *)coder { self = [super initWithCoder: coder]; [self initOpenGL]; return self; } - (void)initOpenGL { NSOpenGLContext *glcontext; glcontext = [self openGLContext]; [glcontext makeCurrentContext]; glClearColor(0.1, 0.1, 0.1, 0.0); // background color is dark gray glClear(GL_COLOR_BUFFER_BIT); // clear the view glOrtho(0.0, 400, 0.0, 400, -1.0, 1.0); // setup our 400x400 coords glutReshapeFunc(reshape); } - (void)drawRect:(NSRect)dirtyRect { NSLog(@"drawRect"); glClearColor(0.5, 0.5, 0.5, 1.0); glClear(GL_COLOR_BUFFER_BIT); // erase the screen glMatrixMode(GL_MODELVIEW); // use model matrix glLoadIdentity(); // reset matrix glOrtho(0.0, dirtyRect.size.width, 0.0, dirtyRect.size.height, -1000.0, 1000.0); // we reset, so setup coords again glTranslatef(ORIGIN_X, ORIGIN_Y, ORIGIN_Z); // move to where we want to draw the triangle. Calling this will also translate the origin to that particular position //Set state variables: static GLfloat vdata[12][3] = { {-X, 0.0, Z}, {X, 0.0, Z}, {-X, 0.0, -Z}, {X, 0.0, -Z}, {0.0, Z, X}, {0.0, Z, -X}, {0.0, -Z, X}, {0.0, -Z, -X}, {Z, X, 0.0}, {-Z, X, 0.0}, {Z, -X, 0.0}, {-Z, -X, 0.0} }; static GLuint tindices[20][3] = { {0,4,1}, {0,9,4}, {9,5,4}, {4,5,8}, {4,8,1}, {8,10,1}, {8,3,10}, {5,3,8}, {5,2,3}, {2,7,3}, {7,10,3}, {7,6,10}, {7,11,6}, {11,0,6}, {0,1,6}, {6,1,10}, {9,0,11}, {9,11,2}, {9,2,5}, {7,2,11} }; int i; //Lighting and material calculations GLfloat mat_specular[] = { 1.0, 1.0, 1.0, 1.0 }; GLfloat mat_shininess[] = { 50.0 }; GLfloat light_position[] = { 50.0, 50.0, 50.0, 0.0 }; glClearColor (0.0, 0.0, 0.0, 0.0); glShadeModel (GL_SMOOTH); glMaterialfv(GL_FRONT, GL_SPECULAR, mat_specular); glMaterialfv(GL_FRONT, GL_SHININESS, mat_shininess); glLightfv(GL_LIGHT0, GL_POSITION, light_position); glEnable(GL_LIGHTING); glEnable(GL_LIGHT0); glEnable(GL_DEPTH_TEST); for (int i = 0; i < 20; i++) subdivide(vdata[tindices[i][0]], vdata[tindices[i][1]], vdata[tindices[i][2]], 3); glFinish(); } void subdivide(float *v1, float *v2, float *v3, long depth) { if (depth == 0) { drawtriangle(v1, v2, v3); return; } GLfloat v12[3], v23[3], v31[3]; for (int i=0 ; i<3 ; i++) { v12[i] = v1[i] + v2[i]; v23[i] = v2[i] + v3[i]; v31[i] = v3[i] + v1[i]; } normalize(v12); normalize(v23); normalize(v31); scaleVector(v12, 100.0); scaleVector(v23, 100.0); scaleVector(v31, 100.0); subdivide(v1, v12, v31, depth-1); subdivide(v2, v23, v12, depth-1); subdivide(v3, v31, v23, depth-1); subdivide(v12, v23, v31, depth-1); } void drawtriangle(float *v1, float *v2, float *v3) { glBegin(GL_TRIANGLES); glNormal3fv(v1); glVertex3fv(v1); glNormal3fv(v2); glVertex3fv(v2); glNormal3fv(v3); glVertex3fv(v3); glEnd(); } void normalize(float *v) { float modulus = sqrt((v[0]) * (v[0]) + (v[1]) * (v[1]) + (v[2]) * (v[2])); v[0] = v[0] / modulus; v[1] = v[1] / modulus; v[2] = v[2] / modulus; } void scaleVector(float *v, float scaleFactor) { v[0] = scaleFactor * (v[0]); v[1] = scaleFactor * (v[1]); v[2] = scaleFactor * (v[2]); } void reshape (int w, int h) { glViewport (0, 0, (GLsizei) w, (GLsizei) h); glMatrixMode (GL_PROJECTION); glLoadIdentity (); gluOrtho2D (0.0, (GLdouble) w, 0.0, (GLdouble) h); } @end
  2. Unity

    thanks a lot guys....guess I would give those a try
  3. Hello everyone....greetings to fellow game developers !!! I am new to the GameDev community. I have been working on games for quite some time now but very recently decided to switch to iOS game development from PC game development. I have been looking for good iOS game dev books which start with OpenGL ES basics. The two that I came across were iPhone 3d programming and iPhone Game Development, both published by O'Reilly. The second one was easier to understand but wasn't too systematic. The first one had all that I wanted but it takes a tough approach. Can anyone suggest some other good book which I could give a try?