Hide Table of Contents
InitializeShading Method (IModelView)

Sets up the model view for OpenGL shading.

.NET Syntax

Visual Basic (Declaration) 
Sub InitializeShading() 
Visual Basic (Usage) 
Dim instance As IModelView
 
instance.InitializeShading()
C# 
void InitializeShading()
C++/CLI 
void InitializeShading(); 

Remarks

Third-party developers should call this method if they are going to use OpenGL shading and are unsure whether shading has already been used for the current window. This method needs to be called for any window drawn into with OpenGL calls.

This method is provided so third-party applications do not need to use any of the Choos...() functions provided in the OpenGL library. Many of the Choos..() functions, for example ChoosePixelFormat(), can only be called once per window. In the case of ChoosePixelFormat(), a second call to the function is ignored. The effect is harmless if the third-party application makes this call after the SOLIDWORKS application has made the call. However, it is dangerous if the third party were to call it first because the SOLIDWORKS application may require a more complicated format.

To make OpenGL calls,you must get an OpenGL render context (RC). We keep our render context private so that there are not any problems with corruption of SOLIDWORKS RC by an application. To get a rendering context to make OpenGL calls, you must:

uiModelView_c::InitializeShading()

CClientDC dC(CWnd* parentWindow);

HGLRC hRc = ::wglCreateContext(dC.m_hDC);

::wglMakeCurrent(dC.m_hDC, hRc); (call this before each 'paint' operation)

When you are done using OpenGL for this paint'operation, call:

::wglMakeCurrent(NULL, NULL);

When the DLL shuts down or the IModelView object is destroyed (watch for a DModelViewEvents DestroyNotify2), your application must do the following:

::wglMakeCurrent(NULL, NULL);

::wglDeleteContext(hRc);

 

See Also



Provide feedback on this topic

SOLIDWORKS welcomes your feedback concerning the presentation, accuracy, and thoroughness of the documentation. Use the form below to send your comments and suggestions about this topic directly to our documentation team. The documentation team cannot answer technical support questions. Click here for information about technical support.

* Required

 
*Email:  
Subject:   Feedback on Help Topics
Page:   InitializeShading Method (IModelView)
*Comment:  
*   I acknowledge I have read and I hereby accept the privacy policy under which my Personal Data will be used by Dassault Systèmes

Print Topic

Select the scope of content to print:

x

We have detected you are using a browser version older than Internet Explorer 7. For optimized display, we suggest upgrading your browser to Internet Explorer 7 or newer.

 Never show this message again
x

Web Help Content Version: API Help (English only) 2019 SP05

To disable Web help from within SOLIDWORKS and use local help instead, click Help > Use SOLIDWORKS Web Help.

To report problems encountered with the Web help interface and search, contact your local support representative. To provide feedback on individual help topics, use the “Feedback on this topic” link on the individual topic page.