Horde3D

Next-Generation Graphics Engine
It is currently 14.11.2024, 07:33

All times are UTC + 1 hour




Post new topic Reply to topic  [ 8 posts ] 
Author Message
PostPosted: 11.09.2010, 03:53 
Offline

Joined: 10.05.2010, 01:31
Posts: 14
I am starting out with Horde3d so i may be doing this wrong,
Everytime i try to run my program i get this error : Image


Here is my code :
Code:
#include "Horde3D.h"

int main()
{
h3dInit();
bool run=true;
 h3dSetupViewport( 0, 0, 640, 480, true );
 H3DRes pipeRes = h3dAddResource( H3DResTypes::Pipeline, "standard.pipeline.xml", 0 );
H3DNode cam = h3dAddCameraNode( H3DRootNode, "Camera", pipeRes );
 while(run)
 {
   h3dRender( cam );
   
    // Finish rendering of frame
    h3dFinalizeFrame();
 }

h3dRelease();
return 0;
}


IDE : Micrososft visual c++ 2008 express
OS : Windows 7 Ultimate 32 bit
as you can see i borrowed some code from the basic tutorial and i am probably looping the program the wrong way but it was just a test to build a simple window.
But i dont see whats causing the error.


Thanks in advanced.


Top
 Profile  
Reply with quote  
PostPosted: 11.09.2010, 09:10 
Offline
Tool Developer

Joined: 13.11.2007, 11:07
Posts: 1150
Location: Germany
If the main routine is really the entry point of you application you have to make sure to create an OpenGL context BEFORE you call h3dInit.


Top
 Profile  
Reply with quote  
PostPosted: 11.09.2010, 09:10 
Offline

Joined: 24.03.2010, 10:17
Posts: 55
If this is your whole program, then you're completely missing the window/GL context creation part.
You need to have a valid GL Context before you can call h3dInit.
Horde's examples use the GLFW library to set up a window/GL environment (see the Knight example code).
If you're familiar with a another window/gl lib, this will do as well (SFML, glut).


Top
 Profile  
Reply with quote  
PostPosted: 11.09.2010, 18:36 
Offline

Joined: 10.05.2010, 01:31
Posts: 14
I tried the whole day tring to do it, how do i make the simple Openggl context and assign it to horde3d?

[edit]
Is this the right way for making the context ? (i made it with glut)
Code:
void RenderScene(void)
{
// Clear the window with current clearing color
glClear(GL_COLOR_BUFFER_BIT);
// Flush drawing commands
glFlush();
}
int main(int argc, char* argv[])
{
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_SINGLE | GLUT_RGBA);
glutCreateWindow("Simple");

glutDisplayFunc(RenderScene);

glutMainLoop();


Last edited by vines on 11.09.2010, 18:56, edited 1 time in total.

Top
 Profile  
Reply with quote  
PostPosted: 11.09.2010, 18:47 
Offline

Joined: 24.03.2010, 10:17
Posts: 55
Use the Knight example and strip out unneeded code, step by step.


Top
 Profile  
Reply with quote  
PostPosted: 11.09.2010, 21:59 
Offline

Joined: 10.05.2010, 01:31
Posts: 14
I dont know opengl so i really dont understand which code is which, can you pleas show me a example of how to make the opengl context and bind it to Horde3d.


Thanks in advanced.


Top
 Profile  
Reply with quote  
PostPosted: 13.09.2010, 02:19 
Offline

Joined: 15.02.2009, 02:13
Posts: 161
Location: Sydney Australia
Hi vines,

When you look at the knight example, you have main.cpp, app.cpp & app.h. Think of main.cpp as the "server" of the context, as this code is dedicated to just setting up GLFW (which is your OpenGL initializer & window/input manager for your operating system). This code also is in charge of creating the class inside of app.cpp which takes care of horde3d and the code specific for the knight sample (which could be considered the client of the server). If I were you, I'd just modify app.cpp & app.h and leave main.cpp as it is, and only modify main.cpp if you need a specific option set like a different resolution or whatever.

When you're more confident, I would suggest seeing if glfw is ideal for what you want to do, and if not there are alternative libraries for opengl context-creation here: http://horde3d.org/wiki/index.php5?title=Horde3D_Wiki:Community_Portal#Programming_Guide under the "Tutorial - Setup Horde3D with <insert lib here>" links.

A good indicator to see what is what, opengl-specific code usually has the gl prefix, glfw has the glfw prefix, and horde3d has the h3d prefix. More than likely you won't need to issue any gl prefixed commands because horde3d handles this for you, and the same for context-creation which glfw handles.

_________________
-Alex
Website


Top
 Profile  
Reply with quote  
PostPosted: 13.09.2010, 02:43 
Offline

Joined: 10.05.2010, 01:31
Posts: 14
Thank you very much


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 8 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 4 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