Real Software Forums
http://forums.realsoftware.com/

A simple red book example without glut.
http://forums.realsoftware.com/viewtopic.php?f=4&t=31514
Page 1 of 1

Author:  JustSomeGuy [ Thu Dec 10, 2009 12:44 pm ]
Post subject:  A simple red book example without glut.

I'm trying to get started but non of the Red book examples seem to be working for me. (And non of my old simulations work either)
I think this is because of GLUT...
From Red Book version 1.2 Chapter 1 Example 1.2, Page 18

Function Render() As Boolean
OpenGL.glClear(OpenGL.GL_COLOR_BUFFER_BIT)
OpenGL.glColor3f(1.0, 1.0, 1.0)

OpenGL.glBegin(OpenGL.GL_POLYGON)
OpenGL.glVertex3f(0.25, 0.25, 0.0)
OpenGL.glVertex3f(0.75, 0.25, 0.0)
OpenGL.glVertex3f(0.75, 0.75, 0.0)
OpenGL.glVertex3f(0.25, 0.75, 0.0)
OpenGL.glEnd()

OpenGL.glFlush()
End Function

Sub Open()
OpenGL.glClearColor(0.0, 0.0, 0.0, 0.0)
OpenGL.glMatrixMode(OpenGl.GL_PROJECTION)
OpenGL.glLoadIdentity()
OpenGL.glOrtho(0.0, 1.0, 0.0, 1.0, -1.0, 1.0)
OpenGL.glShadeModel(OpenGL.GL_FLAT)
End Sub

Author:  Blake [ Thu Dec 10, 2009 3:09 pm ]
Post subject:  Re: A simple red book example without glut.

works perfectly for me, all I did was add a timer with a call to OpenGLSurface1.Render() in its action event.

Image

Author:  JustSomeGuy [ Thu Dec 10, 2009 3:28 pm ]
Post subject:  Re: A simple red book example without glut.

Ahhh thank you!
Indeed that made all the difference...
I thought I should be able trigger the rendering without a timer.
Was I wrong?
I think i'd been spoiled by glut.

Author:  Blake [ Thu Dec 10, 2009 4:46 pm ]
Post subject:  Re: A simple red book example without glut.

If you put the fire the render from open it may work, I'm not sure totally sure though. I usually use a thread to render things but a timer was easier for the situation ;)

Author:  Phil M [ Thu Dec 10, 2009 6:56 pm ]
Post subject:  Re: A simple red book example without glut.

How funny, I have the same book (3rd edition). :D

Page 1 of 1 All times are UTC - 5 hours
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/