Sign in to follow this  
Steve5050

OpenGL .X Files In Opengl

Recommended Posts

Hi, Has anyone converted the code from this Articles Code to C# or Vb.Net 0r some language that is easier to understand then Dev C Plus Plus Or has any found a way to use .x files in Opengl without Dx. I don't want to use any third party controls or dlls. Thanks Steve

Share this post


Link to post
Share on other sites
Well, to give you a general sense of what you'll need to do:

(1) Learn about all the aspects of an .x file.
(2) Learn how it's set up
(3) Write an importer for it using GL primitives.

Ta da!

Search around using google, I'm sure there are some similar experiences. And seeing if there's any source code for OGL .x importers already that you can look at would help too.

FlyingIsFun1217

Share this post


Link to post
Share on other sites
If you've already studied the format it should be quite trivial to create a parser for it. Maybe google some tutorials on parsing text files.

Is it the parsing of the data which is giving you the problem, or is it a rendering problem. I've written code in c++ for openGL as well as for c# for directx( I wanted to load the data into my own formats rather then use the directx ones ).

Just let us know exactly what part of it you're getting caught up on and we can probably provide more help.

Share this post


Link to post
Share on other sites
I wanted to know if anyone converted
the code in that article so I didn't have
to do it if it was already done.

I don't want to convert because it will be
a handful of trouble.

I will find a lot of non equals between the
languages which will be a problem.

I have a lot of x files and I want to use them
in my gl app.

I haven't done any file parsing so it won't be
easy to do.

I have some vb not vb.net code of some of not all
of the .x file format being parsed.

It is going to be a big job to get it right.

If you know how to parse an x file and use it
with vb.net that would be cool.

Thanks
Steve

Share this post


Link to post
Share on other sites
While he's being a little blunt, I believe his point is that if you don't want to take the time to learn how to parse an ascii file then you're probably going to run into some much bigger road blocks down the road.

Maybe you should take a step back from trying to learn OpenGL for now and try writing some text based games to help build up your programming skills. If you don't want to delve deeper into parsing a 3d data file, why not try something easier to get your feet wet. I would recommend creating an ini file with key-value pairs in it and try parsing that. It will be useful to have down the road and will give you an initial feel for how to parse data

Share this post


Link to post
Share on other sites
I don't need to step back from anything.

All I asked was If anybody converted that
code from the article.

I don't need Ta Da!s

I started my own xfile loader yesterday, it
will be done.

I don't back down from a good challenge.

I was just lookin for another way.
If someone had shown me a way to write
a xfile loader, what would be so wrong with
that.

I could still learn from that,right?

Steve

Share this post


Link to post
Share on other sites
Hmmm not really, you can't generally learn by just looking at someone else's code. You need to understand the techniques behind it and how things work before you can actually learn something. I mean you could probably come away from it knowing how it works but you can't really learn the principles behind it.
I should point out though that you say "if someone had shown me a way to write
a xfile loader, what would be so wrong with that." but that article you posted at the beginning does show you how to write an xfile loader. What you're really looking for is someone to write a visual basic .net loader for you, in the end though I don't think you would actually come away with anything from that.

Share this post


Link to post
Share on other sites
Yeah, I was just pointing out that you need to know what to do before you do it.

That was my biggest problem (and still is, to a small degree), thinking that I could copy, mix, and match code, and understand it too.

Later on, when I started game development, I realized I was only fooling myself. And because of that, I am still learning when I could be farther ahead than I am.

Hopefully you'll learn something out of it, whether or not you struggle.

FlyingIsFun1217

Share this post


Link to post
Share on other sites
I actually started out using directx more than
a few years ago, I didn't like it and also when
I ran an app, there was always 100% cpu usage.

So I have dealt with x files before.

I understand the meshes,templates,materials and all
that stuff.

I had a 3d modeler application that was exporting xfiles
with extra commas that wouldn't work in my application, I wrote
a line by line app to knock off the commas. I worked that out on my
own.

I've used other engines Irrlict I used that and it was buggy and
100% cpu.

