Horde3D

Next-Generation Graphics Engine
It is currently 28.09.2024, 22:30

All times are UTC + 1 hour




Post new topic Reply to topic  [ 33 posts ]  Go to page 1, 2, 3  Next
Author Message
 Post subject: my first app
PostPosted: 03.05.2007, 10:42 
Offline

Joined: 05.03.2007, 19:38
Posts: 167
Location: Romania
i`m trying to make my first app based on the "SMAL TUTORIAL" adding the necessary code like include paths for "Horde3D.h" and "Horde3DUtils.h" initializing and destroying OpenGL and adding the libs under input. That`s basically it. It compiles fine but it doesn`t link. i get this error
Code:
LIBCMT.lib(wincrt0.obj) : error LNK2001: unresolved external symbol _WinMain@16
D:\Work\coding\Horde_App\Release\Horde_App.exe : fatal error LNK1120: 1 unresolved externals


i have tried to complete it looking at the chicago demo but, well, i`m just starting with c++ but it doesn`t work as expected. I am taking a C++ course at the university i am going, but i`ve just started and i understand the basics of c++ oop coding but it is obvious that i do not know enough.

can somebody pls complete the "small tutorial" with the needed code to just copy/paste it in a cpp file in an empty project? This way i can understand the inner workings of horde3d an be on my way happy coding

Thanks! :)


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: 03.05.2007, 11:47 
Offline

Joined: 03.05.2007, 11:26
Posts: 26
I have just tried to use the very same example tute code and thought exactly the same thing :shock:

I would also like to see a complete version of the tutorial example.

In my case, I have just finished writing a Horde3D wrapper for the open source language Euphoria. I would really like a simple example to test that my wrapper code is OK. The Chicago code is too big for a simple test (I will convert it to eu eventually, just not now...) and my c++ is so poor that I will overlook the obvious if the example isn't complete.

I have been able to get the engine to initialise and load resources (according to the engine log.) However, nothing is displayed. I also can't get the c++ Chicago demo to run. It seems to get to a certain point and stop. No errors in the log, just no output (black display.)

I am downloading new drivers for my video card (Geforce 6200) just in case that is the problem. Are there any known problems with this card?

Finally, I'd just like to say thanks for creating an engine with a generic dll interface. I really wish others would follow your example. I'm looking forward to seeing this develop (particles would be great :D)

Thanks!

Mark


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: 03.05.2007, 14:14 
Offline

Joined: 03.05.2007, 11:26
Posts: 26
mabrown wrote:
I also can't get the c++ Chicago demo to run. It seems to get to a certain point and stop. No errors in the log, just no output (black display.)


Problem solved with the official Chicago demo. Updated Forceware drivers and it works fine now.

Just need a basic working example now, just the bare minimum to init the engine, display something amd shut down.

Mark


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: 03.05.2007, 14:17 
Offline

Joined: 05.03.2007, 19:38
Posts: 167
Location: Romania
mabrown wrote:

Just need a basic working example now, just the bare minimum to init the engine, display something amd shut down.

Mark


this exactly what I also need


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: 03.05.2007, 17:25 
Offline
Engine Developer

Joined: 10.09.2006, 15:52
Posts: 1217
@spooky: It looks like you have not created a proper Windows application. You need to create a window using Win32 API (the main.cpp in the Chicago sample does that) and create an OpenGL context (you can use Horde3DUtils for that). After that you can initialize the engine.

@Mark: Unfortunately I don't know how to initalize a window and get its device context handle using Euphoria, but I'd guess it's not that hard.


All the engine related part is done in the app.cpp file of the Chicago sample. Just remove the few lines that call the crowd simulation and you have a quite basic demo that renders the ground plane and allows moving around in the scene. The main.cpp is just required to create the window to which you can render and initalize the OpenGL context.

mabrown wrote:
Finally, I'd just like to say thanks for creating an engine with a generic dll interface. I really wish others would follow your example. I'm looking forward to seeing this develop


I'm glad to hear that more and more people are profitting from the generic interface and port the engine to other languages :)

mabrown wrote:
particles would be great

That's the next thing I will work on! :D


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: 03.05.2007, 17:30 
Offline

Joined: 05.03.2007, 19:38
Posts: 167
Location: Romania
marciano can u please post the code so that i can just copy\paste it into an empty cpp file? i am not familiar with the windows API and this way you will solve future problems i might encounter porting code from the chicago demo to my application.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: 03.05.2007, 23:54 
Offline

Joined: 03.05.2007, 11:26
Posts: 26
Hi Marciano

Thanks for the info regarding what is required from the Chicago demo. I believe I have successfully obtained the device context for my window in euphoria so there must be something eu-ish that I'm not doing.

I will try again tonight using some examples from an older engine I helped convert to eu (morfit/3dstate) where much the same was needed. That engine was like Horde in having a nice clean dll interface but with a restricted license. I've been looking for a replacement engine ever since. Looks like I finally found it :D

marciano wrote:
mabrown wrote:
particles would be great

That's the next thing I will work on! :D


Wonderful! I have a specific idea in mind relating to the use of particles.

Mark


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: 04.05.2007, 12:26 
Offline
Engine Developer

Joined: 10.09.2006, 15:52
Posts: 1217
@spooky: The windows code is too long to post it here and it is really bad readable if you put everything in one file. Are you using Visual Studio? If so, create a new C++ Win32 project. Add the main.cpp from the sample and the app.h and app.cpp to the project. The app.cpp is pretty small. Just remove the things that you don't want and you have your minumum sample. One important thing is to include horde3d.lib and horde3dutils.lib in the linker additional libraries. If you still have problems please google for a basic win32 or C++ tutorial. There are tons of them on the net.

