
|
|
|
Home > Forums > OpenGL > OpenGL and Fullscreen Issue with Rendering Line |
Page :
1 |
| OpenGL and Fullscreen Issue with Rendering Line |
Author :
michaelp2234
Post Date :
2008-12-07 08:35
Posts :
2
|
Hi, I was doing a basic app and was having fun drawing some points, and lines, but I noticed that when I switch to fullscreen that the line won't appear, but the points will. I used all the code from this site to setup a win32 opengl app. |
Author :
michaelp2234
Post Date :
2008-12-07 08:38
Posts :
2
|
// filename: main.cpp
// date: 27 Nov 2008
// author: Michael Peacock
// sources: ZeusCMD, Grant James. www.zeuscmd.com
////////////////////////////////////////////////////
// Notes //
////////////////////////////////////////////////////
/**************************************************
MOVING OBJECTS WITH MOUSE
In order to use the mouse to change an objects coordinates,
you may need to convert the WindowCoordinates to World Coordinates,
this includes X and Y.
***************************************************/
#include "glutil.h"
OpenGL *opengl;
///////////////////////////////////////////////////
// Prototypes //
///////////////////////////////////////////////////
// OpenGL Functions
bool init();
void display();
void idle();
void resize(int w, int h);
///////////////////////////////////////////////////
// Implementation //
///////////////////////////////////////////////////
bool init()
{
int w = opengl->getWidth(), h = opengl->getHeight();
glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
// Enable States
glEnable(GL_DEPTH_TEST);
glDepthFunc(GL_LEQUAL);
glClearDepth(1.0);
//glShadeModel(GL_SMOOTH);
return true;
}
void display()
{
glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
gluLookAt(
0.0, 0.0, 1.0,
0.0, 0.0, 0.0,
0.0, 1.0, 0.0);
glColor3f(0.93f, 0.93f, 1.0f);
glBegin(GL_LINES);
glVertex2f(0.0f, 0.0f);
glVertex2f(10.0f,10.0f);
glEnd();
glFlush();
}
void idle()
{
}
void resize(int w, int h)
{
if(h==0) h = 1;
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glViewport(0, 0, w, h);
gluOrtho2D(-10.0f, 10.0f, -10.0f, 10.0f);
//gluPerspective(45.0, w/h, 1.0, 100.0);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
}
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd)
{
opengl = OpenGL::create(); //initiate an object of our class
opengl->setInitFunc(init);
opengl->setDisplayFunc(display);
opengl->setIdleFunc(idle);
opengl->setResizeFunc(resize);
if(!opengl->initGL("OpenGL Window", 600, 600, false, 32)){
return 1;
}
opengl->runMessageLoop();
return 0;
}
|
|
|
Home > Forums > OpenGL > OpenGL and Fullscreen Issue with Rendering Line |
Page :
1 |
All Rights Reserved, © Zeus Communications, Multimedia & Development 2004-2005
Read the Disclaimer
|
What tutorial would you like to see next?
|
Useful Books :
|
|
Link to ZeusCMD
|
|