开发者

how to draw pool table pockets opengl c++

开发者 https://www.devze.com 2023-02-24 17:01 出处:网络
hey i am creating a pool table simulator in opengl written in c++ i have the basic table drawn but now i need to add some pockets

hey i am creating a pool table simulator in opengl written in c++ i have the basic table drawn but now i need to add some pockets i want the pockets to be 开发者_运维技巧a basic curve like a C shape im not quite sure how to do this i have experimented with trianglefan but iv had no luck can anyone help please?

also i must add this is part of a university project therefore i will only be using the core opengl and c++....no other tools thanks in advance


When I use OpenGL, I usually build the models in something like Blender.

Blender is free and allows export to WaveFront obj - an easy format to read in to your program. Or you can use the simple text WaveFront obj with a little scripted editing will produce a list of vertices that you can use in arrays for vertex buffer objects.

I couldn't imagine trying to build objects for a 3D scene using only discrete values and discrete math like (I think?) you're describing.


Do you have access to glu.lib?

http://en.wikipedia.org/wiki/OpenGL_Utility_Library http://www.opengl.org/resources/faq/technical/glu.htm

That would easily make cylinders or NURBS curves for the pockets. Sample use of it is here: http://nehe.gamedev.net/data/lessons/lesson.asp?lesson=18

There is also lots of code from the "Graphics Gems" series available - you can dig through the early books for something suitable if GLU isn't an option. http://www.graphicsgems.org/


Start with a cube and slice off the bottom corners. Refine as necessary.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号