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

Missing OpenGL Documentation http://forums.realsoftware.com/viewtopic.php?f=4&t=30687 
Page 1 of 1 
Author:  rdm [ Mon Oct 26, 2009 11:18 pm ] 
Post subject:  Missing OpenGL Documentation 
Can anyone point me to documentation of the version of OpenGL as implemented by REALbasic in the OpenGLSurface? I realize that this was a plugin created by TinRocket, I have been to their site but it has absolutely no helpful documentation. I already have the Red Book and several other OpenGL books but I am working in 3D and they all make heavy use of GLUT for the viewing and modelling transformations, which is not included with OpenGLSurface. To make matters worse, many OpenGLSurface methods do not accept arrays but MemoryBlocks and it is not documented how the MemoryBlocks are to be filled. I even started translating some GLUT routines to REALbasic but the MemoryBlock issue, and the big differences between REALbasic's unique multidimensional array structure and C's array structure are making it almost impossible without some documentation. 
Author:  Phil M [ Mon Oct 26, 2009 11:58 pm ] 
Post subject:  Re: Missing OpenGL Documentation 
MemoryBlock can be used any way you want... its essentially raw data that you can work with, or to communicate with other APIs such as OpenGL. Create a OpenGLArray class and add the methods and computed properties to make it behave like an Array in REALbasic, but the MemoryBlock is the real meat of the class. For example, if you need an array of Floats, you set the size of the MemoryBlock to be 4x the number of singles in the array. Then when you are ready to pass your "array" into OpenGL, you define the "array" as type Pointer, and your data when you call the declare is the actual MemoryBlock... then REALbasic knows it needs to pass the data by reference instead of value. 
Author:  rdm [ Tue Oct 27, 2009 12:34 am ] 
Post subject:  Re: Missing OpenGL Documentation 
Phil M wrote: MemoryBlock can be used any way you want... its essentially raw data that you can work with, or to communicate with other APIs such as OpenGL. I understand how to use MemoryBlocks to store floats, doubles, etc. The issue is what array values are loaded in what positions in the MemoryBlock. For instance, are the values loaded by increasing x subscripts first or increasing y subscripts? This can only be answered by having documentation on how the routines that use the MemoryBlock expect the values to be loaded. Many of the OpenGL routines have implicit cascade effects, for instance glMultMatrixf uses only one MemoryBlock as input, so it must implicitly have the second matrix stored somewhere to multiply by. The order of the matrix values in the MemoryBlock is crucial since matrix multiplication is not commutative. I need the documentation of exactly what the OpenGLSurface methods expect for their input and output values in order to proceed. 
Author:  Blake [ Wed Oct 28, 2009 1:56 pm ] 
Post subject:  Re: Missing OpenGL Documentation 
glMultMatrixf multiplies the current matrix, which is designated by the last call to glMatrixMode (Projection, ModelView or Texture), by the values that you submit. The matrix's are stored left to right, top to bottom in the memory block. Lets take a 3x3 matrix and fill it from an array( 8 )  Assuming array starts at 0. We are going to assume that you pass MyArray( 8 ) as a double array and it is your matrix loaded left to right, top to bottom. Dim memBlock As MemoryBlock 
Author:  x11joex11 [ Mon Nov 02, 2009 9:07 pm ] 
Post subject:  Re: Missing OpenGL Documentation 
try something like this, I was able to figure it out. dim lightColor0 as new MemoryBlock(24) lightColor0.singleValue(0)=0.5 lightColor0.singleValue(4)=0.5 lightColor0.singleValue(8)=0.5 lightColor0.singleValue(12)=1.0 I did this to make use of one of the opengl functions below. openGL.glLightfv(openGL.GL_LIGHT0, openGL.GL_DIFFUSE, lightColor0) the trick is having the memoryblock save it as singleValue's 
Author:  Phil M [ Wed Nov 04, 2009 1:45 pm ] 
Post subject:  Re: Missing OpenGL Documentation 
x11joex11 wrote: the trick is having the memoryblock save it as singleValue's Been a while since I did OpenGL, and my Red Book is packed away (just moved into new house)... but if I remember correctly, most OpenGL values expect a float (single). If you are doing a lot of Matrix functions, you might consider wrapping everything into a Matrix class, that would allow you to have a clear usage of the matrices and use the MemoryBlock as a storage device (and functions that accept an Matrix send the data as the MemoryBlock instead of your properties). For example, you could make the Matrix class behave more like a 2D array accessing the elements like myMatrix(1,1) to represent the center. 
Author:  Phil M [ Wed Nov 04, 2009 2:00 pm ] 
Post subject:  Re: Missing OpenGL Documentation 
x11joex11 wrote: try something like this, I was able to figure it out. dim lightColor0 as new MemoryBlock(24) lightColor0.singleValue(0)=0.5 lightColor0.singleValue(4)=0.5 lightColor0.singleValue(8)=0.5 lightColor0.singleValue(12)=1.0 For this example, I would probably make the data as an array... Dim lightColor0( ) As Single = Array( 0.5, 0.5, 0.5, 1.0 ) And then use a function to convert the array into a MemoryBlock Function RBGLFloatArray( values( ) As Single ) As MemoryBlock So your total code for your example would be something like: Dim lightColor0( ) As Single = Array( 0.5, 0.5, 0.5, 1.0 ) or skip the creation of the lightColor0 variable entirely and just use: openGL.glLightfv( openGL.GL_LIGHT0, openGL.GL_DIFFUSE, RBGLFloatArray( Array( 0.5, 0.5, 0.5, 1.0 ))) 
Author:  Blake [ Fri Nov 06, 2009 6:16 pm ] 
Post subject:  Re: Missing OpenGL Documentation 
Phil M wrote: Been a while since I did OpenGL, and my Red Book is packed away (just moved into new house)... but if I remember correctly, most OpenGL values expect a float (single). Actually the type of the variable passed is determined by the last letter in the gl* function Example: glVertex2i( X, Y )  Expects Integers glVertex2f( X, Y )  Expects Floats (Singles) glVertex2d( X, Y )  Expects Doubles hope that helps 
Author:  steeley [ Sun Nov 15, 2009 6:39 pm ] 
Post subject:  Re: Missing OpenGL Documentation 
To go back to the title of this topic Where is it Realsoftware????? 
Author:  Blake [ Sun Nov 15, 2009 7:17 pm ] 
Post subject:  Re: Missing OpenGL Documentation 
There is no documentation for the OpenGLSurface, its just a gateway to OpenGL. 
Author:  rdm [ Sun Nov 15, 2009 7:48 pm ] 
Post subject:  Re: Missing OpenGL Documentation 
The OpenGLSurface is not an exact mapping of OpenGL, so it fails as a simple gateway. There are many routines in OpenGLSurface that use MemoryBlocks for their interface. While this sounds innocuous, it makes it very difficult to follow the Red Book code because, correct me if I am wrong, there is no direct mapping of a MemoryBlock to a REALbasic vector, and definitely not to a REALbasic multidimensional array. The Red Book, and the GLUT libraries, often use vectors to store multidimensional arrays. This is possible, as you all probably know, because C stores arrays in continguous memory. So there are routines in OpenGL that return vectors which are then sent to routines needing an array, not something that can be done with OpenGLSurface without translation code. REALbasic does not store multidimensional arrays contiguously, so attempts to map directly between the Red Book or GLUT routines and OpenGLSurface fail. What is needed is either a better OpenGL implementation in REALbasic, or, at the very least, documentation about which OpenGLSurface methods use MemoryBlocks and how the MemoryBlocks are to be packed for proper operation in OpenGLSurface. Unfortunately, I need to have my applications work on both Mac and PC, without needing external libraries, so I must use OpenGLSurface. The only example provided by REAL Software is a twodimensional fluid dynamics simulation which is useless for understanding the 3D viewing transforms of OpenGLSurface. So until REAL Software finishes the job or someone (e.g. TinRocket) steps up with the missing documentation, it is extremely frustrating to use OpenGLSurface for anything. So once again I ask, does anyone have the missing documentation? FYI, my application is 3D data plotting, not gaming. This is the only 3D forum provided by REAL Software, so I apologize if my posts appear to be offtopic. 
Author:  steeley [ Mon Nov 16, 2009 8:09 am ] 
Post subject:  Re: Missing OpenGL Documentation 
Well said. It does need some RB specific info. as to what exactly it supports and the various things you will encounter when trying to use it. As RS have depricated both the spriteSurface and the original RB3D, this means a lot of work for folks who have used these things and now have to go to OpenGlSurface. 
Author:  baquiano [ Tue Feb 09, 2010 10:14 pm ] 
Post subject:  Re: Missing OpenGL Documentation 
I'm looking for a replacement for gluLookAt() 
Page 1 of 1  All times are UTC  5 hours 
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group http://www.phpbb.com/ 