Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
L
lcc-shape
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
wangmingming
lcc-shape
Commits
a0be74b1
Commit
a0be74b1
authored
Aug 18, 2023
by
wang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
rtc ip 部分获取成功
parent
18336428
Changes
3
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
62 additions
and
4876 deletions
+62
-4876
get_pixels.js
env/get_pixels.js
+45
-0
index.html
index.html
+15
-15
src_out.js
src_out.js
+2
-4861
No files found.
env/get_pixels.js
0 → 100644
View file @
a0be74b1
let
canvas
=
document
.
createElement
(
"canvas"
);
canvas
.
width
=
150
;
canvas
.
height
=
150
;
let
ctx
=
canvas
.
getContext
(
'webgl2'
);
let
shader
=
ctx
.
createShader
(
35633
);
ctx
.
shaderSource
(
shader
,
'
\
n attribute vec4 aPosition;
\
n attribute vec4 aColor;
\
n uniform vec4 anOffset;
\
n varying vec4 vColor;
\
n void main(void) {
\
n gl_Position = aPosition + anOffset;
\
n vColor = aColor;
\
n }
\
n '
);
ctx
.
compileShader
(
shader
);
let
shaderParam1
=
ctx
.
getShaderParameter
(
shader
,
35713
);
let
shader2
=
ctx
.
createShader
(
35632
);
ctx
.
shaderSource
(
shader2
,
'
\
n precision mediump float;
\
n varying vec4 vColor;
\
n void main(void) {
\
n gl_FragColor = vColor;
\
n }
\
n '
);
ctx
.
compileShader
(
shader2
);
let
shaderParam2
=
ctx
.
getShaderParameter
(
shader2
,
35713
);
let
program
=
ctx
.
createProgram
();
ctx
.
attachShader
(
program
,
shader
);
ctx
.
attachShader
(
program
,
shader2
);
ctx
.
linkProgram
(
program
);
let
programParam1
=
ctx
.
getProgramParameter
(
program
,
35714
);
let
buffer1
=
ctx
.
createBuffer
();
ctx
.
bindBuffer
(
34962
,
buffer1
);
let
Float32Array1
=
new
Float32Array
(
6
);
ctx
.
bufferData
(
34962
,
Float32Array1
,
35044
);
let
buffer2
=
ctx
.
createBuffer
();
ctx
.
bindBuffer
(
34962
,
buffer2
);
let
Float32Array2
=
new
Float32Array
(
12
);
ctx
.
bufferData
(
34962
,
Float32Array2
,
35044
);
let
attribLocationAPosition
=
ctx
.
getAttribLocation
(
program
,
'aPosition'
);
let
attribLocationAColor
=
ctx
.
getAttribLocation
(
program
,
'aColor'
);
ctx
.
bindBuffer
(
34962
,
buffer1
);
ctx
.
vertexAttribPointer
(
0
,
2
,
5126
,
false
,
0
,
0
);
ctx
.
enableVertexAttribArray
(
0
);
ctx
.
bindBuffer
(
34962
,
buffer2
);
ctx
.
vertexAttribPointer
(
1
,
4
,
5126
,
false
,
0
,
0
);
ctx
.
enableVertexAttribArray
(
1
);
ctx
.
useProgram
(
program
);
let
webglUniformLocation
=
ctx
.
getUniformLocation
(
program
,
'anOffset'
);
ctx
.
uniform4fv
(
webglUniformLocation
,
[
0.2
,
0
,
0
,
0
])
ctx
.
drawArrays
(
5
,
0
,
3
)
let
unint8Array
=
new
Uint8Array
(
90000
);
ctx
.
readPixels
(
50
,
0
,
100
,
128
,
6408
,
5121
,
unint8Array
);
console
.
log
(
unint8Array
+
''
)
index.html
View file @
a0be74b1
...
@@ -59,21 +59,21 @@
...
@@ -59,21 +59,21 @@
}
}
console
.
log
(
'当前times'
,
window
.
times
)
console
.
log
(
'当前times'
,
window
.
times
)
!
function
(){
//
!function(){
var
websocket
=
new
WebSocket
(
"ws://127.0.0.1:5000/browser"
);
//
var websocket = new WebSocket("ws://127.0.0.1:5000/browser");
websocket
.
onopen
=
function
(){
//
websocket.onopen = function(){
var
info
=
'browser:start:'
+
location
.
href
//
var info = 'browser:start:' + location.href
console
.
log
(
info
);
//
console.log(info);
websocket
.
send
(
info
)
//
websocket.send(info)
}
//
}
websocket
.
onmessage
=
function
(
e
){
//
websocket.onmessage = function(e){
var
info
=
JSON
.
parse
(
e
.
data
)
//
var info = JSON.parse(e.data)
console
.
log
(
'websocket.onmessage'
,
info
)
//
console.log('websocket.onmessage', info)
// 这里处理请求参数以及对应rpc函数调用,返回参数用字符串传递回 websocket。回传字符串即可。
//
// 这里处理请求参数以及对应rpc函数调用,返回参数用字符串传递回 websocket。回传字符串即可。
var
ret
=
sendXHr
()
//
var ret = sendXHr()
websocket
.
send
(
JSON
.
stringify
(
ret
))
//
websocket.send(JSON.stringify(ret))
}
//
}
}()
//
}()
debugger
debugger
try
{
try
{
sendXHr
()
sendXHr
()
...
...
src_out.js
View file @
a0be74b1
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment