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

implements generic openGL functions that are common to any openGL target More...

#include <stdexcept>
#include <gal/opengl/kiglew.h>
#include "openGL_includes.h"
#include "ogl_utils.h"

Go to the source code of this file.

Functions

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

Detailed Description

implements generic openGL functions that are common to any openGL target

Definition in file ogl_utils.cpp.

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().