Skip to content

Commit

Permalink
Working ofc
Browse files Browse the repository at this point in the history
  • Loading branch information
dimkauzh committed Aug 19, 2024
1 parent 4b9a635 commit 4ddc4c3
Show file tree
Hide file tree
Showing 8 changed files with 60 additions and 10 deletions.
8 changes: 3 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
<h1 align="center">
<p align="center">
<img width="1400" alt="banner" src="logo/banner1.png">

<p align="center">
<img width="1400" alt="banner" src="/logo/banner1.png">
<a href="https://github.com/vuelto-org/vuelto"><img alt="GitHub last commit" src="https://img.shields.io/github/last-commit/vuelto-org/vuelto"></a>
<a href="https://github.com/vuelto-org/vuelto"><img alt="GitHub license" src="https://img.shields.io/github/license/vuelto-org/vuelto"></a>
<a href="https://github.com/vuelto-org/license"><img alt="License" src="https://img.shields.io/badge/license-VLv1-blue"></a>
<a href="https://github.com/vuelto-org/vuelto"><img alt="CI Check" src="https://github.com/vuelto-org/vuelto/actions/workflows/ci_check.yml/badge.svg"></a>
<a href="https://github.com/vuelto-org/vuelto"><img alt="Lines of code" src="https://www.aschey.tech/tokei/github/vuelto-org/vuelto"></a>
<a href="https://goreportcard.com/report/github.com/vuelto-org/vuelto"><img alt="Report card" src="https://goreportcard.com/badge/github.com/vuelto-org/vuelto"></a>
<a href="https://www.opengl.org/Documentation/Specs.html"><img alt="Powered By" src="https://img.shields.io/badge/powered_by-GL_3.3-blue"></a>
</p>

</h1>

Hey there! Welcome to Vuelto's repo! Vuelto is a fast and lightweight Go game engine which uses CGo and OpenGL to display your graphics. It is really easy to start with, but it can be really powerful to work with. It's cross-platform, meaning that every game you make with Vuelto will work on Windows, Linux, Mac and Web (Coming soon). It's also open-source, meaning that you can see the source code and contribute to the engine. Have fun!
Expand Down
14 changes: 14 additions & 0 deletions internal/gl/opengl.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ type Buffer struct {
Vertices []float32
}

type Location struct {
UniformLocation int32
}

var VERTEX_SHADER = &VertexShader{}
var FRAGMENT_SHADER = &FragmentShader{}

Expand Down Expand Up @@ -56,6 +60,12 @@ func (p *Program) Link() {}

func (p *Program) Use() {}

func (p *Program) UniformLocation(location string) *Location {
return &Location{}
}

func (l *Location) Set(arg ...float32) {}

