OpenGLGraphicsInterface.lua 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165
  1. class "OpenGLGraphicsInterface"
  2. function OpenGLGraphicsInterface:__getvar(name)
  3. if name == "lineSmooth" then
  4. return Polycode.OpenGLGraphicsInterface_get_lineSmooth(self.__ptr)
  5. end
  6. end
  7. function OpenGLGraphicsInterface:__setvar(name,value)
  8. if name == "lineSmooth" then
  9. Polycode.OpenGLGraphicsInterface_set_lineSmooth(self.__ptr, value)
  10. return true
  11. end
  12. return false
  13. end
  14. function OpenGLGraphicsInterface:OpenGLGraphicsInterface(...)
  15. local arg = {...}
  16. for k,v in pairs(arg) do
  17. if type(v) == "table" then
  18. if v.__ptr ~= nil then
  19. arg[k] = v.__ptr
  20. end
  21. end
  22. end
  23. if self.__ptr == nil and arg[1] ~= "__skip_ptr__" then
  24. self.__ptr = Polycode.OpenGLGraphicsInterface(unpack(arg))
  25. end
  26. end
  27. function OpenGLGraphicsInterface:createTexture(texture)
  28. local retVal = Polycode.OpenGLGraphicsInterface_createTexture(self.__ptr, texture.__ptr)
  29. end
  30. function OpenGLGraphicsInterface:destroyTexture(texture)
  31. local retVal = Polycode.OpenGLGraphicsInterface_destroyTexture(self.__ptr, texture.__ptr)
  32. end
  33. function OpenGLGraphicsInterface:setViewport(x, y, width, height)
  34. local retVal = Polycode.OpenGLGraphicsInterface_setViewport(self.__ptr, x, y, width, height)
  35. end
  36. function OpenGLGraphicsInterface:clearBuffers(clearColor, colorBuffer, depthBuffer, stencilBuffer)
  37. local retVal = Polycode.OpenGLGraphicsInterface_clearBuffers(self.__ptr, clearColor.__ptr, colorBuffer, depthBuffer, stencilBuffer)
  38. end
  39. function OpenGLGraphicsInterface:setParamInShader(shader, param, localParam)
  40. local retVal = Polycode.OpenGLGraphicsInterface_setParamInShader(self.__ptr, shader.__ptr, param.__ptr, localParam.__ptr)
  41. end
  42. function OpenGLGraphicsInterface:setAttributeInShader(shader, attribute, attributeBinding)
  43. local retVal = Polycode.OpenGLGraphicsInterface_setAttributeInShader(self.__ptr, shader.__ptr, attribute.__ptr, attributeBinding.__ptr)
  44. end
  45. function OpenGLGraphicsInterface:disableAttribute(shader, attribute)
  46. local retVal = Polycode.OpenGLGraphicsInterface_disableAttribute(self.__ptr, shader.__ptr, attribute.__ptr)
  47. end
  48. function OpenGLGraphicsInterface:useShader(shader)
  49. local retVal = Polycode.OpenGLGraphicsInterface_useShader(self.__ptr, shader.__ptr)
  50. end
  51. function OpenGLGraphicsInterface:createProgram(program)
  52. local retVal = Polycode.OpenGLGraphicsInterface_createProgram(self.__ptr, program.__ptr)
  53. end
  54. function OpenGLGraphicsInterface:destroyProgram(program)
  55. local retVal = Polycode.OpenGLGraphicsInterface_destroyProgram(self.__ptr, program.__ptr)
  56. end
  57. function OpenGLGraphicsInterface:createVBOForVertexArray(array)
  58. local retVal = Polycode.OpenGLGraphicsInterface_createVBOForVertexArray(self.__ptr, array.__ptr)
  59. end
  60. function OpenGLGraphicsInterface:createMesh(mesh)
  61. local retVal = Polycode.OpenGLGraphicsInterface_createMesh(self.__ptr, mesh.__ptr)
  62. end
  63. function OpenGLGraphicsInterface:destroyMesh(mesh)
  64. local retVal = Polycode.OpenGLGraphicsInterface_destroyMesh(self.__ptr, mesh.__ptr)
  65. end
  66. function OpenGLGraphicsInterface:createShader(shader)
  67. local retVal = Polycode.OpenGLGraphicsInterface_createShader(self.__ptr, shader.__ptr)
  68. end
  69. function OpenGLGraphicsInterface:destroyShader(shader)
  70. local retVal = Polycode.OpenGLGraphicsInterface_destroyShader(self.__ptr, shader.__ptr)
  71. end
  72. function OpenGLGraphicsInterface:beginDrawCall()
  73. local retVal = Polycode.OpenGLGraphicsInterface_beginDrawCall(self.__ptr)
  74. end
  75. function OpenGLGraphicsInterface:endDrawCall()
  76. local retVal = Polycode.OpenGLGraphicsInterface_endDrawCall(self.__ptr)
  77. end
  78. function OpenGLGraphicsInterface:setBlendingMode(blendingMode)
  79. local retVal = Polycode.OpenGLGraphicsInterface_setBlendingMode(self.__ptr, blendingMode)
  80. end
  81. function OpenGLGraphicsInterface:createRenderBuffer(renderBuffer)
  82. local retVal = Polycode.OpenGLGraphicsInterface_createRenderBuffer(self.__ptr, renderBuffer.__ptr)
  83. end
  84. function OpenGLGraphicsInterface:destroyRenderBuffer(renderBuffer)
  85. local retVal = Polycode.OpenGLGraphicsInterface_destroyRenderBuffer(self.__ptr, renderBuffer.__ptr)
  86. end
  87. function OpenGLGraphicsInterface:bindRenderBuffer(renderBuffer)
  88. local retVal = Polycode.OpenGLGraphicsInterface_bindRenderBuffer(self.__ptr, renderBuffer.__ptr)
  89. end
  90. function OpenGLGraphicsInterface:createVertexBuffer(dataArray)
  91. local retVal = Polycode.OpenGLGraphicsInterface_createVertexBuffer(self.__ptr, dataArray.__ptr)
  92. end
  93. function OpenGLGraphicsInterface:createIndexBuffer(dataArray)
  94. local retVal = Polycode.OpenGLGraphicsInterface_createIndexBuffer(self.__ptr, dataArray.__ptr)
  95. end
  96. function OpenGLGraphicsInterface:destroyBuffer(array)
  97. local retVal = Polycode.OpenGLGraphicsInterface_destroyBuffer(self.__ptr, array.__ptr)
  98. end
  99. function OpenGLGraphicsInterface:drawIndices(type, indexArray)
  100. local retVal = Polycode.OpenGLGraphicsInterface_drawIndices(self.__ptr, type, indexArray.__ptr)
  101. end
  102. function OpenGLGraphicsInterface:drawArrays(type, vertexCount)
  103. local retVal = Polycode.OpenGLGraphicsInterface_drawArrays(self.__ptr, type, vertexCount)
  104. end
  105. function OpenGLGraphicsInterface:enableDepthTest(val)
  106. local retVal = Polycode.OpenGLGraphicsInterface_enableDepthTest(self.__ptr, val)
  107. end
  108. function OpenGLGraphicsInterface:enableDepthWrite(val)
  109. local retVal = Polycode.OpenGLGraphicsInterface_enableDepthWrite(self.__ptr, val)
  110. end
  111. function OpenGLGraphicsInterface:enableBackfaceCulling(val)
  112. local retVal = Polycode.OpenGLGraphicsInterface_enableBackfaceCulling(self.__ptr, val)
  113. end
  114. function OpenGLGraphicsInterface:setLineSize(lineSize)
  115. local retVal = Polycode.OpenGLGraphicsInterface_setLineSize(self.__ptr, lineSize)
  116. end
  117. function OpenGLGraphicsInterface:setWireframeMode(val)
  118. local retVal = Polycode.OpenGLGraphicsInterface_setWireframeMode(self.__ptr, val)
  119. end
  120. function OpenGLGraphicsInterface:enableScissor(val)
  121. local retVal = Polycode.OpenGLGraphicsInterface_enableScissor(self.__ptr, val)
  122. end
  123. function OpenGLGraphicsInterface:setScissorBox(box)
  124. local retVal = Polycode.OpenGLGraphicsInterface_setScissorBox(self.__ptr, box.__ptr)
  125. end
  126. function OpenGLGraphicsInterface:__delete()
  127. if self then Polycode.delete_OpenGLGraphicsInterface(self.__ptr) end
  128. end