KiCad PCB EDA Suite
Loading...
Searching...
No Matches
ogl_utils.h File Reference

Define generic OpenGL functions that are common to any OpenGL target. More...

#include <wx/image.h>
#include "3d_rendering/image.h"
#include <plugins/3dapi/c3dmodel.h>

Go to the source code of this file.

Functions

void OglSetMaterial (const SMATERIAL &aMaterial, float aOpacity, bool aUseSelectedMaterial=false, SFVEC3F aSelectionColor=SFVEC3F(0.0f))
 Set OpenGL materials.
 
void OglSetDiffuseMaterial (const SFVEC3F &aMaterialDiffuse, float aOpacity, bool aUseSelectedMaterial=false, SFVEC3F aSelectionColor=SFVEC3F(0.0f))
 Sets only the diffuse color and keep other parameters with default values.
 
GLuint OglLoadTexture (const IMAGE &aImage)
 Generate a new OpenGL texture.
 
void OglGetScreenshot (wxImage &aDstImage)
 Get the pixel data of current OpenGL image.
 
void OglDrawBackground (const SFVEC4F &aTopColor, const SFVEC4F &aBotColor)
 
void OglResetTextureState ()
 Reset to default state the texture settings.
 

Detailed Description

Define generic OpenGL functions that are common to any OpenGL target.

Definition in file ogl_utils.h.

Function Documentation

◆ OglDrawBackground()

void OglDrawBackground ( const SFVEC4F aTopColor,
const SFVEC4F aBotColor 
)

Definition at line 185 of file ogl_utils.cpp.

Referenced by RENDER_3D_OPENGL::Redraw(), and RENDER_3D_RAYTRACE_GL::Redraw().

◆ OglGetScreenshot()

void OglGetScreenshot ( wxImage &  aDstImage)

Get the pixel data of current OpenGL image.

Parameters
aDstImagethe output image. the image must be destroyed to free the data.

Definition at line 37 of file ogl_utils.cpp.

Referenced by EDA_3D_CANVAS::GetScreenshot().

◆ OglLoadTexture()

GLuint OglLoadTexture ( const IMAGE aImage)

Generate a new OpenGL texture.

Parameters
aImagea image to generate the texture from.
Returns
the OpenGL texture index created.

Definition at line 96 of file ogl_utils.cpp.

References IMAGE::GetBuffer(), IMAGE::GetHeight(), and IMAGE::GetWidth().

Referenced by RENDER_3D_OPENGL::initializeOpenGL().

◆ OglResetTextureState()

void OglResetTextureState ( )

Reset to default state the texture settings.

Definition at line 214 of file ogl_utils.cpp.

Referenced by RENDER_3D_OPENGL::Redraw().

◆ OglSetDiffuseMaterial()

void OglSetDiffuseMaterial ( const SFVEC3F aMaterialDiffuse,
float  aOpacity,
bool  aUseSelectedMaterial = false,
SFVEC3F  aSelectionColor = SFVEC3F(0.0f) 
)

Sets only the diffuse color and keep other parameters with default values.

Parameters
aMaterialDiffusethe diffuse color to assign to material properties.

Definition at line 168 of file ogl_utils.cpp.

Referenced by MODEL_3D::Draw().

◆ OglSetMaterial()

void OglSetMaterial ( const SMATERIAL aMaterial,
float  aOpacity,
bool  aUseSelectedMaterial = false,
SFVEC3F  aSelectionColor = SFVEC3F(0.0f) 
)

Set OpenGL materials.

Parameters
aMateriala material structure with parameters to set.
aOpacitymain model opacity 0.0 full transparent, 1.0 full opaque.
aUseSelectedMaterialif material should be set for selection mode.
aSelectionColormaterial to use for selection in case it is enabled.

Definition at line 144 of file ogl_utils.cpp.

References SMATERIAL::m_Ambient, SMATERIAL::m_Diffuse, SMATERIAL::m_Emissive, SMATERIAL::m_Shininess, SMATERIAL::m_Specular, and SMATERIAL::m_Transparency.

Referenced by MODEL_3D::Draw(), RENDER_3D_OPENGL::renderBoardBody(), RENDER_3D_OPENGL::setCopperMaterial(), and RENDER_3D_OPENGL::setLayerMaterial().