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

Dannyli

Members
  • Content count

    16
  • Joined

  • Last visited

Community Reputation

135 Neutral

About Dannyli

  • Rank
    Member
  1. can I use   g_pd3dDevice->SetViewport() ?
  2. in opengl, if I want move an object ,a box, I can type: glPushMatrix(); glTranslatef(x,y,z); drawBox(); glPopMatrix(); Can someone tell me how to do the same effect in Directx?
  3. tic tac toe is in 3x3 Right?
  4. can I use the function: glPushAttrib(); and glPopAttrib();?
  5. I use the following code to generate two textures: ter=Loadtexture("terrain.bmp",ter); cross=Loadtexture("cross.bmp",cross); but all the objects in the scence are bind with texture  cross=Loadtexture("cross.bmp",cross); can someone tell me why?
  6. you are right . thanks a lot
  7. I am a novice in the tree design. I have a question about the code : void baiscobj::ShowTree(float x,float z,float h,float s,int cactus) { glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glEnable(GL_ALPHA_TEST); glAlphaFunc(GL_GREATER, 0); float mat[16]; glGetFloatv(GL_MODELVIEW_MATRIX, mat); vector3_t X(mat[0], mat[4], mat[8]); vector3_t Z(mat[1], mat[5], mat[9]); glBindTexture(GL_TEXTURE_2D, g_cactus[cactus]); vector3_t pos(x,0.0,-z); pos.y = GetHeight(x, -z) + h + s; glBegin(GL_QUADS); glTexCoord2f(0.0,0.0);glVertex3fv((pos+(X+Z)*-h).v);//left down glTexCoord2f(1.0,0.0);glVertex3fv((pos+(X-Z)* h).v);//up down glTexCoord2f(1.0,1.0);glVertex3fv((pos+(X+Z)* h).v);//up right glTexCoord2f(0.0,1.0);glVertex3fv((pos+(Z-X)* h).v);//left up glEnd(); glDisable(GL_ALPHA); glDisable(GL_BLEND); } why the line glVertex3fv((pos+(X+Z)*-h).v); can rotate the point? pos+(X+Z)*-h is a translation , isn't it?  
  8. I am using visual stdio 2010 the error appears at  void Loadobj(char*filename) { string line; ifstream objfile(filename); if(objfile.is_open()) { while(!objfile.eof()) { getline(objfile,line); if(line.c_str()[0]=='v') { float tmpx,tmpy,tmpz; sscanf(line.c_str(),"v %f %f %f",&tmpx,&tmpy,&tmpz); v.push_back(vertex(tmpx,tmpy,tmpz)); } if(line.c_str()[0]=='f') { int a,b,c,d; sscanf(line.c_str(),"f %d//%d %d//%d %d//%d",&a,&b,&c,&b,&d,&b); f.push_back(face(a,c,d)); } } } } because I only use this function
  9. And I also get warning that I can't use "sscanf" how to  fix this problem??
  10. I try to load the obj file to the opengl but the system crash, I tested My code in console system: #include <iostream> #include <string> #include <vector> #include <fstream> #include <ostream> #include <algorithm> #include <Windows.h> using namespace std; class vertex {public: float f1; float f2; float f3; vertex(float F1,float F2, float F3):f1(F1),f2(F2),f3(F3){}; };//the vertex class face{ public: int a; int b; int c; int d; bool four; face(int x,int y,int z):a(x),b(y),c(z){four =false;}; face(int x,int y,int z,int k):a(x),b(y),c(z),d(k){four =true;}; }; vector<vertex>v; vector<face>f; void loadvertex(char*filename){ ifstream infile(filename); ofstream outfile("out.txt"); float f1,f2,f3; char buffer; if(!infile.is_open()) {return; } while(infile>>buffer>>f1>>f2>>f3){ if(buffer=='v') {outfile<<f1<<" "<<f2<<" "<<f3<<endl; cout<<f1<<" "<<f2<<" "<<f3<<endl; v.push_back(vertex(f1,f2,f3));} } infile.close(); outfile.close(); } void loadface(char*filename){ ifstream infile(filename); ofstream outfile("out.txt"); int f1,f2,f3; char buffer; if(!infile.is_open()) {return; } while(infile>>buffer>>f1>>f2>>f3){ if(buffer=='f'){ outfile<<f1<<" "<<f2<<" "<<f3<<endl; cout<<f1<<" "<<f2<<" "<<f3<<endl; f.push_back( face(f1,f2,f3)); } } infile.close(); outfile.close(); } void Loadobj(char*filename) { string line; ifstream objfile(filename); if(objfile.is_open()) { while(!objfile.eof()) { getline(objfile,line); if(line.c_str()[0]=='v') { float tmpx,tmpy,tmpz; sscanf(line.c_str(),"v %f %f %f",&tmpx,&tmpy,&tmpz); v.push_back(vertex(tmpx,tmpy,tmpz)); } if(line.c_str()[0]=='f') { int a,b,c,d; sscanf(line.c_str(),"f %d//%d %d//%d %d//%d",&a,&b,&c,&b,&d,&b); f.push_back(face(a,c,d)); } } } } int main(){ Loadobj("cube.txt"); for(int i=0;i<f.size();i++) { float F1=v[f[i].a-1].f1; float F2=v[f[i].a-1].f2; float F3=v[f[i].a-1].f3; cout<<F1<<"--"<<F2<<"--"<<F3<<endl; } system("pause"); return 0; } the obj file:   # Blender3D v249 OBJ File:  # www.blender3d.org v 1.000000 1.000000 -1.000000 v 1.000000 -1.000000 -1.000000 v -1.000000 -1.000000 -1.000000 v -1.000000 1.000000 -1.000000 v 1.000000 0.999999 1.000000 v 0.999999 -1.000001 1.000000 v -1.000000 -1.000000 1.000000 v -1.000000 1.000000 1.000000 vn 0.000000 1.000000 0.000000 vn -1.000000 0.000000 -0.000000 vn -0.000000 -1.000000 -0.000000 vn 1.000000 0.000000 -0.000000 vn 1.000000 -0.000001 0.000000 vn 0.000000 0.000000 1.000000 vn 0.000000 0.000000 -1.000000 usemtl Material s off f 5//1 1//1 4//1 f 5//1 4//1 8//1 f 3//2 7//2 8//2 f 3//2 8//2 4//2 f 2//3 6//3 3//3 f 6//3 7//3 3//3 f 1//4 5//4 2//4 f 5//5 6//5 2//5 f 5//6 8//6 6//6 // the error shows that: ... if (longone) //                                    *(long UNALIGNED *)pointer = (unsigned long)number;   //                             else...
  11. void texload(int i,char *filename) { BITMAPINFOHEADER bitmapInfoHeader; unsigned char* bitmapData; bitmapData = LoadBitmapFile(filename, &bitmapInfoHeader); glBindTexture(GL_TEXTURE_2D, texture[i]); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);//filter glTexImage2D(GL_TEXTURE_2D, 0,GL_RGB,bitmapInfoHeader.biWidth,bitmapInfoHeader.biHeight,0,GL_RGB,GL_UNSIGNED_BYTE,bitmapData); }     The compiler throw out exception on the line glTexImage2D(GL_TEXTURE_2D, 0,GL_RGB,bitmapInfoHeader.biWidth,bitmapInfoHeader.biHeight,0,GL_RGB,GL_UNSIGNED_BYTE,bitmapData);   My BMP file is 252x255, is that too big for my function?
  12. Thanks for help, I've figured them out.
  13. So this sample draw a triangle with three color points, or a blending color triangle? HRESULT InitVB() { //user's data of the points CUSTOMVERTEX vertices[] = { { 100.0f, 400.0f, 0.5f, 1.0f, 0xffff0000, }, { 300.0f, 50.0f, 0.5f, 1.0f, 0xff00ff00, }, { 500.0f, 400.0f, 0.5f, 1.0f, 0xff0000ff, }, }; //creat the point buffer area if( FAILED( g_pd3dDevice->CreateVertexBuffer( 3*sizeof(CUSTOMVERTEX), 0, D3DFVF_CUSTOMVERTEX, D3DPOOL_DEFAULT, &g_pVB, NULL ) ) ) { return E_FAIL; } //blend VOID* pVertices; if( FAILED( g_pVB->Lock( 0, sizeof(vertices), (void**)&pVertices, 0 ) ) ) return E_FAIL; memcpy( pVertices, vertices, sizeof(vertices) ); g_pVB->Unlock(); return S_OK; }
  14. CUSTOMVERTEX vertices[] = { { 100.0f, 400.0f, 0.5f, 1.0f, 0xffff0000, }, { 300.0f, 50.0f, 0.5f, 1.0f, 0xff00ff00, }, { 500.0f, 400.0f, 0.5f, 1.0f, 0xff0000ff, }, };   what means "  0xffff0000?" ?    I know 100.0f, 400.0f, 0.5f, 1.0f, means the point
  15. I use the tutotial of the object loading on the opengl and I got the error as below on the Visual studio 2010 1>jpeg.lib(jerror.obj) : error LNK2019: unresolved external symbol __iob referenced in function _output_message how to fixed it?