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


This topic is now archived and is closed to further replies.


New to open gl and having problems!

0 posts in this topic

I''m trying to write a program in opengl. The program starts off with a plane (the triangle in between the two red strips) about to takeoff. Left or right clicking starts the plane. A left click tells it to take off to the left, a right click to the right. Here are the problems I''m having --> On the left-click version, a picture of the plane freezes at the top after take off. Neither lets the plane travel to the left or right after takeoff. Also, I wanted to put fire coming from the center of the base of the triangle, I tried to do that earlier, but it wouldn''t let me (I tried drawing lines that would move with the triangle''s position in an orange color coming from the base). Two last things, how would I make a clean rotation of the triangle instead of just a jumpy one after takeoff and is there any reason I would be having trouble using classes in open gl? Anyways, here''s my code so far: // please don''t mind the sloppiness!!! #include #include #include #include #include GLubyte quit = 0; GLshort top = 40; GLshort turn = 0; GLshort y_or_x = 0; GLfloat speed = 0.0f; GLfloat o_speed = 0.0f; GLfloat engine_step = .2; GLfloat Tx1 = -5.0f; GLfloat Ty1 = -40.0f; GLfloat Tx2 = 0.0f; GLfloat Ty2 = -30.0f; GLfloat Tx3 = 5.0f; GLfloat Ty3 = -40.0f; GLfloat T2x1 = -10.0f; GLfloat T2y1 = 0.0f; GLfloat T2x2 = 0.0f; GLfloat T2y2 = 5.0f; GLfloat T2x3 = 0.0f; GLfloat T2y3 = -5.0f; GLfloat T3x1 = 10.0f; GLfloat T3y1 = 0.0f; GLfloat T3x2 = 0.0f; GLfloat T3y2 = 5.0f; GLfloat T3x3 = 0.0f; GLfloat T3y3 = -5.0f; // Called to draw scene void RenderScene(void) { glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // Clear The Screen And The Depth Buffer glMatrixMode(GL_MODELVIEW); glLoadIdentity(); glColor3f(1.0f, 0.0f, 0.0f); glTranslatef(-10.0f,0.0f, 0.0f); glBegin(GL_QUADS); glVertex2f(-2.0f, 40.0f); glVertex2f(-2.0f,-40.0f); glVertex2f(2.0f, -40.0f); glVertex2f(2.0f, 40.0f); glEnd(); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); glTranslatef(10.0f,0.0f, 0.0f); glBegin(GL_QUADS); glVertex2f(-2.0f, 40.0f); glVertex2f(-2.0f, -40.0f); glVertex2f(2.0f, -40.0f); glVertex2f(2.0f, 40.0f); glEnd(); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); if(turn == 0) { glBegin(GL_TRIANGLES); glColor3f(0.0f, 0.0f, 1.0f); glVertex2f(Tx1, Ty1); glVertex2f(Tx2, Ty2); glVertex2f(Tx3, Ty3); glEnd(); }; if(turn == 1 && Ty1 > top) { glMatrixMode(GL_MODELVIEW); glLoadIdentity(); y_or_x++; glTranslatef(0.0f, 45.0f, 0.0f); glBegin(GL_TRIANGLES); glColor3f(0.0f, 0.0f, 1.0f); glVertex2f(T2x1, T2y1); glVertex2f(T2x2, T2y2); glVertex2f(T2x3, T2y3); glEnd(); }; if(turn == 2 && Ty1 > top) { glMatrixMode(GL_MODELVIEW); glLoadIdentity(); y_or_x++; glTranslatef(0.0f, 45.0f, 0.0f); glBegin(GL_TRIANGLES); glColor3f(0.0f, 0.0f, 1.0f); glVertex2f(T3x1, T3y1); glVertex2f(T3x2, T3y2); glVertex2f(T3x3, T3y3); glEnd(); }; if(turn == 1 || turn == 2 && Ty1 < top) { glBegin(GL_TRIANGLES); glColor3f(0.0f, 0.0f, 1.0f); glVertex2f(Tx1, Ty1); glVertex2f(Tx2, Ty2); glVertex2f(Tx3, Ty3); glEnd(); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); }; glPushMatrix(); // Restore transformations glPopMatrix(); // Flush drawing commands glutSwapBuffers(); } // This function does any needed initialization on the rendering // context. void SetupRC() { glClearColor(0.0f, 0.0f, 0.0f, 1.0f ); // Set color shading model to flat glShadeModel(GL_FLAT); // Clock wise wound polygons are front facing, this is reversed // because we are using triangle fans glFrontFace(GL_CW); } void MouseHandler(int button, int state, int x, int y) { if(button == GLUT_LEFT_BUTTON && state == GLUT_DOWN) { MessageBeep(-1); turn = 1; }; if(button == GLUT_RIGHT_BUTTON && state == GLUT_DOWN) { MessageBeep(-1); turn = 2; }; } void SpecialKeys(int key, int x, int y) { glutPostRedisplay(); } void TimerFunction(int value) { if(y_or_x == 0 && Ty1 < top && turn == 1 || turn == 2) { Ty1 += speed; Ty2 += speed; Ty3 += speed; speed += .02; }; if(turn == 1 && y_or_x == 0 && Ty1 >= top) { T2x1 -= o_speed; T2x2 -= o_speed; T2x3 -= o_speed; o_speed -= .02; }; if(turn == 2 && y_or_x == 1 && Ty1 >= top) { T3x1 += o_speed; T3x2 += o_speed; T3x3 += o_speed; o_speed += .02; }; glutPostRedisplay(); glutTimerFunc(33, TimerFunction, 1); } void ChangeSize(int w, int h) { GLfloat nRange = 100.0f; // Prevent a divide by zero if(h == 0) h = 1; // Set Viewport to window dimensions glViewport(0, 0, w, h); // Reset projection matrix stack glMatrixMode(GL_PROJECTION); glLoadIdentity(); // Establish clipping volume (left, right, bottom, top, near, far) if (w <= h) glOrtho (-nRange, nRange, -nRange*h/w, nRange*h/w, -nRange, nRange); else glOrtho (-nRange*w/h, nRange*w/h, -nRange, nRange, -nRange, nRange); // Reset Model view matrix stack glMatrixMode(GL_MODELVIEW); glLoadIdentity(); } int main(int argc, char* argv[]) { glutInit(&argc, argv); glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH); glutCreateWindow("Control Tower, Takeoff"); glutDisplayFunc(RenderScene); glutTimerFunc(33, TimerFunction, 1); glutReshapeFunc(ChangeSize); glutSpecialFunc(SpecialKeys); glutMouseFunc(MouseHandler); SetupRC(); glutMainLoop(); return 0; } PS: I''d like to have the program end when the user hits the Esc key! Thanks A lot!!! Visit rpcsite.com, opening fall of 2001.

Share this post

Link to post
Share on other sites