@mabrown: There is one important thing I forgot in the tutorial code. You have to call the resize function after initializing the engine to tell Horde the size of your window. I would also suggest you to have a look at the app.cpp to see how to display some models. It is pretty straightforward and there is nothing fancy codewise.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: 04.05.2007, 19:10 
Offline

Joined: 05.03.2007, 19:38
Posts: 167
Location: Romania
well i've failed. i`m googleing now for some answeres, but if it`s not to much of a hustle can u please provide a just how to load a cube sample in the next release?

or better yet have a header file with all the windows api code that can easily be included


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: 05.05.2007, 07:57 
Offline

Joined: 03.05.2007, 11:26
Posts: 26
marciano wrote:
@mabrown: There is one important thing I forgot in the tutorial code. You have to call the resize function after initializing the engine to tell Horde the size of your window. I would also suggest you to have a look at the app.cpp to see how to display some models. It is pretty straightforward and there is nothing fancy codewise.


I should have come to the forum first... I worked out the resize thing myself about 5 mins ago :roll: :D

I'm very close to a working example now. I found that I also needed to use the lighting code from the Chicago demo rather than the example tute light code, otherwise the scene was too dark and the cobblestones didn't show.

Image

Next I'll add some code to move around.

Thanks again for making Horde3D usable from a scripting language like Euphoria. This is very cool! Once I'm happy with the wrappers and the converted example, would it be OK to upload this as a package (including all the resources etc) to the euphoria programs archive? I'll also let the eu forum know about it if that is OK.

Mark


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: 05.05.2007, 13:20 
Offline
Engine Developer

Joined: 10.09.2006, 15:52
Posts: 1217
@spooky: I will see what I can do for the next release. But I want to emphasize again that the Chicago sample already has all the code to setup your window, you just need to add the main.cpp file to your project and can use the app.h and app.cpp as a small framework for your own application.

@Mark: That's great news! :)
Of course you can convert the sample to EU and publish it. And I am also happy if you write about it in the EU forums since publicity is what Horde needs most at the moment :)


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: 05.05.2007, 15:44 
Offline

Joined: 03.05.2007, 11:26
Posts: 26
marciano wrote:
@Mark: That's great news! :)
Of course you can convert the sample to EU and publish it. And I am also happy if you write about it in the EU forums since publicity is what Horde needs most at the moment :)


Thanks Marciano! I'm almost done. Models now load and walk around, although some walk backwards! Mouse scene rotation and keys working. Only fps output to do and fix the backwards walkers and I'm done. [Edit: Backwards walkers fixed... needed to roll my own atan2 function using example code I found on the web.)

Regarding the fps output I have two problems. First one concerns the use of "QueryPerformanceCounter" which I will have to wrap. It takes a pointer to a "LARGE_INTEGER". How may bytes is that? 8? I think I'm going to have to allocate space for it and poke the bytes before passing the pointer to "QueryPerformanceCounter".

The second problem relates to "Horde3DUtils_showText". I've wrapped the first parameter as a pointer to a null terminated c-string using euphoria's "allocate_string(text)" function. I don't get any text output displayed. The following code in app.cpp looks "oo" to me...

// Show text
stringstream text;
text << "FPS: " << fps;
Horde3DUtils::showText( text.str().c_str(), 0, 0.95f, 0.03f, 0, _fontMatRes );

I take it "text.str().c_str()" isn't just a pointer to a simple c-string?

Any clues how I can do this? C++ isn't my strong point :?

Thanks

Mark

Image


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: 06.05.2007, 11:21 
Offline
Engine Developer

Joined: 10.09.2006, 15:52
Posts: 1217
Very nice!

Concerning the problems: The LARGE_INTEGER is a 64 bit integer. If wrapping that function doesn't work there may be other techniques to measure time like GetTickCount or similar which are less accurate.

text.str().c_str() is just a simple c-string pointer. You could try to display some fix text like "Hello World" to see if your function is working. If it doesn't, check that the font material and texture are loaded properly.

Good speed with the further conversion and I'm curious to see the EU port in action :)


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: 06.05.2007, 15:08 
Offline

Joined: 03.05.2007, 11:26
Posts: 26
marciano wrote:
Good speed with the further conversion and I'm curious to see the EU port in action :)


Hi Marciano!

I'm finished I think. Everything seems to be working now. The text output was there after all... it was hiding under the title bar because I was using the window dimensions not the client area dimensions :roll: I also got the fps timing sorted... managed to wrap those LARGE_INTEGER functions. Output of fps seems to work ok.

I'm really pleased with the speed of the demo from euphoria, even interpreted. I've also done a translated and compiled (using borland c) executable version of the eu source.

I'd like to send you what I've done for your approval before I send it over to the eu forum. The zipped package is 3.4 mb. Could you send me an email to mabrown<at>ihug.com.au so that I can send it to you?

All the best and once again, thanks for your amazing work :D

Mark


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: 11.05.2007, 15:36 
Offline

Joined: 05.03.2007, 19:38
Posts: 167
Location: Romania
i realize that all the code i need is present in the chicago demo app, but am not skilled enough to extract it without causing errors that i am not able to fix. regarding that future release, it would be great to have just an "windows_api.h" header file to include so that the only addition to a tutorial-like application would be a "#include "windows_api.h"" line. this will eliminate the need to tackle with the windows api, and clear allot of headaches for the beginner coder, including myself


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 33 posts ]  Go to page 1, 2, 3  Next

All times are UTC + 1 hour


Who is online

Users browsing this forum: Bing [Bot] and 39 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group