本文整理汇总了C++中DrawGLScene函数的典型用法代码示例。如果您正苦于以下问题:C++ DrawGLScene函数的具体用法?C++ DrawGLScene怎么用?C++ DrawGLScene使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了DrawGLScene函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: processMouseActiveMotion
// Fonction d'interaction : choix de l'opération à faire (cinématique directe / inverse)
void processMouseActiveMotion(int x, int y)
{
switch (m_boutton)
{
// Cinématique inverse
case GLUT_LEFT_BUTTON : // Manipulation par cinématique inverse
//..
break;
// Cinématique directe
case GLUT_MIDDLE_BUTTON : // Manipulation directe du segment UpArm
//..
break;
case GLUT_RIGHT_BUTTON : // Manipulation durecte du segment LowArm
m_LowArm.rot.z = m_Grab_LowArm_Rot_Z + ROTATE_SPEED * (m_mousepos_x - x);
DrawGLScene();
break;
}
}
示例2: update
void update(int value){
DrawGLScene();
glutPostRedisplay();
// block_left =block_left + 0.1f;
// robot_rot ++ ;
// printf("%f\n",Scale);
_model->advance(0.025f);
if(flag_scale==0){
Scale = Scale + 0.1;
block_left = block_left + 0.1f;
}
else{
block_left = block_left - 0.1f;
Scale = Scale - 0.1;
}
if(Scale >= 2.0 || Scale <= 0.0)
flag_scale = !flag_scale ;
/* if(w_flag!=1){
_model->setAnimation("stand");
w_flag=0;
}*/
glutTimerFunc(100,update,0);
}
示例3: OnPaint
void OnPaint(HWND hwnd)
{
DrawGLScene();
SwapBuffers(hDC);
DrawPicture(hwnd);
DrawFigure();
}
示例4: main
int main(void) {
//---------------------------------------------------------------------------------
tblu = bluCreate();
initRes();
bsp = *((bluSprite*)tblu->System_ResourceFactory());
tblu->Input_Init();
tblu->GFX_Initiate();
tblu->GFX_LDSprite(&bsp);
tblu->GFX_InitAnimationFrames(&tban, 2);
tblu->GFX_AddAnimationFrame(&tban, 0, sgunTiles, sgunPal, sgunTilesLen, sgunPalLen);
tblu->GFX_AddAnimationFrame(&tban, 1, sgunTiles+512, sgunPal, sgunTilesLen, sgunPalLen);
tblu->System_SetFunc(FrameProc, BLUFRAMFUNC);
consoleDemoInit(); //setup the sub screen for printing
tblu->System_Start();
tblu->GFX_Init3DDevice();
while(1){
DrawGLScene();
glFlush(0);
}
/* tblu->Release();
while(1) {
touchRead(&touch);
iprintf("Touch y = %04i, %04i\n", touch.rawy, touch.py);
swiWaitForVBlank();
}
*/ return 0;
}
示例5: WinMain
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow){
MSG msg;
BOOL done=FALSE;
init("window",640,480);
if (CreateGLWindow() == FALSE){
return 0;
}
elemInit();
while(!done){
if (PeekMessage(&msg,NULL,0,0,PM_REMOVE)){
if (msg.message==WM_QUIT){
done=TRUE;
}else{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
}else{
if (keys[VK_ESCAPE]){
done=TRUE;
}else{
DrawGLScene();
SwapBuffers(hDC);
}
}
}
KillGLWindow();
return (msg.wParam);
}
示例6: keyPressed
void keyPressed(unsigned char key, int x, int y)
{
switch(key) {
case 27:
glutDestroyWindow(window);
exit(0);
case 'r':
doRotate = !doRotate;
break;
case 't':
doTranslate = !doTranslate;
break;
case 's':
doScale = !doScale;
break;
case '+':
speed *= 1.1;
frame = 0;
break;
case '-':
speed /= 1.1;
frame = 0;
break;
default:
useMyOrtho = !useMyOrtho;
ReSizeGLScene(windowWidth,windowHeight);
}
DrawGLScene();
}
示例7: callback_display
/***************************************************************************
callback_display
****************************************************************************/
void callback_display(void)
{
//GLint viewport[4];
//glGetIntegerv(GL_VIEWPORT, viewport);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
//gluPerspective(15.0, aspect, zNear, zFar);
//glOrtho(-1/sdepth*kWindowWidth, 1/sdepth*kWindowWidth, -1/sdepth*kWindowHeight, 1/sdepth*kWindowHeight, zNear, zFar);
glTranslatef(0.0,0.0,-100);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
//glTranslatef(0.0,0.0,-sdepth);
glRotatef(-stheta, 1.0, 0.0, 0.0);
glRotatef(sphi, 0.0, 0.0, 1.0);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
DrawGLScene();
//glTranslatef(0.0,0.0, sdepth);
glutSwapBuffers();
}
示例8: update_sdl_scene
static gboolean
update_sdl_scene (void *fk)
{
GstElement *fakesink = (GstElement *) fk;
GMainLoop *loop =
(GMainLoop *) g_object_get_data (G_OBJECT (fakesink), "loop");
GAsyncQueue *queue_input_buf =
(GAsyncQueue *) g_object_get_data (G_OBJECT (fakesink),
"queue_input_buf");
GAsyncQueue *queue_output_buf =
(GAsyncQueue *) g_object_get_data (G_OBJECT (fakesink),
"queue_output_buf");
GstBuffer *buf = (GstBuffer *) g_async_queue_pop (queue_input_buf);
SDL_Event event;
while (SDL_PollEvent (&event)) {
if (event.type == SDL_QUIT) {
g_main_loop_quit (loop);
}
if (event.type == SDL_KEYDOWN) {
if (event.key.keysym.sym == SDLK_ESCAPE) {
g_main_loop_quit (loop);
}
}
}
DrawGLScene (buf);
/* push buffer so it can be unref later */
g_async_queue_push (queue_output_buf, buf);
return FALSE;
}
示例9: ResizeScene
LRESULT CGLLogoView::OnSize(UINT, WPARAM, LPARAM lParam, BOOL&)
{
ResizeScene(LOWORD(lParam),HIWORD(lParam)); // LoWord=width, HiWord=height
DrawGLScene();
SwapBuffers(hDC);
return TRUE;
}
示例10: WinMain
int WINAPI WinMain( HINSTANCE hInstance, // Instance
HINSTANCE hPrevInstance, // Previous Instance
LPSTR lpCmdLine, // Command Line Parameters
int nCmdShow) // Window Show State
{
MSG msg; // Windows Message Structure
BOOL done=FALSE; // Bool Variable To Exit Loop
// Ask The User Which Screen Mode They Prefer
if (MessageBox(NULL,"Would You Like To Run In Fullscreen Mode?", "Start FullScreen?",MB_YESNO|MB_ICONQUESTION)==IDNO)
{
fullscreen=FALSE; // Windowed Mode
}
InitVars(); // Initialize Variables
// Create Our OpenGL Window
if (!CreateGLWindow("Magic Room",640,480,16,fullscreen))
{
return 0; // Quit If Window Was Not Created
}
while(!done) // Loop That Runs While done=FALSE
{
if (PeekMessage(&msg,NULL,0,0,PM_REMOVE)) // Is There A Message Waiting?
{
if (msg.message==WM_QUIT) // Have We Received A Quit Message?
{
done=TRUE; // If So done=TRUE
}
else // If Not, Deal With Window Messages
{
TranslateMessage(&msg); // Translate The Message
DispatchMessage(&msg); // Dispatch The Message
}
}
else // If There Are No Messages
if (active)
{
// Draw The Scene. Watch For ESC Key And Quit Messages From DrawGLScene()
if (keys[VK_ESCAPE]) // Active? Was There A Quit Received?
{
done=TRUE; // ESC or DrawGLScene Signalled A Quit
}
else // Not Time To Quit, Update Screen
{
idle(); // Advance Simulation
DrawGLScene(); // Draw Scene
SwapBuffers(hDC); // Swap Buffers (Double Buffering)
}
if (!ProcessKeys()) return 0;
}
}
// Shutdown
KillGLWindow(); // Kill The Window
glDeleteTextures(4,texture);
return (msg.wParam); // Exit The Program
}
示例11: keyPressed
void keyPressed(unsigned char key, int x, int y)
{
switch(key) {
case 27:
glutDestroyWindow(window);
exit(0);
case 'r':
x_rotation = 0.0f;
z_rotation = 0.0f;
rotation_mode = ROTATE_X_AND_Z;
printf("X and Z rotation reset to 0 degrees\n");
printf("Mouse rotates around both X and Z axes\n");
break;
case 'x':
rotation_mode = ROTATE_ONLY_X;
printf("Mouse rotates only around X axis\n");
break;
case 'z':
rotation_mode = ROTATE_ONLY_Z;
printf("Mouse rotates only around Z axis\n");
break;
}
DrawGLScene();
}
示例12: ScreenSaverProc
LONG WINAPI ScreenSaverProc(HWND hwnd,UINT message,WPARAM wparam,LPARAM lparam){
// Handles screen saver messages
switch(message)
{
case WM_CREATE:
// Creation of the screen saver window
hWnd = hwnd;
SetupOpenGL();
// Set Timer (Target 60 fps ish (1000/60 = 16)
uTimer = SetTimer(hwnd, 1, 16, NULL);
return 0;
case WM_ERASEBKGND:
// Erases the screen saver background
// Not needed with OpenGL
return 0;
case WM_TIMER:
// Handles the timer
DrawGLScene();
return 0;
case WM_DESTROY:
// Cleans up the screen saver window
KillTimer(hwnd, uTimer);
KillGL();
PostQuitMessage(0);
return 0;
}
return DefScreenSaverProc(hwnd,message,wparam,lparam);
}
示例13: WinMain
int WINAPI WinMain(HINSTANCE hInstance,
HINSTANCE hPreInstance,
LPSTR lpCmdLine,
int cmdShow)
{
MSG msg;
BOOL done = false;
CreateGLWindow("openGL", 640, 480, 32, true);
while (!done)
{
if (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
{
if (msg.message == WM_QUIT)
{
done = TRUE;
}
else
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
}
else
{
if (active)
{
if (keys[VK_ESCAPE])
{
done = TRUE;
}
else
{
DrawGLScene();
SwapBuffers(hDC);
}
}
if (keys[VK_F1])
{
keys[VK_F1] = FALSE;
KillGLWindow();
fullscreen = !fullscreen;
if (!CreateGLWindow("NeHe's OpenGL Framework", 640, 480, 16, fullscreen))
{
return 0;
}
}
}
}
//注册窗口类
//程序初始化
//消息循环
return (msg.wParam);
}
示例14: main
int main() {
// Setup the Main screen for 3D
videoSetMode(MODE_0_3D);
// initialize the geometry engine
glInit();
// enable antialiasing
glEnable(GL_ANTIALIAS);
// setup the rear plane
glClearColor(0,0,0,31); // BG must be opaque for AA to work
glClearPolyID(63); // BG must have a unique polygon ID for AA to work
glClearDepth(0x7FFF);
// Set our viewport to be the same size as the screen
glViewport(0,0,255,191);
// setup the view
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluPerspective(70, 256.0 / 192.0, 0.1, 100);
//ds specific, several attributes can be set here
glPolyFmt(POLY_ALPHA(31) | POLY_CULL_NONE);
while (1)
{
// Set the current matrix to be the model matrix
glMatrixMode(GL_MODELVIEW);
glColor3f(1, 1, 1); // Set the color..not in nehe source...ds gl default will be black
//Push our original Matrix onto the stack (save state)
glPushMatrix();
DrawGLScene();
// Pop our Matrix from the stack (restore state)
glPopMatrix(1);
//a handy little built in function to wait for a screen refresh
swiWaitForVBlank();
// flush to screen
glFlush(0);
scanKeys();
int pressed = keysDown();
if(pressed & KEY_START) break;
}
return 0;
}
示例15: specialKeyPressed
void
specialKeyPressed(int key, int x, int y)
{
(void)x;
(void)y;
(void)key;
DrawGLScene();
}