Trying to use Ogre with GLFW [Solved]

Problems building or running the engine, queries about how to use features etc.
Post Reply
Vax456
Gnoblar
Posts: 6
Joined: Sun Apr 15, 2012 8:41 pm
x 1

Trying to use Ogre with GLFW [Solved]

Post by Vax456 »

Code:

Code: Select all

#include <iostream>

#include <CEGUI-9999.0/CEGUI/CEGUI.h>
#include <CEGUI-9999.0/CEGUI/RendererModules/Ogre/Renderer.h>
#include <CEGUI-9999.0/CEGUI/RendererModules/OpenGL/Renderer.h>
#include <GL/glfw.h>
#include <OGRE/Ogre.h>

int main(int argc, char** argv) {
	if(!glfwInit()) {
		std::cout << "GLFW failed to initialize" << std::endl;
		return 1;
	}
	if(glfwOpenWindow(800, 600, 5, 6, 5, 0, 8, 0, GLFW_WINDOW) != GL_TRUE) {
		std::cout << "GLFW window failed to open" << std::endl;
		return 1;
	}

	Ogre::Root* ogreRoot = new Ogre::Root("lib/ogre/plugins.cfg");
	ogreRoot->setRenderSystem(ogreRoot->getAvailableRenderers()[0]);
	Ogre::RenderWindow* ogreWindow = ogreRoot->initialise(false);
	Ogre::NameValuePairList misc;
	misc["currentGLContext"] = Ogre::String("true");
	ogreWindow = ogreRoot->createRenderWindow("proofoconcept", 800, 600, false, &misc);

	Ogre::RenderTarget *mRenderTarget = ogreWindow;
	CEGUI::OgreRenderer::create(*mRenderTarget);
	CEGUI::OgreRenderer::bootstrapSystem(*mRenderTarget);

	Ogre::ConfigFile ogreResources;
	ogreResources.load("resources/resource_configs/resources.cfg");
	Ogre::ConfigFile::SectionIterator seci = ogreResources.getSectionIterator();
	Ogre::String secName, typeName, archName;
	while(seci.hasMoreElements()) {
		secName = seci.peekNextKey();
		Ogre::ConfigFile::SettingsMultiMap *settings = seci.getNext();
		Ogre::ConfigFile::SettingsMultiMap::iterator i;
		for (i = settings->begin(); i != settings->end(); ++i) {
			typeName = i->first;
			archName = i->second;
			Ogre::ResourceGroupManager::getSingleton().addResourceLocation(archName, typeName, secName);
		}
	}
	Ogre::ResourceGroupManager::getSingleton().initialiseAllResourceGroups();

	Ogre::SceneManager* ogreSceneManager = ogreRoot->createSceneManager(Ogre::ST_GENERIC);
	Ogre::SceneNode* humanMeshNode = ogreSceneManager->getRootSceneNode()->createChildSceneNode();

	Ogre::Camera* ogreCamera = ogreSceneManager->createCamera("3rd person view");
	ogreCamera->setPosition(50, 50, 50);
	ogreCamera->lookAt(0, 0, 0);
	ogreCamera->setNearClipDistance(1.0f);
	ogreCamera->setFarClipDistance(5000000.0f);
	humanMeshNode->attachObject(ogreCamera);

	Ogre::Viewport* sceneVP = ogreWindow->addViewport(ogreCamera);
	sceneVP->setBackgroundColour(Ogre::ColourValue(1, 0, 0));

	Ogre::Entity* humanMesh = ogreSceneManager->createEntity("Human", "human_mesh.mesh");
	humanMeshNode->attachObject(humanMesh);

	ogreSceneManager->setAmbientLight(Ogre::ColourValue(1, 1, 1));
	Ogre::Light* ogreLight = ogreSceneManager->createLight("MainLight");
	ogreLight->setPosition(5, 5, 5);

	CEGUI::SchemeManager::getSingleton().createFromFile("TaharezLook.scheme", "CEGUI");
	CEGUI::Window *statusWindow = CEGUI::WindowManager::getSingleton().loadLayoutFromFile("proofoconcept.layout", "CEGUI");
	CEGUI::System::getSingleton().getDefaultGUIContext().setRootWindow(statusWindow);

	while(1) {
		Ogre::WindowEventUtilities::messagePump();
		if(glfwGetKey(GLFW_KEY_ESC) == GLFW_PRESS) {
			break;
		}
		ogreRoot->renderOneFrame();
		glfwSwapBuffers();
	}
	delete ogreRoot;
}
resources.cfg

Code: Select all

[Materials]
FileSystem=resources/materials

[Models]
FileSystem=resources/models

[Scenes]
FileSystem=resources/scenes

[CEGUI]
FileSystem=resources/cegui/fonts
FileSystem=resources/cegui/layouts
FileSystem=resources/cegui/xml_schemas
FileSystem=resources/cegui/imagesets
FileSystem=resources/cegui/looknfeel
FileSystem=resources/cegui/schemes
plugins.cfg

Code: Select all

PluginFolder=lib/ogre
Plugin=Plugin_BSPSceneManager
Plugin=Plugin_CgProgramManager
Plugin=Plugin_OctreeSceneManager
Plugin=Plugin_OctreeZone
Plugin=Plugin_PCZSceneManager
Plugin=Plugin_ParticleFX
Plugin=RenderSystem_GL
Ogre.log

Code: Select all

15:43:32: Creating resource group General
15:43:32: Creating resource group Internal
15:43:32: Creating resource group Autodetect
15:43:32: SceneManagerFactory for type 'DefaultSceneManager' registered.
15:43:32: Registering ResourceManager for type Material
15:43:32: Registering ResourceManager for type Mesh
15:43:32: Registering ResourceManager for type Skeleton
15:43:32: MovableObjectFactory for type 'ParticleSystem' registered.
15:43:32: OverlayElementFactory for type Panel registered.
15:43:32: OverlayElementFactory for type BorderPanel registered.
15:43:32: OverlayElementFactory for type TextArea registered.
15:43:32: Registering ResourceManager for type Font
15:43:32: ArchiveFactory for archive type FileSystem registered.
15:43:32: ArchiveFactory for archive type Zip registered.
15:43:32: DDS codec registering
15:43:32: FreeImage version: 3.15.2
15:43:32: This program uses FreeImage, a free, open source image library supporting all common bitmap formats. See http://freeimage.sourceforge.net for details
15:43:32: Supported formats: bmp,ico,jpg,jif,jpeg,jpe,jng,koa,iff,lbm,mng,pbm,pbm,pcd,pcx,pgm,pgm,png,ppm,ppm,ras,tga,targa,tif,tiff,wap,wbmp,wbm,psd,cut,xbm,xpm,gif,hdr,g3,sgi,exr,j2k,j2c,jp2,pfm,pct,pict,pic,3fr,arw,bay,bmq,cap,cine,cr2,crw,cs1,dc2,dcr,drf,dsc,dng,erf,fff,ia,iiq,k25,kc2,kdc,mdc,mef,mos,mrw,nef,nrw,orf,pef,ptx,pxn,qtk,raf,raw,rdc,rw2,rwl,rwz,sr2,srf,srw,sti
15:43:32: Registering ResourceManager for type HighLevelGpuProgram
15:43:32: Registering ResourceManager for type Compositor
15:43:32: MovableObjectFactory for type 'Entity' registered.
15:43:32: MovableObjectFactory for type 'Light' registered.
15:43:32: MovableObjectFactory for type 'BillboardSet' registered.
15:43:32: MovableObjectFactory for type 'ManualObject' registered.
15:43:32: MovableObjectFactory for type 'BillboardChain' registered.
15:43:32: MovableObjectFactory for type 'RibbonTrail' registered.
15:43:32: Loading library lib/ogre/Plugin_BSPSceneManager
15:43:32: Installing plugin: BSP Scene Manager
15:43:32: Plugin successfully installed
15:43:32: Loading library lib/ogre/Plugin_CgProgramManager
15:43:32: Installing plugin: Cg Program Manager
15:43:32: Plugin successfully installed
15:43:32: Loading library lib/ogre/Plugin_OctreeSceneManager
15:43:32: Installing plugin: Octree & Terrain Scene Manager
15:43:32: Plugin successfully installed
15:43:32: Loading library lib/ogre/Plugin_OctreeZone
15:43:32: Installing plugin: Octree Zone Factory
15:43:32: Plugin successfully installed
15:43:32: Loading library lib/ogre/Plugin_PCZSceneManager
15:43:32: Installing plugin: Portal Connected Zone Scene Manager
15:43:32: PCZone Factory Type 'ZoneType_Default' registered
15:43:32: Plugin successfully installed
15:43:32: Loading library lib/ogre/Plugin_ParticleFX
15:43:32: Installing plugin: ParticleFX
15:43:32: Particle Emitter Type 'Point' registered
15:43:32: Particle Emitter Type 'Box' registered
15:43:32: Particle Emitter Type 'Ellipsoid' registered
15:43:32: Particle Emitter Type 'Cylinder' registered
15:43:32: Particle Emitter Type 'Ring' registered
15:43:32: Particle Emitter Type 'HollowEllipsoid' registered
15:43:32: Particle Affector Type 'LinearForce' registered
15:43:32: Particle Affector Type 'ColourFader' registered
15:43:32: Particle Affector Type 'ColourFader2' registered
15:43:32: Particle Affector Type 'ColourImage' registered
15:43:32: Particle Affector Type 'ColourInterpolator' registered
15:43:32: Particle Affector Type 'Scaler' registered
15:43:32: Particle Affector Type 'Rotator' registered
15:43:32: Particle Affector Type 'DirectionRandomiser' registered
15:43:32: Particle Affector Type 'DeflectorPlane' registered
15:43:32: Plugin successfully installed
15:43:32: Loading library lib/ogre/RenderSystem_GL
15:43:32: Installing plugin: GL RenderSystem
15:43:32: OpenGL Rendering Subsystem created.
15:43:32: Plugin successfully installed
15:43:32: *-*-* OGRE Initialising
15:43:32: *-*-* Version 1.7.4 (Cthugha)
15:43:32: CPU Identifier & Features
15:43:32: -------------------------
15:43:32:  *   CPU ID: GenuineIntel: Intel(R) Core(TM)2 CPU          4400  @ 2.00GHz
15:43:32:  *      SSE: yes
15:43:32:  *     SSE2: yes
15:43:32:  *     SSE3: yes
15:43:32:  *      MMX: yes
15:43:32:  *   MMXEXT: yes
15:43:32:  *    3DNOW: no
15:43:32:  * 3DNOWEXT: no
15:43:32:  *     CMOV: yes
15:43:32:  *      TSC: yes
15:43:32:  *      FPU: yes
15:43:32:  *      PRO: yes
15:43:32:  *       HT: no
15:43:32: -------------------------
15:43:32: ******************************
*** Starting GLX Subsystem ***
******************************
15:43:32: GLRenderSystem::_createRenderWindow "proofoconcept", 800x600 windowed  miscParams: currentGLContext=true 
15:43:32: GLXWindow::create used FBConfigID = 125
15:43:32: GL_VERSION = 3.3.0 NVIDIA 295.40
15:43:32: GL_VENDOR = NVIDIA Corporation
15:43:32: GL_RENDERER = GeForce GTX 260/PCIe/SSE2
15:43:32: GL_EXTENSIONS = GL_ARB_base_instance GL_ARB_blend_func_extended GL_ARB_color_buffer_float GL_ARB_compatibility GL_ARB_compressed_texture_pixel_storage GL_ARB_conservative_depth GL_ARB_copy_buffer GL_ARB_depth_buffer_float GL_ARB_depth_clamp GL_ARB_depth_texture GL_ARB_draw_buffers GL_ARB_draw_elements_base_vertex GL_ARB_draw_instanced GL_ARB_ES2_compatibility GL_ARB_explicit_attrib_location GL_ARB_fragment_coord_conventions GL_ARB_fragment_program GL_ARB_fragment_program_shadow GL_ARB_fragment_shader GL_ARB_framebuffer_object GL_ARB_framebuffer_sRGB GL_ARB_geometry_shader4 GL_ARB_get_program_binary GL_ARB_half_float_pixel GL_ARB_half_float_vertex GL_ARB_imaging GL_ARB_instanced_arrays GL_ARB_internalformat_query GL_ARB_map_buffer_alignment GL_ARB_map_buffer_range GL_ARB_multisample GL_ARB_multitexture GL_ARB_occlusion_query GL_ARB_occlusion_query2 GL_ARB_pixel_buffer_object GL_ARB_point_parameters GL_ARB_point_sprite GL_ARB_provoking_vertex GL_ARB_robustness GL_ARB_sampler_objects GL_ARB_seamless_cube_map GL_ARB_separate_shader_objects GL_ARB_shader_bit_encoding GL_ARB_shader_objects GL_ARB_shading_language_100 GL_ARB_shading_language_420pack GL_ARB_shading_language_include GL_ARB_shading_language_packing GL_ARB_shadow GL_ARB_sync GL_ARB_texture_border_clamp GL_ARB_texture_buffer_object GL_ARB_texture_compression GL_ARB_texture_compression_rgtc GL_ARB_texture_cube_map GL_ARB_texture_env_add GL_ARB_texture_env_combine GL_ARB_texture_env_crossbar GL_ARB_texture_env_dot3 GL_ARB_texture_float GL_ARB_texture_mirrored_repeat GL_ARB_texture_multisample GL_ARB_texture_non_power_of_two GL_ARB_texture_rectangle GL_ARB_texture_rg GL_ARB_texture_rgb10_a2ui GL_ARB_texture_storage GL_ARB_texture_swizzle GL_ARB_timer_query GL_ARB_transform_feedback2 GL_ARB_transform_feedback_instanced GL_ARB_transpose_matrix GL_ARB_uniform_buffer_object GL_ARB_vertex_array_bgra GL_ARB_vertex_array_object GL_ARB_vertex_buffer_object GL_ARB_vertex_program GL_ARB_vertex_shader GL_ARB_vertex_type_2_10_10_10_rev GL_ARB_viewport_array GL_ARB_window_pos GL_ATI_draw_buffers GL_ATI_texture_float GL_ATI_texture_mirror_once GL_S3_s3tc GL_EXT_texture_env_add GL_EXT_abgr GL_EXT_bgra GL_EXT_bindable_uniform GL_EXT_blend_color GL_EXT_blend_equation_separate GL_EXT_blend_func_separate GL_EXT_blend_minmax GL_EXT_blend_subtract GL_EXT_compiled_vertex_array GL_EXT_Cg_shader GL_EXT_depth_bounds_test GL_EXT_direct_state_access GL_EXT_draw_buffers2 GL_EXT_draw_instanced GL_EXT_draw_range_elements GL_EXT_fog_coord GL_EXT_framebuffer_blit GL_EXT_framebuffer_multisample GL_EXTX_framebuffer_mixed_formats GL_EXT_framebuffer_object GL_EXT_framebuffer_sRGB GL_EXT_geometry_shader4 GL_EXT_gpu_program_parameters GL_EXT_gpu_shader4 GL_EXT_multi_draw_arrays GL_EXT_packed_depth_stencil GL_EXT_packed_float GL_EXT_packed_pixels GL_EXT_pixel_buffer_object GL_EXT_point_parameters GL_EXT_provoking_vertex GL_EXT_rescale_normal GL_EXT_secondary_color GL_EXT_separate_shader_objects GL_EXT_separate_specular_color GL_EXT_shadow_funcs GL_EXT_stencil_two_side GL_EXT_stencil_wrap GL_EXT_texture3D GL_EXT_texture_array GL_EXT_texture_buffer_object GL_EXT_texture_compression_dxt1 GL_EXT_texture_compression_latc GL_EXT_texture_compression_rgtc GL_EXT_texture_compression_s3tc GL_EXT_texture_cube_map GL_EXT_texture_edge_clamp GL_EXT_texture_env_combine GL_EXT_texture_env_dot3 GL_EXT_texture_filter_anisotropic GL_EXT_texture_format_BGRA8888 GL_EXT_texture_integer GL_EXT_texture_lod GL_EXT_texture_lod_bias GL_EXT_texture_mirror_clamp GL_EXT_texture_object GL_EXT_texture_shared_exponent GL_EXT_texture_sRGB GL_EXT_texture_sRGB_decode GL_EXT_texture_storage GL_EXT_texture_swizzle GL_EXT_texture_type_2_10_10_10_REV GL_EXT_timer_query GL_EXT_transform_feedback2 GL_EXT_vertex_array GL_EXT_vertex_array_bgra GL_EXT_x11_sync_object GL_EXT_import_sync_object GL_IBM_rasterpos_clip GL_IBM_texture_mirrored_repeat GL_KTX_buffer_region GL_NV_alpha_test GL_NV_blend_minmax GL_NV_blend_square GL_NV_complex_primitives GL_NV_conditional_render GL_NV_copy_depth_to_color GL_NV_copy_image GL_NV_depth_buffer_float GL_NV_depth_clamp GL_NV_explicit_multisample GL_NV_fbo_color_attachments GL_NV_fence GL_NV_float_buffer GL_NV_fog_distance GL_NV_fragdepth GL_NV_fragment_program GL_NV_fragment_program_option GL_NV_fragment_program2 GL_NV_framebuffer_multisample_coverage GL_NV_geometry_shader4 GL_NV_gpu_program4 GL_NV_half_float GL_NV_light_max_exponent GL_NV_multisample_coverage GL_NV_multisample_filter_hint GL_NV_occlusion_query GL_NV_packed_depth_stencil GL_NV_parameter_buffer_object GL_NV_parameter_buffer_object2 GL_NV_path_rendering GL_NV_pixel_data_range GL_NV_point_sprite GL_NV_primitive_restart GL_NV_register_combiners GL_NV_register_combiners2 GL_NV_shader_buffer_load GL_NV_texgen_reflection GL_NV_texture_barrier GL_NV_texture_compression_vtc GL_NV_texture_env_combine4 GL_NV_texture_expand_normal GL_NV_texture_lod_clamp GL_NV_texture_multisample GL_NV_texture_rectangle GL_NV_texture_shader GL_NV_texture_shader2 GL_NV_texture_shader3 GL_NV_transform_feedback GL_NV_transform_feedback2 GL_NV_vdpau_interop GL_NV_vertex_array_range GL_NV_vertex_array_range2 GL_NV_vertex_buffer_unified_memory GL_NV_vertex_program GL_NV_vertex_program1_1 GL_NV_vertex_program2 GL_NV_vertex_program2_option GL_NV_vertex_program3 GL_NVX_conditional_render GL_NVX_gpu_memory_info GL_OES_depth24 GL_OES_depth32 GL_OES_depth_texture GL_OES_element_index_uint GL_OES_fbo_render_mipmap GL_OES_get_program_binary GL_OES_mapbuffer GL_OES_packed_depth_stencil GL_OES_rgb8_rgba8 GL_OES_standard_derivatives GL_OES_texture_3D GL_OES_texture_float GL_OES_texture_float_linear GL_OES_texture_half_float GL_OES_texture_half_float_linear GL_OES_texture_npot GL_OES_vertex_array_object GL_OES_vertex_half_float GL_SGIS_generate_mipmap GL_SGIS_texture_lod GL_SGIX_depth_texture GL_SGIX_shadow GL_SUN_slice_accum 
15:43:32: Supported GLX extensions: GLX_EXT_visual_info GLX_EXT_visual_rating GLX_SGIX_fbconfig GLX_SGIX_pbuffer GLX_SGI_video_sync GLX_SGI_swap_control GLX_EXT_swap_control GLX_EXT_texture_from_pixmap GLX_ARB_create_context GLX_ARB_create_context_profile GLX_EXT_create_context_es2_profile GLX_ARB_create_context_robustness GLX_ARB_multisample GLX_NV_float_buffer GLX_ARB_fbconfig_float GLX_EXT_framebuffer_sRGB GLX_ARB_get_proc_address 
15:43:32: ***************************
15:43:32: *** GL Renderer Started ***
15:43:32: ***************************
15:43:32: Registering ResourceManager for type GpuProgram
15:43:32: GLSL support detected
15:43:32: GL: Using GL_EXT_framebuffer_object for rendering to textures (best)
15:43:32: FBO PF_UNKNOWN depth/stencil support: D16S0 D24S0 D32S0 Packed-D24S8 
15:43:32: FBO PF_L8 depth/stencil support: D0S0 D16S0 D24S0 D32S0 Packed-D24S8 
15:43:32: FBO PF_A8 depth/stencil support: D0S0 D16S0 D24S0 D32S0 Packed-D24S8 
15:43:32: FBO PF_A4L4 depth/stencil support: D0S0 D16S0 D24S0 D32S0 Packed-D24S8 
15:43:32: FBO PF_BYTE_LA depth/stencil support: D0S0 D16S0 D24S0 D32S0 Packed-D24S8 
15:43:32: FBO PF_R5G6B5 depth/stencil support: D0S0 D16S0 D24S0 D32S0 Packed-D24S8 
15:43:32: FBO PF_B5G6R5 depth/stencil support: D0S0 D16S0 D24S0 D32S0 Packed-D24S8 
15:43:32: FBO PF_A4R4G4B4 depth/stencil support: D0S0 D16S0 D24S0 D32S0 Packed-D24S8 
15:43:32: FBO PF_A1R5G5B5 depth/stencil support: D0S0 D16S0 D24S0 D32S0 Packed-D24S8 
15:43:32: FBO PF_R8G8B8 depth/stencil support: D0S0 D16S0 D24S0 D32S0 Packed-D24S8 
15:43:32: FBO PF_B8G8R8 depth/stencil support: D0S0 D16S0 D24S0 D32S0 Packed-D24S8 
15:43:32: FBO PF_A8R8G8B8 depth/stencil support: D0S0 D16S0 D24S0 D32S0 Packed-D24S8 
15:43:32: FBO PF_B8G8R8A8 depth/stencil support: D0S0 D16S0 D24S0 D32S0 Packed-D24S8 
15:43:32: FBO PF_A2R10G10B10 depth/stencil support: D0S0 D16S0 D24S0 D32S0 Packed-D24S8 
15:43:32: FBO PF_A2B10G10R10 depth/stencil support: D0S0 D16S0 D24S0 D32S0 Packed-D24S8 
15:43:32: FBO PF_FLOAT16_RGB depth/stencil support: D0S0 D16S0 D24S0 D32S0 Packed-D24S8 
15:43:32: FBO PF_FLOAT16_RGBA depth/stencil support: D0S0 D16S0 D24S0 D32S0 Packed-D24S8 
15:43:32: FBO PF_FLOAT32_RGB depth/stencil support: D0S0 D16S0 D24S0 D32S0 Packed-D24S8 
15:43:32: FBO PF_FLOAT32_RGBA depth/stencil support: D0S0 D16S0 D24S0 D32S0 Packed-D24S8 
15:43:32: FBO PF_X8R8G8B8 depth/stencil support: D0S0 D16S0 D24S0 D32S0 Packed-D24S8 
15:43:32: FBO PF_X8B8G8R8 depth/stencil support: D0S0 D16S0 D24S0 D32S0 Packed-D24S8 
15:43:33: FBO PF_SHORT_RGBA depth/stencil support: D0S0 D16S0 D24S0 D32S0 Packed-D24S8 
15:43:33: FBO PF_R3G3B2 depth/stencil support: D0S0 D16S0 D24S0 D32S0 Packed-D24S8 
15:43:33: FBO PF_FLOAT16_R depth/stencil support: D0S0 D16S0 D24S0 D32S0 Packed-D24S8 
15:43:33: FBO PF_FLOAT32_R depth/stencil support: D0S0 D16S0 D24S0 D32S0 Packed-D24S8 
15:43:33: FBO PF_FLOAT16_GR depth/stencil support: D0S0 D16S0 D24S0 D32S0 Packed-D24S8 
15:43:33: FBO PF_FLOAT32_GR depth/stencil support: D0S0 D16S0 D24S0 D32S0 Packed-D24S8 
15:43:33: FBO PF_SHORT_RGB depth/stencil support: D0S0 D16S0 D24S0 D32S0 Packed-D24S8 
15:43:33: [GL] : Valid FBO targets PF_UNKNOWN PF_L8 PF_A8 PF_A4L4 PF_BYTE_LA PF_R5G6B5 PF_B5G6R5 PF_A4R4G4B4 PF_A1R5G5B5 PF_R8G8B8 PF_B8G8R8 PF_A8R8G8B8 PF_B8G8R8A8 PF_A2R10G10B10 PF_A2B10G10R10 PF_FLOAT16_RGB PF_FLOAT16_RGBA PF_FLOAT32_RGB PF_FLOAT32_RGBA PF_X8R8G8B8 PF_X8B8G8R8 PF_SHORT_RGBA PF_R3G3B2 PF_FLOAT16_R PF_FLOAT32_R PF_FLOAT16_GR PF_FLOAT32_GR PF_SHORT_RGB 
15:43:33: RenderSystem capabilities
15:43:33: -------------------------
15:43:33: RenderSystem Name: OpenGL Rendering Subsystem
15:43:33: GPU Vendor: nvidia
15:43:33: Device Name: GeForce GTX 260/PCIe/SSE2
15:43:33: Driver Version: 3.3.0.0
15:43:33:  * Fixed function pipeline: yes
15:43:33:  * Hardware generation of mipmaps: yes
15:43:33:  * Texture blending: yes
15:43:33:  * Anisotropic texture filtering: yes
15:43:33:  * Dot product texture operation: yes
15:43:33:  * Cube mapping: yes
15:43:33:  * Hardware stencil buffer: no
15:43:33:  * Hardware vertex / index buffers: yes
15:43:33:  * Vertex programs: yes
15:43:33:  * Number of floating-point constants for vertex programs: 1024
15:43:33:  * Number of integer constants for vertex programs: 0
15:43:33:  * Number of boolean constants for vertex programs: 0
15:43:33:  * Fragment programs: yes
15:43:33:  * Number of floating-point constants for fragment programs: 512
15:43:33:  * Number of integer constants for fragment programs: 0
15:43:33:  * Number of boolean constants for fragment programs: 0
15:43:33:  * Geometry programs: yes
15:43:33:  * Number of floating-point constants for geometry programs: 2048
15:43:33:  * Number of integer constants for geometry programs: 0
15:43:33:  * Number of boolean constants for geometry programs: 0
15:43:33:  * Supported Shader Profiles: arbfp1 arbvp1 fp20 fp30 fp40 glsl gp4gp gp4vp gpu_gp gpu_vp nvgp4 vp30 vp40
15:43:33:  * Texture Compression: yes
15:43:33:    - DXT: yes
15:43:33:    - VTC: yes
15:43:33:    - PVRTC: no
15:43:33:  * Scissor Rectangle: yes
15:43:33:  * Hardware Occlusion Query: yes
15:43:33:  * User clip planes: yes
15:43:33:  * VET_UBYTE4 vertex element type: yes
15:43:33:  * Infinite far plane projection: yes
15:43:33:  * Hardware render-to-texture: yes
15:43:33:  * Floating point textures: yes
15:43:33:  * Non-power-of-two textures: yes
15:43:33:  * Volume textures: yes
15:43:33:  * Multiple Render Targets: 8
15:43:33:    - With different bit depths: yes
15:43:33:  * Point Sprites: yes
15:43:33:  * Extended point parameters: yes
15:43:33:  * Max Point Size: 63.375
15:43:33:  * Vertex texture fetch: yes
15:43:33:  * Number of world matrices: 0
15:43:33:  * Number of texture units: 32
15:43:33:  * Stencil buffer depth: 0
15:43:33:  * Number of vertex blend matrices: 0
15:43:33:    - Max vertex textures: 32
15:43:33:    - Vertex textures shared: yes
15:43:33:  * Render to Vertex Buffer : yes
15:43:33:  * GL 1.5 without VBO workaround: no
15:43:33:  * Frame Buffer objects: yes
15:43:33:  * Frame Buffer objects (ARB extension): no
15:43:33:  * Frame Buffer objects (ATI extension): no
15:43:33:  * PBuffer support: yes
15:43:33:  * GL 1.5 without HW-occlusion workaround: no
15:43:33: Registering ResourceManager for type Texture
15:43:33: DefaultWorkQueue('Root') initialising on thread main.
15:43:33: Particle Renderer Type 'billboard' registered
15:43:33: SceneManagerFactory for type 'BspSceneManager' registered.
15:43:33: Registering ResourceManager for type BspLevel
15:43:33: SceneManagerFactory for type 'OctreeSceneManager' registered.
15:43:33: SceneManagerFactory for type 'TerrainSceneManager' registered.
15:43:33: PCZone Factory Type 'ZoneType_Octree' registered
15:43:33: PCZone Factory Type 'ZoneType_Terrain' registered
15:43:33: SceneManagerFactory for type 'PCZSceneManager' registered.
15:43:33: MovableObjectFactory for type 'PCZLight' registered.
15:43:33: MovableObjectFactory for type 'Portal' registered.
15:43:33: MovableObjectFactory for type 'AntiPortal' registered.
15:43:33: Creating resource group CEGUI
15:43:33: Added resource location 'resources/cegui/fonts' of type 'FileSystem' to resource group 'CEGUI'
15:43:33: Added resource location 'resources/cegui/layouts' of type 'FileSystem' to resource group 'CEGUI'
15:43:33: Added resource location 'resources/cegui/xml_schemas' of type 'FileSystem' to resource group 'CEGUI'
15:43:33: Added resource location 'resources/cegui/imagesets' of type 'FileSystem' to resource group 'CEGUI'
15:43:33: Added resource location 'resources/cegui/looknfeel' of type 'FileSystem' to resource group 'CEGUI'
15:43:33: Added resource location 'resources/cegui/schemes' of type 'FileSystem' to resource group 'CEGUI'
15:43:33: Creating resource group Materials
15:43:33: Added resource location 'resources/materials' of type 'FileSystem' to resource group 'Materials'
15:43:33: Creating resource group Models
15:43:33: Added resource location 'resources/models' of type 'FileSystem' to resource group 'Models'
15:43:33: Creating resource group Scenes
15:43:33: Added resource location 'resources/scenes' of type 'FileSystem' to resource group 'Scenes'
15:43:33: Parsing scripts for resource group Autodetect
15:43:33: Finished parsing scripts for resource group Autodetect
15:43:33: Parsing scripts for resource group CEGUI
15:43:33: Finished parsing scripts for resource group CEGUI
15:43:33: Parsing scripts for resource group General
15:43:33: Finished parsing scripts for resource group General
15:43:33: Parsing scripts for resource group Internal
15:43:33: Finished parsing scripts for resource group Internal
15:43:33: Parsing scripts for resource group Materials
15:43:33: Parsing script human_material.material
15:43:33: Finished parsing scripts for resource group Materials
15:43:33: Parsing scripts for resource group Models
15:43:33: Finished parsing scripts for resource group Models
15:43:33: Parsing scripts for resource group Scenes
15:43:33: Finished parsing scripts for resource group Scenes
15:43:33: Mesh: Loading human_mesh.mesh.
15:43:33: Skeleton: Loading human_mesh.skeleton
15:43:33: Texture: _cegui_ogre_0: Loading 1 faces(PF_A8B8G8R8,256x256x1) with 0 generated mipmaps from Image. Internal format is PF_A8R8G8B8,256x256x1.
15:43:33: Texture: _cegui_ogre_1: Loading 1 faces(PF_A8B8G8R8,400x400x1) with 0 generated mipmaps from Image. Internal format is PF_A8R8G8B8,400x400x1.
15:43:33: Texture: _cegui_ogre_5: Loading 1 faces(PF_A8B8G8R8,256x256x1) with 0 generated mipmaps from Image. Internal format is PF_A8R8G8B8,256x256x1.
15:43:37: DefaultWorkQueue('Root') shutting down on thread main.
15:43:37: PCZone Factory Type 'ZoneType_Octree' unregistered
15:43:37: PCZone Factory Type 'ZoneType_Terrain' unregistered
15:43:37: Unregistering ResourceManager for type BspLevel
15:43:37: *-*-* OGRE Shutdown
15:43:37: Unregistering ResourceManager for type Compositor
15:43:37: Unregistering ResourceManager for type Font
15:43:37: Unregistering ResourceManager for type Skeleton
15:43:37: Unregistering ResourceManager for type Mesh
15:43:37: Unregistering ResourceManager for type HighLevelGpuProgram
15:43:37: Uninstalling plugin: GL RenderSystem
15:43:37: Unregistering ResourceManager for type GpuProgram
15:43:37: ******************************
*** Stopping GLX Subsystem ***
******************************
15:43:37: Unregistering ResourceManager for type Texture
15:43:37: Plugin successfully uninstalled
15:43:37: Unloading library lib/ogre/RenderSystem_GL
15:43:37: Uninstalling plugin: ParticleFX
15:43:37: Plugin successfully uninstalled
15:43:37: Unloading library lib/ogre/Plugin_ParticleFX
15:43:37: Uninstalling plugin: Portal Connected Zone Scene Manager
15:43:37: Plugin successfully uninstalled
15:43:37: Unloading library lib/ogre/Plugin_PCZSceneManager
15:43:37: Uninstalling plugin: Octree Zone Factory
15:43:37: Plugin successfully uninstalled
15:43:37: Unloading library lib/ogre/Plugin_OctreeZone
15:43:37: Uninstalling plugin: Octree & Terrain Scene Manager
15:43:37: Plugin successfully uninstalled
15:43:37: Unloading library lib/ogre/Plugin_OctreeSceneManager
15:43:37: Uninstalling plugin: Cg Program Manager
Image

The problem I'm having is my mesh isn't rendering (the menu isn't covering it up). I made it in Blender and it works in OgreMeshy.

The CEGUI menu is rendering fine, so I know that Ogre is working. I'm doing something wrong with adding the mesh to the scene.

If I remove glfwSwapBuffers, nothing renders.

The background is black, even though I specified it to be red.

Any help would be appreciated.
Last edited by Vax456 on Mon Apr 16, 2012 7:05 am, edited 1 time in total.
Vax456
Gnoblar
Posts: 6
Joined: Sun Apr 15, 2012 8:41 pm
x 1

Re: Trying to use Ogre with GLFW

Post by Vax456 »

Code: Select all

#include <iostream>

#include <CEGUI-9999.0/CEGUI/CEGUI.h>
#include <CEGUI-9999.0/CEGUI/RendererModules/Ogre/Renderer.h>
#include <CEGUI-9999.0/CEGUI/RendererModules/OpenGL/Renderer.h>

#include <GL/glfw.h>

#include <OGRE/Ogre.h>

#include <DotSceneLoader.hpp>

int main(int argc, char** argv) {

	if(!glfwInit()) {
		std::cout << "GLFW failed to initialize" << std::endl;
		return 1;
	}
	if(glfwOpenWindow(800, 600, 5, 6, 5, 0, 8, 0, GLFW_WINDOW) != GL_TRUE) {
			std::cout << "GLFW window failed to open" << std::endl;
			return 1;
	}

	Ogre::Root* ogreRoot = new Ogre::Root("lib/ogre/plugins.cfg");

	Ogre::ConfigFile ogreConfig;
	ogreConfig.load("resources/resource_configs/resources.cfg");

	Ogre::ConfigFile::SectionIterator seci = ogreConfig.getSectionIterator();

	Ogre::String secName, typeName, archName;
	while (seci.hasMoreElements()) {
		secName = seci.peekNextKey();
		Ogre::ConfigFile::SettingsMultiMap *settings = seci.getNext();
		Ogre::ConfigFile::SettingsMultiMap::iterator i;
		for (i = settings->begin(); i != settings->end(); ++i) {
			typeName = i->first;
			archName = i->second;
			Ogre::ResourceGroupManager::getSingleton().addResourceLocation(
			archName, typeName, secName);
		}
	}

	ogreRoot->setRenderSystem(ogreRoot->getAvailableRenderers()[0]);
	ogreRoot->initialise(false);
	Ogre::NameValuePairList misc;
	misc["currentGLContext"] = Ogre::String("true");
	Ogre::RenderWindow* ogreWindow = ogreRoot->createRenderWindow("proofoconcept", 800, 600, false, &misc);
	ogreWindow->setVisible(true);

	Ogre::RenderTarget *ogreRenderTarget = ogreWindow;
	CEGUI::OgreRenderer::create(*ogreRenderTarget);
	CEGUI::OgreRenderer::bootstrapSystem(*ogreWindow);

	Ogre::SceneManager* ogreSceneMgr = ogreRoot->createSceneManager(Ogre::ST_GENERIC);

	Ogre::Camera* ogreCamera = ogreSceneMgr->createCamera("PlayerCam");

	ogreCamera->setPosition(Ogre::Vector3(0,0,10));
	ogreCamera->lookAt(Ogre::Vector3(0,0,-300));
	ogreCamera->setNearClipDistance(5);

	Ogre::Viewport* vp = ogreWindow->addViewport(ogreCamera);
	vp->setBackgroundColour(Ogre::ColourValue(0,0,0));

	ogreCamera->setAspectRatio(Ogre::Real(vp->getActualWidth()) / Ogre::Real(vp->getActualHeight()));

	Ogre::TextureManager::getSingleton().setDefaultNumMipmaps(5);

	Ogre::ResourceGroupManager::getSingleton().initialiseAllResourceGroups();

	ogreSceneMgr->setAmbientLight(Ogre::ColourValue(0.5f, 0.5f, 0.5f));

	Ogre::Entity* humanMesh = ogreSceneMgr->createEntity("Human", "human_mesh.mesh");

	Ogre::SceneNode* humanMeshNode = ogreSceneMgr->getRootSceneNode()->createChildSceneNode("HeadNode");
	humanMeshNode->attachObject(humanMesh);

	Ogre::Light* light = ogreSceneMgr->createLight("MainLight");
	light->setPosition(20.0f, 80.0f, 50.0f);

	CEGUI::SchemeManager::getSingleton().createFromFile("TaharezLook.scheme", "CEGUI");
	CEGUI::Window *statusWindow = CEGUI::WindowManager::getSingleton().loadLayoutFromFile("proofoconcept.layout", "CEGUI");
	CEGUI::System::getSingleton().getDefaultGUIContext().setRootWindow(statusWindow);

	while(1) {
		Ogre::WindowEventUtilities::messagePump();
		if(glfwGetKey(GLFW_KEY_ESC) == GLFW_PRESS) {
			break;
		}
		ogreRoot->renderOneFrame();
		glfwPollEvents();
	}
	delete ogreRoot;
}
Image

After carefully going over the TutorialApplication framework (which is what I should have done in the first place), I got it working.
User avatar
jacmoe
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 20570
Joined: Thu Jan 22, 2004 10:13 am
Location: Denmark
x 179
Contact:

Re: Trying to use Ogre with GLFW [Solved]

Post by jacmoe »

I can't remember if I ever saw Ogre running in GLFW before.

I've heard of hacks that didn't quite work, so this is great. :)
/* Less noise. More signal. */
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.
damian0815
Gnoblar
Posts: 2
Joined: Sat May 17, 2014 8:04 pm

