C++ Displaying .x models

Started by
6 comments, last by Borgleader 16 years, 6 months ago
Hi, I'm totally new to C++ programming. I started only 3-4 days ago. I bought myself a C++ beginner book and loved it. But more specifically I loved the part about OpenGl. But seeing how many lines it takes just to make a cube, I figured writing the lines of code for any model more complex than a cube or any other primitive would be suicide or at the very least a big waste of time, not to mention that it leaves no space for flexibility. Then came to me the idea of displaying models from external files. I have been playing around with Blender a bit, and I thought that the DirectX file (.x) would be a good file type to use. I was unable to find a way to use this in C++ though. I was wondering if anyone had any links or sample code to help me out. I dont mind if it displays the file in a DirectX or OpenGl window, I would prefer OpenGL as I've worked with it before but it doesn't matter much (if have the DirectX SDK installed on my computer, and I'm using Microsoft Visual C++ 2008 Express Edition (Beta 2)). Thank you, Borg.
Advertisement
Haven't used DirectX in a long time, so I don't know if you can still use a MeshBuilder to easily load .x models, but if you want to do it in OpenGL This article may be an interesting read.
woah, your going way to fast... all your doing right now is copy/pasting your code to get your results. You shouldnt even be thinking about opengl for a couple of months until you have a good understanding of c++, which in 3-4 days, you can not get.
I just want a working code to display a 3d model in opengl OR directx in order to play with it (rotation, translation and all the fun stuff). The reasons I want to load the model from a file are quite simple :
1. Its a LOT more flexible
2. Its a much quicker, no code to write all I need to do is export it from blender.

I might also try some effects or wtv else, but being able to load a model file right now is what I want.
I think you should start with a simpler model format such as .obj.
One way or the other, my point was to animate the models using simple transformations, the file can be.x .obj or whatever else you want all I wanted to do was to rotato them, scale them and such.

But anyway, I think I'll go through some of the tutorials on Nehe's website. I've read theyre quite useful.
if you plan on using obj's, look at the OpenGL FAQ it answers that question among others.
Sick, thanks I'll read that as soon as I have a few hours of free time :) (and a laptop to code on)

This topic is closed to new replies.

Advertisement