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

Sonec Borec Nguyen

Members
  • Content count

    10
  • Joined

  • Last visited

Community Reputation

117 Neutral

About Sonec Borec Nguyen

  • Rank
    Member
  1. Hi there, I read PhysX Guide for Vehicles, but there is only "theory + data" not "step by step tut" and with this I can't wrote simple car on plane in physx (I'm noob). If anyone has some samples, please post it here, thanks a lot.
  2. I found the solution, I look like an idi*t right now, it's really simple: [CODE] static float width=1366.0, height=768.0; void Resize (int x, int y) { width=(float)x; height=(float)y; } [/CODE] Then in Main method i'm using glutReshapeWindow(Resize)
  3. Ad 1) thanks, I'll google it Ad 2) I mean of coarse car with wheels (shape of the car could be a box), I didn't find examples for this and I'm newbie so it's difficult for me.
  4. Hi there, I'm new in OGL and especially in PhysX and I need to know, how I can apply PhysX on models. I'm using PhysX 3.1.2 and for PhysX 3 and above there aren't good simple tutorials for beginners (except official PhysX guide). For now I know how to create scene and actors and some shape, but I have some models (car and map) which I want to use in PhysX. So questions are: How I can apply map as plane (height map as ground) in PhysX ? How I can apply car as object on map/ground in PhysX ? Thanks for any help Now I have car and map in OpenGL and basic create physx scene: [img]http://sphotos-b.ak.fbcdn.net/hphotos-ak-ash4/397286_2477160304937_1482195368_n.jpg[/img]
  5. After some googling I found solution: on keyboard pressed "F": [CODE] if(fkey==false) { fkey=true; width=1366.0; height=768.0; glutFullScreen(); } else { fkey=false; width=800.0; height=600.0; glutPositionWindow(0,0); glutReshapeWindow(800,600); } [/CODE] I have some troubles with reshape function that reshaped fullscreen to window, but instead of size 800x600 was same as fullscreen 1366x768 and when I moved glutPositionWindow before Reshape method it worked
  6. Hi, I posted here my code for switching fullscreen/window, but main problem I have is Resize function, which I haven't, because I'm using 3D and 2D objects and I don't know how can I resize both (3d is OK, but both is complicated for me). Dispaly function: [CODE] // Display Function void Display(void) { glClearColor(0.3f, 0.5f, 0.9f, 0.0f); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // Set 3D glMatrixMode(GL_PROJECTION); glLoadIdentity(); glViewport(0, 0, (int)width, (int)height); gluPerspective(30, width/height, 0.1, 10000); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); // Set camera gluLookAt(cam1,27,130, 5,11,0, 0,1,0); glutPostRedisplay(); // Light and Z-buffer glPushAttrib(GL_ALL_ATTRIB_BITS); glEnable(GL_DEPTH_TEST); glEnable(GL_LIGHTING); glEnable(GL_LIGHT0); glLightfv(GL_LIGHT0, GL_POSITION, lightPos); glLightfv(GL_LIGHT0, GL_AMBIENT, lightAmb); glLightfv(GL_LIGHT0, GL_DIFFUSE, lightDiff); // Draw Map and Car glPushMatrix(); // load map obj glPushMatrix(); glTranslatef(x,y,z); glRotatef(-180, 0.0, 1.0, 0.0); glmDraw(map, GLM_SMOOTH | GLM_MATERIAL); glPopMatrix(); // load car obj glPushMatrix(); glTranslatef(x+carx, y+cary, z+carz); glRotatef(-180, 0.0, 1.0, 0.0); glmDraw(car, GLM_SMOOTH | GLM_MATERIAL); glPopMatrix(); glPopMatrix(); glPopAttrib(); glFlush(); // Set 2D glMatrixMode(GL_PROJECTION); glLoadIdentity(); gluOrtho2D(0,width,height,0); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); glDisable(GL_DEPTH_TEST); glDisable(GL_LIGHTING); // Draw text glPushMatrix(); glColor3f(1, 1, 1); renderBitmapString(10,20,(void *)font2,"Press 'H' for show/hide help"); glEnd(); glPopMatrix(); // Show help menu if(h1==true) { glTranslatef((float)((width-500)/2),(float)(500+((height-500)/2)),0); glPushMatrix(); glColor3f(1, 1, 1); glBegin(GL_QUADS); glVertex3f(0.0f, -500.0f, 0.0f); // The bottom left corner glVertex3f(0.0f, 0.0f, 0.0f); // The top left corner glVertex3f(500.0f, 0.0f, 0.0f); // The top right corner glVertex3f(500.0f, -500.0f, 0.0f); // The bottom right corner glEnd(); glPopMatrix(); glPushMatrix(); glColor3f(0, 0, 0); renderBitmapString(130,-440,(void *)font1,"P H Y S X C A R S I M U L A T O R"); renderBitmapString(190,-410,(void *)font2,"HELP MENU:"); renderBitmapString(60,-350,(void *)font2,"'K' = change to left-side camera"); renderBitmapString(60,-320,(void *)font2,"'L' = change to right-side camera"); renderBitmapString(60,-290,(void *)font2,"'ESC' = exit program"); renderBitmapString(60,-50,(void *)font1,"Author: Son Nguyen (NGU0013) Version: 1.0 , 2012"); glEnd(); glPopMatrix(); } [/CODE] I want Resize function that Set 2D and Set 3D block will be in it. Thanks
  7. I have bad resize function which is in Display method because I don't know how can I resize 3D and 2D in method outside of Display method
  8. Hi guys, I'm new in OGL, I found how to Enter and Leave Fullscreen in two different solutions: 1. glutFullScreen() and glutLeaveFullScreen() (doesn't work ... maybe old dll) 2. glutEnterGameMode and glutLeaveGameMode Now I have maybe badly constructed code, but works for me without fullscreen, if I want Fullscreen, I must change variables "width" and "height" and then run glutFullSreen method. I want fullscreen on key F when I draw ogl window with menu (simply switch fullscreen/window on key "F"). Now I have: [CODE] // MAIN.cpp - MAIN PROGRAM #include "main.h" // Variables float cam1=5; // Camera position float x=4250,y=-30,z=-7390; // Map position float carx=-4220,cary=0,carz=7210; // Car position float width=800.0, height=600.0; // Window size bool h1=false,k1=false,l1=false,f1=false; // F key for Help menu // Font settings const int font1=(int)GLUT_BITMAP_HELVETICA_12; const int font2=(int)GLUT_BITMAP_HELVETICA_18; // Light settings GLfloat lightAmb[3] = {0.1f, 0.1f, 0.1f}; GLfloat lightDiff[3] = {1.0f, 1.0f, 1.0f}; GLfloat lightPos[4]={0.0f, 0.0f, 0.0f, 1.0f}; // Models variables GLMmodel* car = NULL; GLMmodel* map = NULL; // Keyboard Function void Keyboard(unsigned char key, int xx, int yy) { glutPostRedisplay(); switch(key) { case 'h': // Show/hide help menu if(h1==false) h1=true; else h1=false; break; case 'k': // Left-side camera k1=true; cam1=-103; x=4400; break; case 'l': // Right-side camera l1=true; cam1=113; x=4100; break; case 'f' : // Fullscreen ON/OFF if(f1==false) { f1=true; } else { f1=false; } break; case 27 : // Stop program exit(0); } } // Keyboard UP Function void KeyboardUp(unsigned char key, int xx, int yy) { switch(key) { case 'k': // K key up k1=false; cam1=5; x=4250; break; case 'l': // L key up l1=false; cam1=5; x=4250; break; } } // Keyboard HOLD DOWN Function void myIdleFunc(void) { glutPostRedisplay(); if(k1) { // K key pressed cam1=-103; x=4400; } if(l1) { // L key pressed cam1=113; x=4100; } } // Initializing models void initModels(void) { // Set car model car = glmReadOBJ("Models/audi-tt.obj"); if (!car) exit(0); glmFacetNormals(car); glmVertexNormals(car, 90.0); // Set map model map = glmReadOBJ("Models/map.obj"); if (!map) exit(0); glmFacetNormals(map); glmVertexNormals(map, 90.0); } // Text Function void renderBitmapString(float x, float y, void *font,string str) { const char *c; glRasterPos2f(x, y); // Text position for (c=str.c_str(); *c != '\0'; c++) glutBitmapCharacter(font, *c); } // Display Function void Display(void) { glClearColor(0.3f, 0.5f, 0.9f, 0.0f); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // Set 3D glMatrixMode(GL_PROJECTION); glLoadIdentity(); glViewport(0, 0, (int)width, (int)height); gluPerspective(30, width/height, 0.1, 10000); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); // Set camera gluLookAt(cam1,27,130, 5,11,0, 0,1,0); glutPostRedisplay(); // Light and Z-buffer glPushAttrib(GL_ALL_ATTRIB_BITS); glEnable(GL_DEPTH_TEST); glEnable(GL_LIGHTING); glEnable(GL_LIGHT0); glLightfv(GL_LIGHT0, GL_POSITION, lightPos); glLightfv(GL_LIGHT0, GL_AMBIENT, lightAmb); glLightfv(GL_LIGHT0, GL_DIFFUSE, lightDiff); // Draw Map and Car glPushMatrix(); // load map obj glPushMatrix(); glTranslatef(x,y,z); glRotatef(-180, 0.0, 1.0, 0.0); glmDraw(map, GLM_SMOOTH | GLM_MATERIAL); glPopMatrix(); // load car obj glPushMatrix(); glTranslatef(x+carx, y+cary, z+carz); glRotatef(-180, 0.0, 1.0, 0.0); glmDraw(car, GLM_SMOOTH | GLM_MATERIAL); glPopMatrix(); glPopMatrix(); glPopAttrib(); glFlush(); // Set 2D glMatrixMode(GL_PROJECTION); glLoadIdentity(); gluOrtho2D(0,width,height,0); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); glDisable(GL_DEPTH_TEST); glDisable(GL_LIGHTING); // Draw text glPushMatrix(); glColor3f(1, 1, 1); renderBitmapString(10,20,(void *)font2,"Press 'H' for show/hide help"); glEnd(); glPopMatrix(); // Show help menu if(h1==true) { glTranslatef((float)((width-500)/2),(float)(500+((height-500)/2)),0); glPushMatrix(); glColor3f(1, 1, 1); glBegin(GL_QUADS); glVertex3f(0.0f, -500.0f, 0.0f); // The bottom left corner glVertex3f(0.0f, 0.0f, 0.0f); // The top left corner glVertex3f(500.0f, 0.0f, 0.0f); // The top right corner glVertex3f(500.0f, -500.0f, 0.0f); // The bottom right corner glEnd(); glPopMatrix(); glPushMatrix(); glColor3f(0, 0, 0); renderBitmapString(130,-440,(void *)font1,"P H Y S X C A R S I M U L A T O R"); renderBitmapString(190,-410,(void *)font2,"HELP MENU:"); renderBitmapString(60,-350,(void *)font2,"'K' = change to left-side camera"); renderBitmapString(60,-320,(void *)font2,"'L' = change to right-side camera"); renderBitmapString(60,-290,(void *)font2,"'ESC' = exit program"); renderBitmapString(60,-50,(void *)font1,"Author: Son Nguyen (NGU0013) Version: 1.0 , 2012"); glEnd(); glPopMatrix(); } glutSwapBuffers(); } // Main Function int main(int argc, char **argv) { cout << "Loading models ... "; initModels(); cout << "DONE" << endl; glutInit(&argc, argv); glutInitDisplayMode(GLUT_RGBA | GLUT_DOUBLE | GLUT_DEPTH); glutInitWindowSize((int)width, (int)height); glutInitWindowPosition(0, 0); glutCreateWindow("PhysX Car Simulator"); glutFullScreen(); initPhysX(); glutDisplayFunc(Display); glutKeyboardFunc(Keyboard); glutKeyboardUpFunc(KeyboardUp); glutIdleFunc(myIdleFunc); glutMainLoop(); deinitPhysX(); return 0; } [/CODE] Thanks for help.
  9. Thanks a lot, now it works like a charm
  10. Hi, I'm trying to make easy obj loader (loading car and map - two cars so far) and code looks good, but if I run it, cars looks bad: [img]http://img4.pixhost.org/images/1667/14252342_fuuu.png[/img] I don't know what's wrong. Can be some mistake in the code ? Please help, thanks [source lang="cpp"]// MAIN.cpp - MAIN PROGRAM #include <math.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <sstream> #include <iostream> #include "Lib\GL\headers\glut.h" #include "Lib\GL\glm\glm.h" using namespace std; // Variables float x=-26, y=-26, z=-500, deg_z=0, deg_y=0; int displayList=0; static int w=800,h=600; GLfloat lightPos[4] = {50.0, 30.0 ,0.0, 0.0}; GLfloat lightAmb[3] = {0.1, 0.1, 0.1}; GLfloat lightDiff[3] = {1.0, 1.0, 1.0}; GLMmodel* car = NULL; GLMmodel* car2 = NULL; void initmodel(void) { car = glmReadOBJ("Models/audi-tt.obj"); if (!car) exit(0); glmFacetNormals(car); glmVertexNormals(car, 90.0); car2 = glmReadOBJ("Models/audi-tt.obj"); if (!car2) exit(0); glmFacetNormals(car2); glmVertexNormals(car2, 90.0); } void setCamera() { if(h == 0) h = 1; float ratio = 1.0 * w / h; glMatrixMode(GL_PROJECTION); glLoadIdentity(); glViewport(0, 0, w, h); gluPerspective(30, ratio, 0.1, 10000); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); } void display(void) { setCamera(); glClearColor(0.3f, 0.5f, 0.9f, 0.0f); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glPushAttrib(GL_ALL_ATTRIB_BITS); glEnable(GL_LIGHTING); glEnable(GL_LIGHT0); glLightfv(GL_LIGHT0, GL_AMBIENT, lightPos); glLightfv(GL_LIGHT0, GL_AMBIENT, lightAmb); glLightfv(GL_LIGHT0, GL_DIFFUSE, lightDiff); //glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); glPushMatrix(); // load first obj glPushMatrix(); glTranslatef(x,y,z); glRotatef(deg_z, 1.0, 0.0, 0.0); glRotatef(deg_y, 0.0, 1.0, 0.0); glmDraw(car, GLM_SMOOTH | GLM_MATERIAL); glPopMatrix(); // load second obj glPushMatrix(); glTranslatef(x+200,y,z); glRotatef(deg_z, 1.0, 0.0, 0.0); glRotatef(deg_y, 0.0, 1.0, 0.0); glmDraw(car2, GLM_SMOOTH | GLM_MATERIAL); glPopMatrix(); glPopMatrix(); glPopAttrib(); glFlush(); glutSwapBuffers(); } void Keyboard(unsigned char key, int xx, int yy) { glutPostRedisplay(); switch(key) { case 'a' : x-=2; break; // Move left for X pos case 'd' : x+=2; break; // Move right for X pos case 's' : z+=2; break; // Move down for Z pos case 'w' : z-=2; break; // Move up for Z pos case '.' : y-=2; break; // Move up for Y pos case ',' : y+=2; break; // Move down for Y pos case 'k' : deg_z-=2.0; break; // Rotate up case 'i' : deg_z+=2.0; break; // Rotate down case 'j' : deg_y+=2.0; break; // Rotate left case 'l' : deg_y-=2.0; break; // Rotate right case 27 : exit(0); // Stop program } } void Resize(int w, int h) { if(h == 0) h = 1; float ratio = 1.0 * w / h; glMatrixMode(GL_PROJECTION); glLoadIdentity(); glViewport(0, 0, w, h); gluPerspective(30, ratio, 0.1, 1000); glMatrixMode(GL_MODELVIEW); } int main(int argc, char **argv) { initmodel(); glutInit(&argc, argv); glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH); glutInitWindowSize(800,600); glutCreateWindow(argv[0]); glutKeyboardFunc(Keyboard); glutDisplayFunc(display); glutMainLoop(); return 0; } [/source]