datatypes, I give up.
Posted: Thu Mar 11, 2010 3:23 pm
I have the following openGL code translated from C#. To run it you need to reference OpenTK.dll which you can get from http://www.opentk.com. I seem to be spinning my wheels at GL.rotate, no matter what I do cobra says I'm not passing the right data type, I even think that at one point I managed to do what cobra asked and it started asking for a different datatype. Here is the error from the following code.
C:\Cobra\HowTo>cobra -library-directory:C:\opentk\bin -reference:OpenTK.dll TK.c
obra
TK.cobra(1): warning: The using directive for "System" appeared previously in th
is namespace
TK.cobra(44): error: The best overloaded method match for "OpenTK.Graphics.OpenG
L.GL.Rotate(float, OpenTK.Vector3)" has some invalid arguments
TK.cobra(44): error: Argument "1": cannot convert from "double" to "float"
TK.cobra(47): error: The best overloaded method match for "OpenTK.Graphics.OpenG
L.GL.Vertex2(double, double)" has some invalid arguments
TK.cobra(47): error: Argument "1": cannot convert from "decimal" to "double"
TK.cobra(47): error: Argument "2": cannot convert from "decimal" to "double"
TK.cobra(48): error: The best overloaded method match for "OpenTK.Graphics.OpenG
L.GL.Vertex2(double, double)" has some invalid arguments
TK.cobra(48): error: Argument "1": cannot convert from "decimal" to "double"
TK.cobra(48): error: Argument "2": cannot convert from "decimal" to "double"
TK.cobra(49): error: The best overloaded method match for "OpenTK.Graphics.OpenG
L.GL.Vertex2(double, double)" has some invalid arguments
TK.cobra(49): error: Argument "1": cannot convert from "decimal" to "double"
TK.cobra(49): error: Argument "2": cannot convert from "decimal" to "double"
TK.cobra(50): error: The best overloaded method match for "OpenTK.Graphics.OpenG
L.GL.Vertex2(double, double)" has some invalid arguments
TK.cobra(50): error: Argument "1": cannot convert from "decimal" to "double"
TK.cobra(50): error: Argument "2": cannot convert from "decimal" to "double"
Compilation failed - 14 errors, 1 warning
Not running due to errors above.
C:\Cobra\HowTo>cobra -library-directory:C:\opentk\bin -reference:OpenTK.dll TK.c
obra
TK.cobra(1): warning: The using directive for "System" appeared previously in th
is namespace
TK.cobra(44): error: The best overloaded method match for "OpenTK.Graphics.OpenG
L.GL.Rotate(float, OpenTK.Vector3)" has some invalid arguments
TK.cobra(44): error: Argument "1": cannot convert from "double" to "float"
TK.cobra(47): error: The best overloaded method match for "OpenTK.Graphics.OpenG
L.GL.Vertex2(double, double)" has some invalid arguments
TK.cobra(47): error: Argument "1": cannot convert from "decimal" to "double"
TK.cobra(47): error: Argument "2": cannot convert from "decimal" to "double"
TK.cobra(48): error: The best overloaded method match for "OpenTK.Graphics.OpenG
L.GL.Vertex2(double, double)" has some invalid arguments
TK.cobra(48): error: Argument "1": cannot convert from "decimal" to "double"
TK.cobra(48): error: Argument "2": cannot convert from "decimal" to "double"
TK.cobra(49): error: The best overloaded method match for "OpenTK.Graphics.OpenG
L.GL.Vertex2(double, double)" has some invalid arguments
TK.cobra(49): error: Argument "1": cannot convert from "decimal" to "double"
TK.cobra(49): error: Argument "2": cannot convert from "decimal" to "double"
TK.cobra(50): error: The best overloaded method match for "OpenTK.Graphics.OpenG
L.GL.Vertex2(double, double)" has some invalid arguments
TK.cobra(50): error: Argument "1": cannot convert from "decimal" to "double"
TK.cobra(50): error: Argument "2": cannot convert from "decimal" to "double"
Compilation failed - 14 errors, 1 warning
Not running due to errors above.
- Code: Select all
use System
use OpenTK
use OpenTK.Graphics.OpenGL
use OpenTK.Graphics
class Test
def main is shared
window = TestWindow()
window.run
class TestWindow
inherits GameWindow
var _rotation as float
cue init
base.init(800, 800, GraphicsMode(ColorFormat(32)), "Test")
def onLoad(e as EventArgs) is protected, override
GL.shadeModel(ShadingModel.Smooth)
GL.clearColor(0, 0, 0, 1)
GL.clearDepth(1)
GL.enable(EnableCap.DepthTest)
GL.depthFunc(DepthFunction.Lequal)
GL.hint(HintTarget.PerspectiveCorrectionHint, HintMode.Nicest)
GL.viewport(0, 0, 800, 800)
GL.matrixMode(MatrixMode.Projection)
GL.loadIdentity
GL.ortho(0, 10, 10, 0, -10, 10)
GL.matrixMode(MatrixMode.Modelview)
GL.loadIdentity
def onUpdateFrame(e as FrameEventArgs) is protected, override
_rotation += 50*e.time
def onRenderFrame(e as FrameEventArgs) is protected, override
GL.clear(ClearBufferMask.ColorBufferBit)
GL.clear(ClearBufferMask.DepthBufferBit)
GL.matrixMode(MatrixMode.Modelview)
GL.loadIdentity
GL.translate(Vector3(5, 5, 0))
GL.rotate(_rotation, Vector3(0, 1, 1))
GL.begin(BeginMode.Quads)
GL.color3(Vector3(0, 0, 1))
GL.vertex2(-2.5, -2.5)
GL.vertex2(-2.5, 2.5)
GL.vertex2(2.5, 2.5)
GL.vertex2(2.5, -2.5)
GL.end
.context.swapBuffers