Jump to content

  • Log In with Google      Sign In   
  • Create Account


Chess and OpenGL


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
4 replies to this topic

#1 Jaey   Members   -  Reputation: 117

Like
0Likes
Like

Posted 12 March 2013 - 04:32 PM

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!!



Sponsor:

#2 blueshogun96   Crossbones+   -  Reputation: 856

Like
1Likes
Like

Posted 12 March 2013 - 07:23 PM

Question, how new are you to OpenGL?  I have the feeling you're getting a bit ahead of yourself; trying to take on a project that may be a bit too large for your current skill level.  Sorry if I'm wrong, but that's sorta the vibe I'm getting.

 

If you already have your chess pieces exported from 3dsmax, what you need to do is export them to a 3d file format that's easy to read/parse.  3DS, MD2, LWO, OBJ, etc. are good formats to start off with.  If you have never written a 3D mesh file loader, then you need to start there.  After you've chosen your file format, you need to read in the vertex data and then you translate the meshes to their respective positions.  If you know the size of your chess board, then putting the chess peices in their respective squares just requires you to translate them by multiplying the square size by the number of squares from the origin.

 

Back to the 3D loader part, if you cannot write your own 3D loader, then give Assimp a try: http://assimp.sourceforge.net/

 

If you want some sample code that specifically deals with a chess game with OpenGL, check out the SGI page here and click the chess example: http://www.sgi.com/products/software/opengl/examples/more_samples/

 

There's another one out there, but I can't remember where it is.  I'll have to find it again because it actually plays through an entire game of chess while moving the pieces on it's own.

 

Shogun.


Follow Shogun3D on the official website: http://shogun3d.net

 

blogger.png twitter.png tumblr_32.png facebook.png


#3 Vortez   Crossbones+   -  Reputation: 2688

Like
0Likes
Like

Posted 12 March 2013 - 07:42 PM

Having done one myself (link1, link2), all you need to do is to export the pieces centered on the (x,z) axis, then precompute the pieces position for every case, depending on the scale of your chessboard. I read the pieces position using a modified version of the fimbulwinter AI i've found fews years ago, and it's very good for a free one (rating of about 1600). Would like to help you more but im using my own exporter and 3d engine so, unless you want it, your gonna have to learn this stuff yourself, wich isn't a bad thing to do, i've leaned most of the stuff i know today building this project.


Edited by jbadams, 04 April 2013 - 05:48 AM.
Restored post contents from history.


#4 Jaey   Members   -  Reputation: 117

Like
0Likes
Like

Posted 13 March 2013 - 03:53 AM

Question, how new are you to OpenGL?  I have the feeling you're getting a bit ahead of yourself; trying to take on a project that may be a bit too large for your current skill level.  Sorry if I'm wrong, but that's sorta the vibe I'm getting.

 

Quite new actually... I just started learning a short while ago :)



#5 blueshogun96   Crossbones+   -  Reputation: 856

Like
0Likes
Like

Posted 14 March 2013 - 12:37 PM

Question, how new are you to OpenGL?  I have the feeling you're getting a bit ahead of yourself; trying to take on a project that may be a bit too large for your current skill level.  Sorry if I'm wrong, but that's sorta the vibe I'm getting.

 

Quite new actually... I just started learning a short while ago smile.png

 

In this case I think you might want to slow down just a bit.  My recommendation is that you take more time to study and practice using OpenGL before taking on a full blown 3D project of any size.  Do you have a good understanding of matrix transformations?  In your case, this is very important!

 

A chess game is a bit more complicated than it sounds for a beginner.  I remember writing a really basic 3rd person shooter as a tutorial once and because my OpenGL skills weren't solid, it took a little longer than I expected.  Even now, I think I should rewrite parts of it for OpenGL 3+, and maybe submit an article about it since I've learned so much more since then ^_^.

 

So my suggestion is to take your time and learn at a pace that works for you.  Then when you feel comfortable with OpenGL in general, then try again. smile.png

 

Shogun


Follow Shogun3D on the official website: http://shogun3d.net

 

blogger.png twitter.png tumblr_32.png facebook.png





Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS