41 m_DisplayResolution.width = 0;
42 m_DisplayResolution.height = 0;
43 m_DisplayResolution.aspect = 1.0;
47 m_DisplayResolution.
width = w;
48 m_DisplayResolution.
height = h;
49 m_DisplayResolution.
aspect = 1.0;
50 if ( !(h==0) != !(w==0) ) {
51 m_DisplayResolution.
aspect = (int)(h==0) - (int) (w==0);
54 m_DisplayResolution.
aspect =(float)w;
55 m_DisplayResolution.
aspect*= 1.0 / ((float)h);
69 m_DisplayResolution = p_src.m_DisplayResolution;
137 p_scene_effect = NULL;
172 MODebug2->
Message(
"moRenderManager::Init > Decoder Manager Acquired.");
187 GLenum err = glewInit();
192 cout << glewGetErrorString(err) << endl;
196 MODebug2->
Message(
"moRenderManager::Init > glew initialized succesfully!");
198 GLint max_tex_size = 0.0f;
199 GLint max_tex_rect_size = 0.0f;
200 GLint max_tex_buf_size = 0.0f;
216 MODebug2->
Message(
moText(
"moRenderManager::Init > GL_MAX_FRAGMENT_UNIFORM_COMPONENTS_ARB: ") +
IntToStr(GL_MAX_FRAGMENT_UNIFORM_COMPONENTS_ARB) );
217 MODebug2->
Message(
moText(
"moRenderManager::Init > GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS_ARB: ") +
IntToStr(GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS_ARB) );
219 glGetIntegerv(GL_MAX_TEXTURE_SIZE, &max_tex_size);
221 glGetIntegerv(GL_MAX_RECTANGLE_TEXTURE_SIZE, &max_tex_rect_size);
223 glGetIntegerv(GL_MAX_TEXTURE_BUFFER_SIZE, &max_tex_buf_size);
289 if ( GLEW_EXT_framebuffer_object )
292 MODebug2->
Message(
moText(
"moRenderManager::Init > Using framebuffer_object: creating one fbo per predefined textures (4). ") );
296 for (
int i = 0; i < 4; i++)
392 if (p_pObj==NULL || p_pCamera==NULL)
return 0;
434 Result = MMatrix*PMatrix;
464 int facesCount = Faces.Count();
477 const float *pfv = Result.GetPointer();
483 glEnable( GL_TEXTURE_2D );
484 glActiveTexture( GL_TEXTURE0 );
485 glBindTexture( GL_TEXTURE_2D, Mat.
m_MapGLId );
488 glUniformMatrix4fv( matrix_index, 1, GL_FALSE, pfv );
489 glUniform1i( texture_index, 0 );
493 glUniform3fv( light_index, 1, &Mat.
m_vLight[0] );
494 glUniform3fv( color_index, 1, &Mat.
m_Color[0] );
497 glEnableVertexAttribArray( position_index );
498 glVertexAttribPointer( position_index, 3, GL_FLOAT,
false, 0, &Gpx[0] );
500 glEnableVertexAttribArray( colors_index );
501 glVertexAttribPointer( colors_index, 3, GL_FLOAT,
false, 0, &Gcx[0] );
503 glEnableVertexAttribArray( texcoord_index );
504 glVertexAttribPointer( texcoord_index, 2, GL_FLOAT,
false, 0, &Gtx[0] );
506 glEnableVertexAttribArray( texcoordedge_index );
507 glVertexAttribPointer( texcoordedge_index, 2, GL_FLOAT,
false, 0, &Gtx[0] );
510 glEnableVertexAttribArray( normal_index );
511 glVertexAttribPointer( normal_index, 3, GL_FLOAT,
false, 0, &Gnx[0] );
516 for(
int i = 0; i < facesCount*3; i += 3)
517 glDrawArrays(GL_LINE_LOOP, i, 3);
521 glDrawArrays(GL_POINTS, 0, facesCount*3 );
526 glDrawArrays( GL_TRIANGLES, 0, facesCount*3 );
531 glDisableVertexAttribArray( position_index );
532 glDisableVertexAttribArray( colors_index );
533 glDisableVertexAttribArray( texcoord_index );
534 glDisableVertexAttribArray( texcoordedge_index );
535 glDisableVertexAttribArray( normal_index );
608 glBindTexture(GL_TEXTURE_2D, ptex->
GetGLId());
611 glTexCoord2f(0, 0.0);
615 glVertex2f(p_width, 0);
618 glVertex2f(p_width, p_height);
621 glVertex2f(0, p_height);
626 glBindTexture(GL_TEXTURE_2D, 0);
684 glBindTexture(GL_TEXTURE_2D, TexScreen->
GetGLId() );
688 glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 0, 0, TexScreen->
GetWidth(), TexScreen->
GetHeight(), 0 );
689 glBindTexture(GL_TEXTURE_2D, 0);
693 char strbuffer[0x100];
694 struct tm * timeinfo;
701 timeinfo = localtime ( &rawtime );
702 strftime ( strbuffer, 80,
"%Y-%m-%d-%H-%M-%S", timeinfo );
703 moText datetime = strbuffer;
704 strftime ( strbuffer, 80,
"%Y-%m-%d", timeinfo );
708 moText screenshot_filename;
712 screenshot_filename = file_pattern;
716 if (screenshot_filename==
"") {
722 screenshot_filename==
"image_{DATETIME}_{####}.png"
739 screenshot_name = screenshot_path + moSlash + screenshot_filename;
741 screenshot_path = pathname;
743 screenshot_name = screenshot_path + moSlash + screenshot_filename;
750 MODebug2->
Error(
"could not create directory: "+ screenshot_path);
786 glBindTexture(GL_TEXTURE_2D, pScreenText->
GetGLId() );
788 glBindTexture(GL_TEXTURE_2D, 0);
805 return GLEW_ARB_multitexture;
810 return GLEW_EXT_framebuffer_object;
815 return GLEW_ARB_shader_objects && GLEW_ARB_vertex_shader && GLEW_ARB_fragment_shader && GLEW_ARB_shading_language_100;
820 return !(GLEW_ARB_texture_non_power_of_two);
863 if ( w == 0 || h == 0 ) {
864 w = 1; h = 1; prop = 1.0;
867 prop = (float) h / (
float) w;
889 if ( w == 0 || h == 0 ) {
890 w = 1; h = 1; prop = 1.0;
893 prop = (float) h / (
float) w;
902 glViewport(0, 0, p_width, p_height);
MOboolean FramebufferObjectSupported() const
moTextureManager * m_pTextureManager
void SetPerspectiveView(MOint p_width, MOint p_height, double fovy=60.0, double aspect=1.0, double znear=0.1, double zfar=4000.0)
moTexParam GetTexParam(MOuint p_moid)
MOboolean Initialized()
Pregunta si está inicializado.
MOuint GetRSHTexHSegmentsIndex()
virtual MOboolean Finish()
MOuint GetRSHProjectionMatrixIndex()
moShaderManager * m_pSHManager
virtual float * GetVerticesUVBuffer()
virtual float * GetColorBuffer()
void Error(moText p_text)
Anuncia y registra un error.
void SetName(const moText &p_name)
virtual const moFaceArray & GetFaces() const
virtual long Duration()
Devuelve el valor del reloj del temporizador.
int CreateLayer(moEffect *p_scene_effect)
MOuint GetRSHTexCoordEdgeIndex()
moShaderGLSL & GetRenderShader()
MOboolean ValidDestTexNum(MOint p_tex_num) const
moRenderManager * GetRenderMan()
MOuint GetRSHNormalIndex()
Matrices para transformaciones en Open GL.
int Render(moObject3D *p_pObj, moCamera3D *p_pCamera)
virtual float * GetVerticesBuffer()
MOint RenderTexGLId(MOint p_tex_num)
MOboolean IsTextureNonPowerOf2Disabled() const
MOint AddTexture(MOuint p_type, moText p_name, moTexParam p_tex_param=MODefTex2DParams)
void SetResourceType(moResourceType p_restype)
MOuint GetRSHLightIndex()
float RenderProportion() const
MOboolean RenderResEqualScreenRes()
MOboolean BuildEmpty(MOuint p_width, MOuint p_height)
moVector3iArray moFaceArray
MOuint GetRSHTextureIndex()
#define MO_RENDER_RESOLUTION
MOuint GetRSHColorIndex()
MOint InterfaceHeight() const
void SetReadTexture(MOuint p_attach_point)
static bool CreateDirectory(moDirectory Dir)
virtual void StopShader()
MOint m_render_tex_moid[6]
void DrawTexture(MOint p_resolution, MOint p_tex_num)
moShaderManager * GetShaderMan()
MOboolean IsRenderToFBOEnabled()
#define MO_SCREEN_RESOLUTION
MOboolean DeleteFBO(MOuint p_fbo)
const moGLMatrixf & GetModelMatrix() const
moPolygonModes m_PolygonMode
moText CreateThumbnail(moText p_bufferformat, int w, int h, moText newfilename=moText(""))
clase de para manejar textos
moTexture * GetTexture(MOuint p_moid)
MOuint GetRSHOpacityIndex()
void SetFBOAttachPoint(MOuint p_fbo_attach_point)
moResourceManager * m_pResourceManager
Puntero al administrador de recursos.
void SetInterfaceView(int p_width, int p_height)
void Stop()
Detiene el temporizador.
MOint RenderHeight() const
Dispositivo de entrada/salida, típicamente, interfaces humanas de IO y datos ( teclado, mouse, tableta, tcp, udp, serial )
moDisplay & operator=(const moDisplay &p_src)
void SetFBO(moFBO *p_fbo)
moRenderManagerMode m_render_to_texture_mode
MOuint AddTexture(MOuint p_width, MOuint p_height, const moTexParam &p_param, MOuint p_glid, MOuint &p_attach_point)
void SetOutputConfiguration(moRenderOutputConfiguration p_output_configuration)
moDecoderManager * GetDecoderMan()
MOfloat GetMaxCoordT() const
MOuint GetRSHTexCoordIndex()
MOuint GetRSHPositionIndex()
MOuint GetGLId(MOuint p_moid)
MOboolean AddDepthStencilBuffer()
MOint InterfaceWidth() const
void SetFrameBufferObjectActive(bool active=true)
clase base para el manejo de una textura
Administrador de moBucket 's.
int m_PreviewShotIteration
void CopyRenderToTexture(MOint p_tex_num)
moResolution m_RenderResolution
void SetLabelName(const moText &p_labelname)
MOboolean ValidSourceTexNum(MOint p_tex_num) const
MOuint GetRSHColorsIndex()
MOint ScreenHeight() const
MOfloat GetMaxCoordS() const
moFBO * GetFBO(MOuint p_fbo)
MOint RenderWidth() const
Base abstracta de base para las geometrías.
static moDebug * MODebug2
Clase de impresión de errores para depuración
virtual void Start()
Inicia el temporizador.
moDataManager * GetDataMan()
void SetView(int p_width, int p_height)
moGLManager * m_pGLManager
void RenderLayer(int layer_id)
bool PreviewShot(bool shot_start=false)
moBucketsPool * m_pFramesPool
float ScreenProportion() const
virtual ~moRenderManager()
moDecoderManager * m_pDecoderManager
MOuint GetRSHTexWSegmentsIndex()
moTimerAbsolute m_PreviewShotTimer
LIBMOLDEO_API moText0 IntToStr(int a)
bool Started() const
Devuelve el estado del temporizador.
clase base para objetos dibujables
moDefineDynamicArray(moRenderClips) moDefineDynamicArray(moDisplays) moDisplay
MOuint GetRSHWireframeWidthIndex()
MOuint m_render_attach_points[4]
moRenderOutputConfiguration m_OutputConfiguration
virtual void StartShader()
MOboolean ShadersSupported() const
MOboolean MultiTextureSupported() const
void Message(moText p_text)
Anuncia un mensaje al usuario además de guardarlo en el log de texto.
void SetOrthographicView(MOint p_width=0, MOint p_height=0, float left=0.0, float right=1.0, float bottom=0.0, float top=1.0, float znear=-1.0, float zfar=1.0)
moRenderOutputConfiguration & GetOutputConfiguration()
MOint ScreenWidth() const
moFBManager * m_pFBManager
static bool DirectoryExists(moText dirname)
void SetType(moMoldeoObjectType p_type)
virtual float * GetNormalsBuffer()
moResolution m_OutputResolution
normal mode need this
bool Screenshot(moText pathname, moText &screenshot_result, const moText &image_format="PNG", const moText &file_pattern="image_{DATETIME}_{####}.png")
moTextureManager * GetTextureMan()
MOboolean BindFBO(MOuint p_fbo)
void SetRenderToTexMode(moRenderManagerMode p_render_to_texture_mode)