Jump to content
  • Advertisement

jumz

Member
  • Content Count

    13
  • Joined

  • Last visited

Community Reputation

117 Neutral

About jumz

  • Rank
    Member
  1. jumz

    Chess and OpenGL

      Quite new actually... I just started learning a short while ago :)
  2. Hi guys, I am trying to figure out how best to place pieces on a chessboard I created in opengl. Are there any tutorials anyone can point me to? Or just an explanation, I would like to figure it out on my own, just some pointers about how best to do this.   Its is a 3d chessboard that I have created in opengl already, and I have also exported my pieces from 3dsmax. but how do I display the board on the screen as well as specify the coordinates of the board so that each chesspiece can be on the centre of the square it has to be on?   Any help will be appreciated pls guys. I'm lost here.   Thanks!!
  3. jumz

    sdl error

    thanks a lot. that seems to have been the issue. Thanks again
  4. jumz

    sdl error

    hi, I keep having this error:   cannot open this source file #include <SDL/SDL.h>   what to do pls?
  5. Hi, I am trying to import chess pieces from 3dsmax to opengl. However, I am quite new to opengl and it has been a big challenge so far. Any help will be appreciated?   Pls and thank you  
  6. Hi, I am trying to import chess pieces from 3dsmax to opengl. However, I am quite new to opengl and it has been a big challenge so far. Any help will be appreciated?
  7. hi, how did you fix it pls? I have a similar issue
  8. Thanks for the tutorial link. Yes, I will be parsing the .obj format. As for the 3D chess board, pls check out my code so far and maybe point out where I'm missing it?   Thank you!
  9. The main error i have here is that it keeps complaining that the function drawBlackCell does not take three arguments > How do I fix this pls? Any help will be appreciated
  10.   Thank you so much. The website supplied has amazing tutorials. I'll def look into it! Yes, I am thinking of exporting the files in .obj format. Main problem is solving the issue of the board first
  11. I'm trying to create 5x5x5 chessboard in OpenGL. I have been able to design a 5x6, and 8x8 but the code just won't work for the 5x5. Can someone look over the code and maybe point out where my mistake is as the width just wont change to 5? Here is what I have been able to come up with so far:     #include<windows.h> #include <glut.h> #include <cstdlib> #include <iostream> #include <cmath> using namespace std; float _angle = 0; double i; int k; bool white_or_black;   GLuint _displayListId_blackArea; //The OpenGL id of the display list GLuint _displayListId_whiteArea; //The OpenGL id of the display list   void handleKeypress(unsigned char key,int x,int y) { switch(key) { case 27: exit(0); } }   void handleResize(int w,int h) { glViewport(0,0,w,h); glMatrixMode(GL_PROJECTION); glLoadIdentity(); gluPerspective(45.0,(double)w/(double)h,1.0,200); gluLookAt(0.0f,5.5f, 15.0f, 0.0f,0.0f,0.0f, 0.0f,1.0f,0.0f); }   void draw_BlackArea() { // glPushMatrix(); //glTranslatef(1.5f,0.0f,0.0f); glBegin(GL_QUADS); glColor3f(0.05f,0.05f,0.05f); glTranslatef(0.0f,0.0f,0.0f); glVertex3f(0.0f,0.0f,0.0f); glVertex3f(1.50f,0.0f,0.0f); glVertex3f(1.5f,0.3f,0.0f); glVertex3f(0.0f,0.3f,0.0f); glEnd();     glBegin(GL_QUADS); glColor3f(0.05f,0.05f,0.05f); glVertex3f(0.0f,0.0f,0.0f); glVertex3f(0.0f,0.0f,-1.5f); glVertex3f(0.0f,0.3f,-1.5f); glVertex3f(0.0f,0.3f,0.0f); glEnd();     glBegin(GL_QUADS); glColor3f(0.05f,0.05f,0.05f); glVertex3f(1.5f,0.0f,0.0f); glVertex3f(1.5f,0.0f,-1.5f); glVertex3f(1.5f,0.3f,-1.5f); glVertex3f(1.5f,0.3f,0.0f); glEnd();   glBegin(GL_QUADS); glColor3f(0.05f,0.05f,0.05f); glVertex3f(0.0f,0.0f,-1.5f); glVertex3f(1.50f,0.0f,-1.5f); glVertex3f(1.5f,0.3f,-1.5f); glVertex3f(0.0f,0.3f,-1.5f); glEnd();     glBegin(GL_QUADS); glColor3f(0.05f,0.05f,0.05f); glVertex3f(0.0f,0.0f,0.0f); glVertex3f(1.50f,0.0f,0.0f); glVertex3f(1.5f,0.0f,-1.5f); glVertex3f(0.0f,0.0f,-1.5f); glEnd();     glBegin(GL_QUADS); glColor3f(0.0f,0.0f,0.0f); glVertex3f(0.0f,0.3f,0.0f); glVertex3f(1.50f,0.3f,0.0f); glVertex3f(1.5f,0.3f,-1.5f); glVertex3f(0.0f,0.3f,-1.5f); glEnd(); //    glPopMatrix();   } void draw_whiteArea() { // glPushMatrix(); glBegin(GL_QUADS); glColor3f(0.05f,0.05f,0.05f); glTranslatef(0.0f,0.0f,0.0f); glVertex3f(0.0f,0.0f,0.0f); glVertex3f(1.50f,0.0f,0.0f); glVertex3f(1.5f,0.3f,0.0f); glVertex3f(0.0f,0.3f,0.0f); glEnd();     glBegin(GL_QUADS); glColor3f(0.05f,0.05f,0.05f); glVertex3f(0.0f,0.0f,0.0f); glVertex3f(0.0f,0.0f,-1.5f); glVertex3f(0.0f,0.3f,-1.5f); glVertex3f(0.0f,0.3f,0.0f); glEnd();     glBegin(GL_QUADS); glColor3f(0.05f,0.05f,0.05f); glVertex3f(1.5f,0.0f,0.0f); glVertex3f(1.5f,0.0f,-1.5f); glVertex3f(1.5f,0.3f,-1.5f); glVertex3f(1.5f,0.3f,0.0f); glEnd();   glBegin(GL_QUADS); glColor3f(0.05f,0.05f,0.05f); glVertex3f(0.0f,0.0f,-1.5f); glVertex3f(1.50f,0.0f,-1.5f); glVertex3f(1.5f,0.3f,-1.5f); glVertex3f(0.0f,0.3f,-1.5f); glEnd();     glBegin(GL_QUADS); glColor3f(0.05f,0.05f,0.05f); glVertex3f(0.0f,0.0f,0.0f); glVertex3f(1.50f,0.0f,0.0f); glVertex3f(1.5f,0.0f,-1.5f); glVertex3f(0.0f,0.0f,-1.5f); glEnd();     glBegin(GL_QUADS); glColor3f(1.0f,1.0f,1.0f); glVertex3f(0.0f,0.3f,0.0f); glVertex3f(1.50f,0.3f,0.0f); glVertex3f(1.5f,0.3f,-1.5f); glVertex3f(0.0f,0.3f,-1.5f); glEnd(); // glPopMatrix();   }   void initRendering() { glEnable(GL_DEPTH_TEST); glEnable(GL_COLOR_MATERIAL); glClearColor(0.0f,0.0f,0.2f,1.0f); //Set up a display list for drawing a cube _displayListId_blackArea = glGenLists(1); //Make room for the display list glNewList(_displayListId_blackArea, GL_COMPILE); //Begin the display list draw_BlackArea(); //Add commands for drawing a black area to the display list glEndList(); //End the display list   //Set up a display list for drawing a cube _displayListId_whiteArea = glGenLists(2); //Make room for the display list glNewList(_displayListId_whiteArea, GL_COMPILE); //Begin the display list draw_whiteArea(); //Add commands for drawing a black to the display list glEndList(); //End the display list }     void drawScene() { glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); glTranslatef(-2.5*1.5, 0.0, 2.5*1.5);   const unsigned BOARD_SIZE = 5;   for(unsigned i = 0; i < BOARD_SIZE; ++i){  for(unsigned j = 0; j < BOARD_SIZE; ++j){     drawBoardCell(i,j, (i*BOARD_SIZE + j) % 2 == 0);   } }   } void drawBoardCell(const int row, const int col, const bool isBlack){   glPushMatrix();   glTranslatef(col+1.5,0.0,row);   const int callId = isBlack ? _displayListId_blackArea : _displayListId_whiteArea;   glCallList(callId);   glPopMatrix();   }   int main(int argc,char** argv) { glutInit(&argc,argv); glutInitDisplayMode(GLUT_DOUBLE|GLUT_RGB|GLUT_DEPTH); glutInitWindowSize(400,400);   glutCreateWindow("chessboard"); initRendering(); glutFullScreen();   glutDisplayFunc(drawScene); glutKeyboardFunc(handleKeypress); glutReshapeFunc(handleResize);   glutMainLoop();   return 0;   }
  12. Hi all, I really need some help here. I am developing a 3d chess game, and I have chosen to use the 5x5x5 variant.However, I am at a loose end as I just started learning opengl and c++, and woud really appreciate some help here. I have designed my chess pieces in 3ds max, but i need to export them into opengl. Also, how do I go about creating a 5x5x5 3D board in opengl? I  any help will be appreciated pls.  
  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!