why it doesn't work?

why it doesn't work?

Post by danie » Mon, 27 Jan 2003 01:14:23



hello,

I have tried to create an OpenGL-Program from an empty Win32-Project
(Visual C++) [Nevertheless read on, please ;-)

Now, I have an empty OpenGL-Window and on 'resize' I do
the following things...

--
void DoGLUpdate(GLsizei width, GLsizei height)
{
Trace("new size [%dx%d]\n", width, height);

 glViewport(0,0,width,height);
 glClearColor(0.5f, 0.5f, 0.5f, 0.0f);
 glClear(GL_COLOR_BUFFER_BIT);

 glMatrixMode(GL_PROJECTION);
 glLoadIdentity();
/*gluOrtho2D(0.0, width, 0.0, height);*/

 SwapBuffers(hDC);
 DrawScene();

Quote:}

void DrawScene()
{
Trace("DrawScene: run\n");

 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
 /*glLoadIdentity();*/

 glBegin(GL_POLYGON);
  glColor3f(1.0, 1.0, 1.0);
  glVertex3f(50, 50, 0);
  glVertex3f(200, 50, 0);
  glVertex3f(200, 200, 0);
  glVertex3f(50, 200, 0);
 glEnd();

 glFlush();

Quote:}

--

Result: There is no polygon.
I hope there will come a few hints.
I like it really to write software (also in linux!), but now I'm feeling
very distressed

daniel

 
 
 

why it doesn't work?

Post by fungu » Mon, 27 Jan 2003 01:20:12



> void DoGLUpdate(GLsizei width, GLsizei height)
> {
> Trace("new size [%dx%d]\n", width, height);

>  SwapBuffers(hDC);
>  DrawScene();

Isn't this the wrong way round?

You might be interested in my simple OpenGL program
for Windows.

http://www.artlum.com/pub/opengl/simplegl.zip

--
<\___/>
/ O O \
\_____/  FTB.

 
 
 

1. gluLookAt...why this doesn't work

Hi,
here s a piece of code written with RealBasic on Mac:

(all the lights are defined well above)

  glMatrixMode GL_PROJECTION
  glLoadIdentity
  gluPerspective 55.0, me.width/me.height, 0.5, 120

  glMatrixMode GL_MODELVIEW
  glLoadIdentity
  glClear GL_COLOR_BUFFER_BIT + GL_DEPTH_BUFFER_BIT

  glEnable GL_LIGHTING
  glEnable GL_COLOR_MATERIAL

  glLoadidentity
  gluLookAt 0,0,12,0,0,0,0,1,0

  glColor3d 0.7,0.4,1.0
  glTranslate 0, 0, -12
  gluSphere quadSphere, .5, 24, 12

All i got is a blank screen.....

if i replace gluLookAt by gtranslate 0,0,-12 then i can see my sphere
so what's wrong with glulookAt ???

Many thanks for your help
Patrick.

2. 做PUZZLE EFFECT '的software

3. why translation doesn't work

4. VECTORPATH BBS now on the internet!!!!!! no long distance!!

5. why this doesn't work

6. Query about 2-D shape recognition algorithms or literature

7. Why glEdgeFlag doesn't work in D4

8. Opinions on MAX4

9. Why FloodFil doesn't work on Printer.Canvas?

10. Why doesn't this work!?

11. why doesn't this work

12. Why doesn't the history brush work?

13. newbie Q: why doesn't snowfall work?