func GenBuffers(vertices []float32) *Buffer {
return &Buffer{
Vertices: vertices,
Expand All @@ -67,3 +77,7 @@ func (b *Buffer) BindVA() {}
func (b *Buffer) BindVBO() {}

func (b *Buffer) Data() {}

func InitVertexAttrib() {}

func DrawElements() {}
11 changes: 10 additions & 1 deletion internal/gl/opengl/modern.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ var (
ONE_MINUS_SRC_ALPHA uint32 = uint32(C.GL_ONE_MINUS_SRC_ALPHA)
BLEND uint32 = uint32(C.GL_BLEND)
DEPTH_BUFFER_BIT uint32 = uint32(C.GL_DEPTH_BUFFER_BIT)
COLOR_BUFFER_BIT uint32 = uint32(C.GL_COLOR_BUFFER_BIT)
)

func CreateShader(shaderType uint32) uint32 {
Expand Down Expand Up @@ -118,3 +117,13 @@ func Enable(cap uint32) {
func DrawArrays(mode uint32, first, count int32) {
C.glDrawArrays(C.uint(mode), C.int(first), C.int(count))
}

func GetUniformLocation(program uint32, name string) int32 {
cname := C.CString(name)
defer C.free(unsafe.Pointer(cname))
return int32(C.glGetUniformLocation(C.uint(program), cname))
}

func Uniform4f(location int32, v0, v1, v2, v3 float32) {
C.glUniform4f(C.int(location), C.float(v0), C.float(v1), C.float(v2), C.float(v3))
}
21 changes: 21 additions & 0 deletions internal/gl/webgl/binding.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,29 @@ var (
FRAGMENT_SHADER = gl.Get("FRAGMENT_SHADER")

ARRAY_BUFFER = gl.Get("ARRAY_BUFFER")
STATIC_DRAW = gl.Get("STATIC_DRAW")
TRIANGLES = gl.Get("TRIANGLES")

FLOAT = gl.Get("FLOAT")
FALSE = gl.Get("FALSE")
TRUE = gl.Get("TRUE")

COLOR_BUFFER_BIT = gl.Get("COLOR_BUFFER_BIT")

TEXTURE_2D = gl.Get("TEXTURE_2D")
TEXTURE_WRAP_S = gl.Get("TEXTURE_WRAP_S")
TEXTURE_WRAP_T = gl.Get("TEXTURE_WRAP_T")
TEXTURE_MIN_FILTER = gl.Get("TEXTURE_MIN_FILTER")
TEXTURE_MAG_FILTER = gl.Get("TEXTURE_MAG_FILTER")
CLAMP_TO_EDGE = gl.Get("CLAMP_TO_EDGE")

LINEAR = gl.Get("LINEAR")
RGBA = gl.Get("RGBA")
UNSIGNED_BYTE = gl.Get("UNSIGNED_BYTE")
SRC_ALPHA = gl.Get("SRC_ALPHA")
ONE_MINUS_SRC_ALPHA = gl.Get("ONE_MINUS_SRC_ALPHA")
BLEND = gl.Get("BLEND")
DEPTH_BUFFER_BIT = gl.Get("DEPTH_BUFFER_BIT")
)

func CreateShader(inputType js.Value) js.Value {
Expand Down
2 changes: 2 additions & 0 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ nav:
- 🛣️ V1: "roadmap/v1.md"
- 🛣️ V2: "roadmap/v2.md"

- Discord: "discord.html"

theme:
name: material

Expand Down
3 changes: 2 additions & 1 deletion test/backend/test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ func main() {
log.Fatalf("Failed to initialise: %s", err)
}

defer win.Close()

win.Resizable = true
win.Title = "Test"

Expand All @@ -26,5 +28,4 @@ func main() {
win.HandleEvents()
win.UpdateBuffers()
}
win.Close()
}
8 changes: 8 additions & 0 deletions website/discord.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<!DOCTYPE html>
<html lang="en">
<head>
<script>
window.location.href = "https://discord.gg/gZqdRXbbqg";
</script>
</head>
</html>
3 changes: 0 additions & 3 deletions website/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,13 @@ hide:
<h1 align="center">
<p align="center">
<img width="1400" alt="banner" src="/logo/banner1.png">

<p align="center">
<a href="https://github.com/vuelto-org/vuelto"><img alt="GitHub last commit" src="https://img.shields.io/github/last-commit/vuelto-org/vuelto"></a>
<a href="https://github.com/vuelto-org/license"><img alt="License" src="https://img.shields.io/badge/license-VLv1-blue"></a>
<a href="https://github.com/vuelto-org/vuelto"><img alt="CI Check" src="https://github.com/vuelto-org/vuelto/actions/workflows/ci_check.yml/badge.svg"></a>
<a href="https://github.com/vuelto-org/vuelto"><img alt="Lines of code" src="https://www.aschey.tech/tokei/github/vuelto-org/vuelto"></a>
<a href="https://goreportcard.com/report/github.com/vuelto-org/vuelto"><img alt="Report card" src="https://goreportcard.com/badge/github.com/vuelto-org/vuelto"></a>
<a href="https://www.opengl.org/Documentation/Specs.html"><img alt="Powered By" src="https://img.shields.io/badge/powered_by-GL_3.3-blue"></a>
</p>

</h1>

Welcome to the Vuelto website! Here you will find things like documentation, blogs, tutorials and everything about Vuelto!
Expand Down

0 comments on commit 4ddc4c3

Please sign in to comment.