Re: Trying to use Ogre with GLFW [Solved]

Post by damian0815 »

To make this work on OSX I had to make a few changes + pass some extra vars to the Ogre create window function.

I also had to save the file as main.mm.

I removed CEGUI and the references to human.mesh, and tweaked the paths a little. Background is dark green to prove that Ogre is drawing to the window.

Code: Select all


#include <iostream>

#include <GLFW/glfw3.h>

#define GLFW_EXPOSE_NATIVE_COCOA
#define GLFW_EXPOSE_NATIVE_NSGL
#include <GLFW/glfw3native.h>

#include <OGRE/Ogre.h>

int main(int argc, char** argv) {
	
	char buf[2048];
	printf("cwd: %s\n", getcwd(buf, 2048));
	
	if(!glfwInit()) {
		std::cout << "GLFW failed to initialize" << std::endl;
		return 1;
	}
	GLFWwindow* window = glfwCreateWindow( 800, 600, "OgreGFLW", NULL, NULL );
	if(!window) {
		std::cout << "GLFW window failed to open" << std::endl;
		return 1;
	}
	
	Ogre::Root* ogreRoot = new Ogre::Root("../../resources/plugins.cfg");
	
	Ogre::ConfigFile ogreConfig;
	ogreConfig.load("../../resources/resources.cfg");
	
	Ogre::ConfigFile::SectionIterator seci = ogreConfig.getSectionIterator();
	
	Ogre::String secName, typeName, archName;
	while (seci.hasMoreElements()) {
		secName = seci.peekNextKey();
		Ogre::ConfigFile::SettingsMultiMap *settings = seci.getNext();
		Ogre::ConfigFile::SettingsMultiMap::iterator i;
		for (i = settings->begin(); i != settings->end(); ++i) {
			typeName = i->first;
			archName = i->second;
			Ogre::ResourceGroupManager::getSingleton().addResourceLocation(
																		   archName, typeName, secName);
		}
	}
	
	ogreRoot->setRenderSystem(ogreRoot->getAvailableRenderers()[0]);
	ogreRoot->initialise(false);

	Ogre::NameValuePairList misc;
	misc["macAPI"] = Ogre::String("cocoa");
	
	
	// expose NSGL stuff for ogre
	misc["macAPICocoaUseNSView"] = Ogre::String("true");
	NSWindow* nsWindow = glfwGetCocoaWindow(window);
	NSView* view = nsWindow.contentView;
	misc["externalWindowHandle"] = Ogre::StringConverter::toString((unsigned long)view);
	misc["externalGLContext"] = Ogre::StringConverter::toString((unsigned long)glfwGetNSGLContext(window));
	
	Ogre::RenderWindow* ogreWindow = ogreRoot->createRenderWindow("proofoconcept", 800, 600, false, &misc);
	ogreWindow->setVisible(true);
	
	/*
	Ogre::RenderTarget *ogreRenderTarget = ogreWindow;
	CEGUI::OgreRenderer::create(*ogreRenderTarget);
	CEGUI::OgreRenderer::bootstrapSystem(*ogreWindow);*/
	
	Ogre::SceneManager* ogreSceneMgr = ogreRoot->createSceneManager(Ogre::ST_GENERIC);
	
	Ogre::Camera* ogreCamera = ogreSceneMgr->createCamera("PlayerCam");
	
	ogreCamera->setPosition(Ogre::Vector3(0,0,10));
	ogreCamera->lookAt(Ogre::Vector3(0,0,-300));
	ogreCamera->setNearClipDistance(5);
	
	Ogre::Viewport* vp = ogreWindow->addViewport(ogreCamera);
	vp->setBackgroundColour(Ogre::ColourValue(0,0.5,0)); // green
	
	ogreCamera->setAspectRatio(Ogre::Real(vp->getActualWidth()) / Ogre::Real(vp->getActualHeight()));
	
	Ogre::TextureManager::getSingleton().setDefaultNumMipmaps(5);
	
	Ogre::ResourceGroupManager::getSingleton().initialiseAllResourceGroups();
	
	ogreSceneMgr->setAmbientLight(Ogre::ColourValue(0.5f, 0.5f, 0.5f));
	
	/*
	Ogre::Entity* humanMesh = ogreSceneMgr->createEntity("Human", "human_mesh.mesh");
	
	Ogre::SceneNode* humanMeshNode = ogreSceneMgr->getRootSceneNode()->createChildSceneNode("HeadNode");
	humanMeshNode->attachObject(humanMesh);*/
	
	Ogre::Light* light = ogreSceneMgr->createLight("MainLight");
	light->setPosition(20.0f, 80.0f, 50.0f);
	
	
	/*CEGUI::SchemeManager::getSingleton().createFromFile("TaharezLook.scheme", "CEGUI");
	 CEGUI::Window *statusWindow = CEGUI::WindowManager::getSingleton().loadLayoutFromFile("proofoconcept.layout", "CEGUI");
	 CEGUI::System::getSingleton().getDefaultGUIContext().setRootWindow(statusWindow);*/
	
	while(1) {
		Ogre::WindowEventUtilities::messagePump();
		/*if ( glfwGetKey(window, GLFW_KEY_ESCAPE) == GLFW_PRESS) {
			break;
		}*/
		ogreRoot->renderOneFrame();
		glfwPollEvents();
	}
	delete ogreRoot;
}
Post Reply