Page 2 of 2

Posted: Tue Feb 03, 2004 6:59 pm
by DarkDragon
It is just black (I have nVidia GeForce 2).

Posted: Tue Feb 03, 2004 7:00 pm
by Polo
I got a geforce2 mx400 and it works ... Well, pleae wait, I do some testing, and I reput a file :)

Posted: Tue Feb 03, 2004 7:06 pm
by traumatic
Well, can you try the camera with th pc where it works, and tell me what I'm doing wrong ?
No, as I don't exactly know what you're trying to achieve. Sorry if I missed something.

Posted: Tue Feb 03, 2004 8:18 pm
by Polo
I'm trying to do a CAMERA.
A camera who WORKS like this stuff in c++ (in fact, I just translated it into pure...)
http://www.ultimategameprogramming.com/ ... amera2.ZIP


here is the stuff without the glu camera, tell me if it works on computers where the first exe don't :)
http://www.gtnsoft.com/Pure3Dwtglu.exe

Posted: Tue Feb 03, 2004 8:48 pm
by traumatic
Polo wrote:I'm trying to do a CAMERA.
A camera who WORKS like this stuff in c++ (in fact, I just translated it into pure...)
http://www.ultimategameprogramming.com/ ... amera2.ZIP
The movement i can see in the c-example is almost identical to the one in 'your' pb-app.

However: You SHOUT, I stop answering...

Posted: Wed Feb 04, 2004 7:46 am
by DarkDragon
Look at this topic: viewtopic.php?t=9276
I wanted to make a camera, too. I'm triing to use gluLookAt instead of glOrtho since this topic, but I can't rotate the camera!?! :?
here is the stuff without the glu camera, tell me if it works on computers where the first exe don't
http://www.gtnsoft.com/Pure3Dwtglu.exe
black!

[EDIT]
Here is my code and it works with gluPerspective(on my pc):

Code: Select all

#GL_COLOR_BUFFER_BIT = $00004000
#GL_DEPTH_BUFFER_BIT = $00000100
#GL_TRIANGLES = $0004
#GL_FOG = $0B60
#GL_MODELVIEW                      = $1700
#GL_PROJECTION                     = $1701



#WindowWidth = 500
#WindowHeight = 400
#WindowFlags = #PB_Window_TitleBar | #PB_Window_MaximizeGadget | #PB_Window_SystemMenu | #PB_Window_MinimizeGadget | #PB_Window_ScreenCentered

Global floatX.f
Global floatY.f
Global floatZ.f

Global CameraX.f, CameraY.f, CameraZ.f, CamrotX.f, CamrotY.f, CamrotZ.f, CameraSpeed.f, CameraZoom.f, hDC

CamSpeed.f = 0.025
CameraZoom = 0.5

CamrotY = 50