I bought Torgue years ago and that was a total waste.

So now I'm using opengl and it's going good,low cpu usage which
is good,all kinds of good things.

I don't need someone to give me vb.net code.

I'll make the loader and I'll have it working shortly.

Steve

Share this post


Link to post
Share on other sites
How are you using openGL and not getting 100% cpu, you must be using some kind of threading library. The reason you get 100% cpu is because you don't have some kind of sleep call in your code.
You shouldn't call another engine buggy just because you didn't know how to use it. It always bothers me when programmers say something is buggy because they refuse to give the time to learning it. How was torque a waste of time? Did you just not understand how to use it?
Knocking out a couple comma's is not parsing a file. You really really need to take a step back and go back to learning how the language actually works.
I would recommend you take a step back, try making something much simpler, maybe text based black jack, or a text based adventure game.
If you really don't want to learn programming, maybe take a look at the game maker's which are available out there.

Share this post


Link to post
Share on other sites
Steve5050:

1) Please stop hitting enter after every couple of words you type. This makes your posts very painful to read.

2) 100% CPU usage has absolutely nothing to do with the rendering API you use. It has to do with the way you interact with the Windows process scheduler. If you correctly process the Windows message queue with blocking wait calls or appropriately placed sleeps, you will not get constant 100% usage on either D3D or OpenGL.

3) 100% CPU usage is actually a good thing for CPU intensive applications that aren't user input event driven, such as games.

As others have suggested, you're trying to do something way over your head. Try to go a step backwards, and learn about the basics first. Writing a parser for an X file is a good learning step, and not very difficult to do.

Oh, and the article is not written in "Dev C Plus Plus", but in C++. DevC++ is an integrated development environment. C++ is the language.

Share this post


Link to post
Share on other sites
Quote:
Original post by Steve5050
I've used other engines Irrlict I used that and it was buggy and
100% cpu.


