本文整理汇总了C++中RenderScene函数的典型用法代码示例。如果您正苦于以下问题:C++ RenderScene函数的具体用法?C++ RenderScene怎么用?C++ RenderScene使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了RenderScene函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: HandleKeyPressEvent
void HandleKeyPressEvent(SDL_keysym * keysym)
{
switch(keysym -> sym) // which key have we got
{
case SDLK_F1 : // if it is F1
ToggleFullScreen(); // toggle between fullscreen and windowed mode
break;
case SDLK_ESCAPE: // if it is ESCAPE
Quit(0); // quit after cleaning up
case SDLK_UP : // If we hit the UP arrow Key
g_Camera.MoveCamera(kSpeed); // Move Camera by a forward positive speed
RenderScene(); // Redraw the scene to reflect changes
break;
case SDLK_DOWN : // If we hit the Down arrow Key
g_Camera.MoveCamera(-kSpeed); // Move Camera backward by a negative speed
RenderScene(); // Redraw the scene to reflect changes
break;
default: // any other key
break; // nothing to do
}
}
示例2: Menu
void Menu(int value)
{
switch (value)
{
case GL_CULL_FACE:
iCull = !iCull;
glutSetWindowTitle("Stozek - GL_CULL_FACE");
RenderScene();
break;
case GL_DEPTH_TEST:
iDepth = !iDepth;
glutSetWindowTitle("Stozek - GL_DEPTH_TEST");
RenderScene();
break;
case GL_LINE:
iOutline = true;
glutSetWindowTitle("Stozek - GL_LINE");
RenderScene();
break;
case GL_FILL:
iOutline = false;
glutSetWindowTitle("Stozek - GL_LINE");
RenderScene();
break;
case EXIT:
exit(0);
}
}
示例3: WinProc
LRESULT CALLBACK WinProc(HWND hWnd,UINT uMsg, WPARAM wParam, LPARAM lParam)
{
LONG lRet = 0;
PAINTSTRUCT ps;
switch (uMsg)
{
case WM_SIZE: // If the window is resized
if(!g_bFullScreen) // Do this only if we are in window mode
{
SizeOpenGLScreen(LOWORD(lParam),HIWORD(lParam));// LoWord=Width, HiWord=Height
GetClientRect(hWnd, &g_rRect); // Get the window rectangle
}
break;
case WM_PAINT: // If we need to repaint the scene
BeginPaint(hWnd, &ps); // Init the paint struct
EndPaint(hWnd, &ps); // EndPaint, Clean up
break;
case WM_KEYDOWN:
//////////// *** NEW *** ////////// *** NEW *** ///////////// *** NEW *** ////////////////////
switch(wParam) { // Check if we hit a key
case VK_ESCAPE:
PostQuitMessage(0); // Send a QUIT message
break;
case VK_UP: // If we hit the UP arrow key
g_Camera.MoveCamera(kSpeed); // Move our camera forward by a positive speed
RenderScene(); // Redraw the screen to reflect changes
break;
case VK_DOWN: // If we hit the DOWN arrow key
g_Camera.MoveCamera(-kSpeed); // Move our camera backward by a negative speed
RenderScene(); // Redraw the screen to reflect changes
break;
}
break;
//////////// *** NEW *** ////////// *** NEW *** ///////////// *** NEW *** ////////////////////
case WM_CLOSE: // If the window is being closed
PostQuitMessage(0); // Post a QUIT message to the window; // Release memory and restore settings
break;
default: // Return by default
lRet = DefWindowProc (hWnd, uMsg, wParam, lParam);
break;
}
return lRet; // Return by default
}
示例4: Render
static void Render(int frameNumber) {
PixBufT *umap;
int du = 2 * frameNumber;
int dv = 4 * frameNumber;
{
MatrixStack3D *ms = GetObjectTranslation(scene, "Object");
StackReset(ms);
PushScaling3D(ms, 1.25f, 1.25f, 1.25f);
PushRotation3D(ms, 0, (float)(-frameNumber * 2), frameNumber);
PushTranslation3D(ms, 0.0f, 0.0f, -2.0f);
}
if (effectNum == 0) {
umap = NewPixBufWrapper(WIDTH, HEIGHT, uvmap->map.fast.u);
PROFILE(PixBufClear)
PixBufClear(shades);
PROFILE(RenderScene)
RenderScene(scene, shades);
PixBufSetBlitMode(shades, BLIT_ADDITIVE);
PixBufBlit(umap, 0, 0, orig, NULL);
PixBufBlit(umap, 0, 0, shades, NULL);
UVMapSetOffset(uvmap, du, dv);
UVMapRender(uvmap, canvas);
MemUnref(umap);
} else {
UVMapSetOffset(uvmap, du, dv);
UVMapRender(uvmap, canvas);
PROFILE(PixBufClear)
PixBufClear(shades);
PROFILE(RenderScene)
RenderScene(scene, shades);
PixBufSetColorMap(shades, colorMap);
PixBufSetBlitMode(shades, BLIT_COLOR_MAP);
PixBufBlit(canvas, 0, 0, shades, NULL);
}
c2p1x1_8_c5_bm(canvas->data, GetCurrentBitMap(), WIDTH, HEIGHT, 0, 0);
}
示例5: GetDocument
void COpenGLView::OnDraw(CDC* pDC)
{
COpenGLViewClassDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
// TODO: add draw code for native data here
::glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
PreRenderScene();
::glPushMatrix();
RenderStockScene();
::glPopMatrix();
::glPushMatrix();
RenderScene();
::glPopMatrix();
::glFinish();
if ( FALSE == ::SwapBuffers( m_pDC->GetSafeHdc() ) )
{
SetError(7);
}
}
示例6: ZeroMemory
bool Application::AppLoopFunc()
{
MSG msg;
ZeroMemory(&msg,sizeof(MSG));
do {// Обработка всех сообщений
while (PeekMessage(&msg, NULL, 0, 0, PM_NOREMOVE))
{
if (GetMessage(&msg, NULL, 0, 0))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
}
ProcessKBInput();
switch (Globals.ERS.d)
{
case ERS::Draw::SCENE:
RenderScene();
CCons.Draw();
break;
case ERS::Draw::TEXTURE:
RenderTexture();
};
SwapBuffersEXT();
}
while ( !Globals.Exiting );
return true;// Выход
}
示例7: CreateScene
void FGLRenderer::DrawScene(int drawmode)
{
static int recursion=0;
if (camera != nullptr)
{
ActorRenderFlags savedflags = camera->renderflags;
if (drawmode != DM_PORTAL && !r_showviewer)
{
camera->renderflags |= RF_INVISIBLE;
}
CreateScene();
camera->renderflags = savedflags;
}
else
{
CreateScene();
}
GLRenderer->mClipPortal = NULL; // this must be reset before any portal recursion takes place.
RenderScene(recursion);
// Handle all portals after rendering the opaque objects but before
// doing all translucent stuff
recursion++;
GLPortal::EndFrame();
recursion--;
RenderTranslucent();
}
示例8: main
///////////////////////////////////////////////////////////////////////////////
// Main entry point for GLFW based programs
int main( int argc , char * argv [])
{
// initialise GLFW
if(!glfwInit())
throw std::runtime_error("glfwInit failed");
// open a window with GLFW
glfwOpenWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
glfwOpenWindowHint(GLFW_OPENGL_VERSION_MAJOR, 3);
glfwOpenWindowHint(GLFW_OPENGL_VERSION_MINOR, 2);
glfwOpenWindowHint(GLFW_WINDOW_NO_RESIZE, GL_TRUE);
if(!glfwOpenWindow(800, 600, 0, 0, 0, 0, 0, 0, GLFW_WINDOW))
throw std::runtime_error("glfwOpenWindow failed. Can your hardware handle OpenGL 3.2?");
// initialise GLEW
glewExperimental = GL_TRUE; //stops glew crashing on OSX :-/
if (GLEW_OK != glewInit())
throw std::runtime_error("glewInit failed");
// make sure OpenGL version 3.2 API is available
if(!GLEW_VERSION_3_2)
throw std::runtime_error("OpenGL 3.2 API is not available.");
glfwSetWindowSizeCallback(ChangeSize);
SetupRC();
while(glfwGetWindowParam(GLFW_OPENED) && !glfwGetKey( GLFW_KEY_ESC ))
{
RenderScene();
glfwSwapBuffers();
}
glfwTerminate();
}
示例9: Display
//envent handle
void Display(void)
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glPushMatrix();
g_tbView.Apply(); //mouse control, which allows to rotate and move
glPushMatrix();
glRotated(g_fAng,0,1,0);
RenderScene();
glPopMatrix();
glPopMatrix();
//word
vector<string> strs;
strs.push_back("\"s\" key : idle on/off");
strs.push_back("SHIFT+\"f\" key : fullscreen on/off" );
strs.push_back("\"v\",\"e\",\"f\" key : switch vertex,edge,face drawing");
glColor3d(1.0,1.0,1.0);
//drawString(); //draw the string view of the teapot
glutSwapBuffers();
}
示例10: MainLoop
WPARAM MainLoop()
{
MSG msg;
while(1) // Do our infinate loop
{ // Check if there was a message
if (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
{
if(msg.message == WM_QUIT) // If the message wasnt to quit
break;
TranslateMessage(&msg); // Find out what the message does
DispatchMessage(&msg); // Execute the message
}
else // if there wasn't a message
{
/////// * /////////// * /////////// * NEW * /////// * /////////// * /////////// *
g_Camera.Update(); // Update the camera data
/////// * /////////// * /////////// * NEW * /////// * /////////// * /////////// *
RenderScene(); // Update the screen every frame (Not good in a game)
}
}
DeInit(); // Clean up and free all allocated memory
return(msg.wParam); // Return from the program
}
示例11: main
void main()
{
PSphere Sphere1;
PLightSource Light1,Light2;
Scene = new Environment;
Sphere1 = new Sphere(Vector(0,0,0),4);
Sphere1->Ambient(0.3);
Sphere1->Diffuse(0.2);
Sphere1->Specular(0.7);
Sphere1->Reflection(0.0);
Sphere1->Refraction(0.0);
Sphere1->PhongSize(30);
Sphere1->DefMaterial.Med = Glass;
Sphere1->Color(Red);
Sphere1->Add(new Bumps(7.0));
Light1 = new PointLight(Vector(-10,8,-20),20);
Light2 = new PointLight(Vector(10,8,-20),20);
Scene->Add(Sphere1);
Scene->Add(Light1);
Scene->Add(Light2);
Background = SkyBlue;
InitNoise();
SetCamera(Vector(0,0,-7),Vector(0,0,1),Vector(0,1,0));
RenderScene(1.5,1.0,300,200,"SAMPLE70.TGA");
DoneNoise();
}
示例12: MainLoop
WPARAM MainLoop()
{
MSG msg;
while(1) // Do our infinite loop
{
// Check if there was a message
if (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
{
if(msg.message == WM_QUIT) // If the message wasn't to quit
break;
TranslateMessage(&msg); // Find out what the message does
DispatchMessage(&msg); // Execute the message
}
else // If there wasn't a message
{
if(AnimateNextFrame(60)) // Make sure we only render 60 frames per second
{
RenderScene(); // Render the scene
}
}
}
DeInit(); // Clean up and free all allocated memory
return(msg.wParam); // Return from the program
}
示例13: RenderScene
bool GraphicsManager::RenderPreProcessing(Camera* cam)
{
bool result;
renderPass = 0;
// Render the scene as normal to the back buffer.
result = RenderScene(cam, renderPass);
if(!result)
{
return false;
}
renderPass = 1;
// Render the refraction of the scene to a texture.
result = RenderRefractionToTexture(cam, renderPass);
if(!result)
{
return false;
}
renderPass = 2;
// Render the reflection of the scene to a texture.
result = RenderReflectionToTexture(cam, renderPass);
if(!result)
{
return false;
}
return true;
}
示例14: RenderingThreadEntryPoint
///////////////////////////////////////////////////////////////////////////////
// Rendering Thread Entry Point
void RenderingThreadEntryPoint(void *pVoid)
{
// Setup the rendering context
SetupRC();
// Main loop for rendering
while(1)
{
// Check rendering state info, terminate if flagged
if(CheckStates())
break;
RenderScene();
// Swap buffers
SwapBuffers(hDC);
}
// Do any necessary cleanup and terminate
gluDeleteQuadric(pSphere);
// Finally, shut down OpenGL Rendering context
wglMakeCurrent(hDC, NULL);
wglDeleteContext(hRC);
_endthread(); // Terminate the thread nicely
}
示例15: Idle
void Idle()
{
static double lastDeltas[3] = { 0.0, 0.0, 0.0 };
static const double REFRESH_TIME = 1.0/60.0; // monitor with 60 Hz
// in milisec
int t = glutGet(GLUT_ELAPSED_TIME);
double newTime = (double)t*0.001;
double deltaTime = newTime - g_appTime;
if (deltaTime > REFRESH_TIME) deltaTime = REFRESH_TIME;
// average:
deltaTime = (deltaTime + lastDeltas[0] + lastDeltas[1] + lastDeltas[2]) * 0.25;
g_appTime = g_appTime+deltaTime;
// call Update:
UpdateScene(deltaTime);
// render frame:
RenderScene();
// save delta:
lastDeltas[0] = lastDeltas[1];
lastDeltas[1] = lastDeltas[2];
lastDeltas[2] = deltaTime;
}