Thread: glut usage

  1. #1
    Registered User awsdert's Avatar
    Join Date
    Jan 2015
    Posts
    1,733

    glut usage

    I can get a window open but I'm struggling to get it to move according to keypress, I know part of that issue is down to a previously mentioned issue in my last thread so I won't ask for help on that here but when I close the window glut decides to panic for some reason, this is how I've been using it so far (excuse the lua code, I've been mapping the calls and defines to behave as close to the way the C API behaves so just apply that knowledge here):
    Code:
    print("Calling " .. glut.api .. ".init()...")
    glut.init()
    print("Calling " .. glut.api .. ".initDisplayMode(DEPTH|RGBA|DOUBLE)...")
    glut.initDisplayMode(glut.DEPTH|glut.RGBA|glut.DOUBLE)
    print("Calling " .. glut.api .. ".initWindowPosition(150,150)...")
    glut.initWindowPosition( 150, 150 )
    print("Calling " .. glut.api .. ".initWindowSize(480,640)...")
    glut.initWindowSize( 480, 640 )
    print("Calling " .. glut.api .. ".createWindow()...")
    main_window = glut.createWindow("Final Fantasy XV Cheat App Window")
    print("Calling " .. glut.api .. ".displayFunc()...")
    glut.displayFunc(
    	function()
    		gl.clear(gl.COLOR_BUFFER_BIT|gl.DEPTH_BUFFER_BIT)
    		glut.swapBuffers()
    	end
    )
    glut.keyboardFunc(
    	function(key,x,y)
    		print( "key = ".. key .. ", x = " .. x .. "y == " .. y ) -- Not currently reached
    		local wx = glut.get(glut.WINDOW_X)
    		local wy = glut.get(glut.WINDOW_Y)
    		if key == 27 then
    			glut.destroyWindow(main_window)
    		elseif key == glut.KEY_UP then
    			glut.positionWindow(wx,wy-1)
    		elseif key == glut.KEY_DOWN then
    			glut.positionWindow(wx,wy-1)
    		elseif key == glut.KEY_LEFT then
    			glut.positionWindow(wx-1,wy)
    		elseif key == glut.KEY_RIGHT then
    			glut.positionWindow(wx+1,wy)
    		end
    		glut.postRedisplay()
    	end
    )
    print("Calling " .. glut.api .. ".mainLoop()...")
    glut.mainLoop()
    Edit: Specific error message thrown is:
    Error: foo_atexit() 0x0000000B Resource temporarily unavailable
    Last edited by awsdert; 01-02-2020 at 12:20 PM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Glut
    By Matty_Alan in forum C Programming
    Replies: 7
    Last Post: 07-16-2007, 07:01 AM
  2. using bmp's with glut
    By dorkes_malorkes in forum Game Programming
    Replies: 6
    Last Post: 06-18-2007, 10:31 AM
  3. GLUT and Dev-CPP
    By Canadian_coder in forum Game Programming
    Replies: 4
    Last Post: 12-22-2004, 03:12 AM
  4. using GLUT and MS VC++
    By revelation437 in forum C++ Programming
    Replies: 0
    Last Post: 04-01-2003, 04:16 PM
  5. GLUT or wgl which one
    By SAMSAM in forum Game Programming
    Replies: 43
    Last Post: 02-20-2003, 03:43 PM

Tags for this Thread