hWnd = OpenWindow(0, 0, 0, #WindowWidth, #WindowHeight, #WindowFlags, "OpenGLCamera")

If hWnd <> 0

  piover180.f = (ATan(1)*4)/180
  
  pfd.PIXELFORMATDESCRIPTOR   ;OpenGL starten
  hDC = GetDC_(hWnd)
  pfd\nSize        = SizeOf(PIXELFORMATDESCRIPTOR)
  pfd\nVersion     = 1
  pfd\dwFlags      = #PFD_SUPPORT_OPENGL | #PFD_DOUBLEBUFFER | #PFD_DRAW_TO_WINDOW
  pfd\iLayerType   = #PFD_MAIN_PLANE
  pfd\iPixelType   = #PFD_TYPE_RGBA
  pfd\cColorBits   = 24
  pfd\cDepthBits   = 32
  
  pixformat = ChoosePixelFormat_(hDC, pfd)
  SetPixelFormat_(hDC, pixformat, pfd)
  hrc = wglCreateContext_(hDC)
  wglMakeCurrent_(hDC, hrc)
  
  pixformat = ChoosePixelFormat_(hDC, pfd)
  SetPixelFormat_(hDC, pixformat, pfd)
  hrc = wglCreateContext_(hDC)
  wglMakeCurrent_(hDC,hrc)
  
  SwapBuffers_(hDC)

  floatX = 0.5
  floatY = 0.25
  floatZ = -0.5
  
  glu = gluNewQuadric_()
  
Repeat
  glTranslatef_(0, 0, -7.0)
  If GetAsyncKeyState_(#VK_UP) <> 0
    CameraZ = CameraZ - Sin((CamrotY-90)*piover180)*CamSpeed
    CameraX = CameraX - Cos((CamrotY+90)*piover180)*CamSpeed
  ElseIf GetAsyncKeyState_(#VK_DOWN) <> 0
    CameraZ = CameraZ + Sin((CamrotY-90)*piover180)*CamSpeed
    CameraX = CameraX + Cos((CamrotY+90)*piover180)*CamSpeed
  EndIf
  If GetAsyncKeyState_(#VK_RIGHT) <> 0
    CamrotY - (CamSpeed*5)
  ElseIf GetAsyncKeyState_(#VK_LEFT) <> 0
    CamrotY + (CamSpeed*5)
  EndIf
  glMatrixMode_(#GL_PROJECTION) ;Höhere Sichtweite, Kamera und Zoom
  glLoadIdentity_()
  gluPerspective__(45, WindowWidth()/WindowHeight(), 0.0, 20.0)
  gluLookAt__(CameraX, CameraY, CameraZ, CameraX - Cos((CamrotY+90)*piover180)*5, 0.0, -CameraZ - Sin((CamrotY-90)*piover180)*5, 0.0, 1.0, 0.0)
;   glOrtho__(-2.0+CameraZoom, 2.0-CameraZoom, -2.0+CameraZoom, 2.0-CameraZoom, 0.0, 20.0)
;   glRotatef_(-CamrotY, 0.0, 1.0, 0.0)
;   glTranslatef_(0, 0, -10.0)
  glMatrixMode_(#GL_MODELVIEW)
  
  glClear_(#GL_COLOR_BUFFER_BIT | #GL_DEPTH_BUFFER_BIT)
  glLoadIdentity_()
  glRotatef_(45.0, 0, 1.0, 0.0)
  glTranslatef_(-CameraX, -CameraY, -CameraZ)
  glBegin_(#GL_TRIANGLES)
    glNormal3f_(0, 0, 1.0)
    glColor4f_(0.0, 0.0, 1.0, 1.0)
    glVertex3f_(floatX, floatY, floatZ)
    glColor4f_(0.0, 1.0, 0.0, 1.0)
    glVertex3f_(-floatX, floatY, floatZ)
    glColor4f_(1.0, 1.0, 0.0, 1.0)
    glVertex3f_(-floatX, -floatY, floatZ)
  glEnd_()
  glBegin_(#GL_TRIANGLES)
    glNormal3f_(0, 0, 1.0)
    glColor4f_(0.0, 0.0, 1.0, 1.0)
    glVertex3f_(floatX, floatY, floatZ+0.25)
    glColor4f_(0.0, 1.0, 0.0, 1.0)
    glVertex3f_(-floatX, floatY, floatZ+0.25)
    glColor4f_(1.0, 1.0, 0.0, 1.0)
    glVertex3f_(-floatX, -floatY, floatZ+0.25)
  glEnd_()
  
  SwapBuffers_(hDC)
  Event = WindowEvent()
  Delay(1) ;For WinME users
Until Event = #PB_Event_CloseWindow
End
EndIf
I'm happy ^^

Posted: Wed Feb 04, 2004 12:56 pm
by Polo
If the second exe is black, then you have a big problem of opengl rendering, since a I only used the Gl fonction and none of the glu's one...
Funny, I tried your code, Dark dragon, and... black :D OpenGL on Pure is pretty boring :)

Posted: Wed Feb 04, 2004 1:00 pm
by Polo
Well, no it's not black, but it doesn't work anyway... We'll, it works like in my example...

gluPerspective__ , gluLookAt__ problems

Posted: Thu Feb 26, 2004 3:46 pm
by sblank
I have been trying to run the code listed on this page using PureBasic and keep getting an error of this nature:

gluPerspective__() is not a function, an array, or a linked list.

I get a similar error with gluLookAt__ if I remark out the gluPerspective__ statement.

If I reduce the number of underscores to one after the command, PureBasic seems to recognize the function, but tells me that I have an incorrect number of parameters. I am new to PureBasic from C programming using OpenGL/GLUT, but based on the C gluPerspective statement, the number of parameters appears to be correct.

Am I missing an include file that provides glu/glut functionality?

Thanks,

Stan

Re: gluPerspective__ , gluLookAt__ problems

Posted: Thu Feb 26, 2004 4:48 pm
by traumatic
sblank wrote: Am I missing an include file that provides glu/glut functionality?
viewtopic.php?t=9116

Posted: Thu Feb 26, 2004 4:50 pm
by dmoc
Probably requires doubles as parameters. Search the forums for previous solution.

glWrapper fixed glu commands...

Posted: Thu Feb 26, 2004 5:48 pm
by sblank
Thanks... worked like a charm!

This language definitely has potential...

Stan