It is not because of Irrlict that CPU usage goes to 100%. It is because you are running an infinite loop, very much like the rest of the world does when they are doing a game.
The other option is to make your program input driver, like 3d Studio max, Blender, Maya, ...

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this  

  • Announcements

  • Forum Statistics

    • Total Topics
      628401
    • Total Posts
      2982459
  • Similar Content

    • By test opty
      Hi all,
       
      I'm starting OpenGL using a tut on the Web. But at this point I would like to know the primitives needed for creating a window using OpenGL. So on Windows and using MS VS 2017, what is the simplest code required to render a window with the title of "First Rectangle", please?
       
       
    • By DejayHextrix
      Hi, New here. 
      I need some help. My fiance and I like to play this mobile game online that goes by real time. Her and I are always working but when we have free time we like to play this game. We don't always got time throughout the day to Queue Buildings, troops, Upgrades....etc.... 
      I was told to look into DLL Injection and OpenGL/DirectX Hooking. Is this true? Is this what I need to learn? 
      How do I read the Android files, or modify the files, or get the in-game tags/variables for the game I want? 
      Any assistance on this would be most appreciated. I been everywhere and seems no one knows or is to lazy to help me out. It would be nice to have assistance for once. I don't know what I need to learn. 
      So links of topics I need to learn within the comment section would be SOOOOO.....Helpful. Anything to just get me started. 
      Thanks, 
      Dejay Hextrix 
    • By mellinoe
      Hi all,
      First time poster here, although I've been reading posts here for quite a while. This place has been invaluable for learning graphics programming -- thanks for a great resource!
      Right now, I'm working on a graphics abstraction layer for .NET which supports D3D11, Vulkan, and OpenGL at the moment. I have implemented most of my planned features already, and things are working well. Some remaining features that I am planning are Compute Shaders, and some flavor of read-write shader resources. At the moment, my shaders can just get simple read-only access to a uniform (or constant) buffer, a texture, or a sampler. Unfortunately, I'm having a tough time grasping the distinctions between all of the different kinds of read-write resources that are available. In D3D alone, there seem to be 5 or 6 different kinds of resources with similar but different characteristics. On top of that, I get the impression that some of them are more or less "obsoleted" by the newer kinds, and don't have much of a place in modern code. There seem to be a few pivots:
      The data source/destination (buffer or texture) Read-write or read-only Structured or unstructured (?) Ordered vs unordered (?) These are just my observations based on a lot of MSDN and OpenGL doc reading. For my library, I'm not interested in exposing every possibility to the user -- just trying to find a good "middle-ground" that can be represented cleanly across API's which is good enough for common scenarios.
      Can anyone give a sort of "overview" of the different options, and perhaps compare/contrast the concepts between Direct3D, OpenGL, and Vulkan? I'd also be very interested in hearing how other folks have abstracted these concepts in their libraries.
    • By aejt
      I recently started getting into graphics programming (2nd try, first try was many years ago) and I'm working on a 3d rendering engine which I hope to be able to make a 3D game with sooner or later. I have plenty of C++ experience, but not a lot when it comes to graphics, and while it's definitely going much better this time, I'm having trouble figuring out how assets are usually handled by engines.
      I'm not having trouble with handling the GPU resources, but more so with how the resources should be defined and used in the system (materials, models, etc).
      This is my plan now, I've implemented most of it except for the XML parts and factories and those are the ones I'm not sure of at all:
      I have these classes:
      For GPU resources:
      Geometry: holds and manages everything needed to render a geometry: VAO, VBO, EBO. Texture: holds and manages a texture which is loaded into the GPU. Shader: holds and manages a shader which is loaded into the GPU. For assets relying on GPU resources:
      Material: holds a shader resource, multiple texture resources, as well as uniform settings. Mesh: holds a geometry and a material. Model: holds multiple meshes, possibly in a tree structure to more easily support skinning later on? For handling GPU resources:
      ResourceCache<T>: T can be any resource loaded into the GPU. It owns these resources and only hands out handles to them on request (currently string identifiers are used when requesting handles, but all resources are stored in a vector and each handle only contains resource's index in that vector) Resource<T>: The handles given out from ResourceCache. The handles are reference counted and to get the underlying resource you simply deference like with pointers (*handle).  
      And my plan is to define everything into these XML documents to abstract away files:
      Resources.xml for ref-counted GPU resources (geometry, shaders, textures) Resources are assigned names/ids and resource files, and possibly some attributes (what vertex attributes does this geometry have? what vertex attributes does this shader expect? what uniforms does this shader use? and so on) Are reference counted using ResourceCache<T> Assets.xml for assets using the GPU resources (materials, meshes, models) Assets are not reference counted, but they hold handles to ref-counted resources. References the resources defined in Resources.xml by names/ids. The XMLs are loaded into some structure in memory which is then used for loading the resources/assets using factory classes:
      Factory classes for resources:
      For example, a texture factory could contain the texture definitions from the XML containing data about textures in the game, as well as a cache containing all loaded textures. This means it has mappings from each name/id to a file and when asked to load a texture with a name/id, it can look up its path and use a "BinaryLoader" to either load the file and create the resource directly, or asynchronously load the file's data into a queue which then can be read from later to create the resources synchronously in the GL context. These factories only return handles.
      Factory classes for assets:
      Much like for resources, these classes contain the definitions for the assets they can load. For example, with the definition the MaterialFactory will know which shader, textures and possibly uniform a certain material has, and with the help of TextureFactory and ShaderFactory, it can retrieve handles to the resources it needs (Shader + Textures), setup itself from XML data (uniform values), and return a created instance of requested material. These factories return actual instances, not handles (but the instances contain handles).
       
       
      Is this a good or commonly used approach? Is this going to bite me in the ass later on? Are there other more preferable approaches? Is this outside of the scope of a 3d renderer and should be on the engine side? I'd love to receive and kind of advice or suggestions!
      Thanks!
    • By nedondev
      I 'm learning how to create game by using opengl with c/c++ coding, so here is my fist game. In video description also have game contain in Dropbox. May be I will make it better in future.
      Thanks.
  • Popular Now