-
Notifications
You must be signed in to change notification settings - Fork 3.4k
[wasm64] Fix reading/writing of gl attributes #21187
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
{ | ||
"a.html": 569, | ||
"a.html.gz": 379, | ||
"a.js": 4593, | ||
"a.js.gz": 2369, | ||
"a.js": 4654, | ||
"a.js.gz": 2378, | ||
"a.wasm": 10451, | ||
"a.wasm.gz": 6724, | ||
"total": 15613, | ||
"total_gz": 9472 | ||
"total": 15674, | ||
"total_gz": 9481 | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
{ | ||
"a.html": 567, | ||
"a.html.gz": 379, | ||
"a.js": 17937, | ||
"a.js.gz": 8074, | ||
"a.js": 17997, | ||
"a.js.gz": 8093, | ||
"a.mem": 3123, | ||
"a.mem.gz": 2693, | ||
"total": 21627, | ||
"total_gz": 11146 | ||
"total": 21687, | ||
"total_gz": 11165 | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
{ | ||
"a.html": 569, | ||
"a.html.gz": 379, | ||
"a.js": 4080, | ||
"a.js.gz": 2198, | ||
"a.js": 4140, | ||
"a.js.gz": 2206, | ||
"a.wasm": 10451, | ||
"a.wasm.gz": 6724, | ||
"total": 15100, | ||
"total_gz": 9301 | ||
"total": 15160, | ||
"total_gz": 9309 | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
{ | ||
"a.html": 567, | ||
"a.html.gz": 379, | ||
"a.js": 17415, | ||
"a.js.gz": 7891, | ||
"a.js": 17475, | ||
"a.js.gz": 7911, | ||
"a.mem": 3123, | ||
"a.mem.gz": 2693, | ||
"total": 21105, | ||
"total_gz": 10963 | ||
"total": 21165, | ||
"total_gz": 10983 | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,10 +9,9 @@ | |
#include <cmath> | ||
#include <iostream> | ||
#include <vector> | ||
extern "C" { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. A lot of these changes look unrelated? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah, I just cleaned up the test a little while I was working on it. |
||
#include <GL/gl.h> | ||
#include <GL/glut.h> | ||
} | ||
|
||
static const char vertex_shader[] = | ||
"#ifdef GL_ES\n" | ||
"precision lowp float;\n" | ||
|
@@ -44,6 +43,7 @@ static const char fragment_shader[] = | |
"}\n" | ||
"if ( dst > 0.5) discard;\n" | ||
"}"; | ||
|
||
struct NodeInfo { //structure that we want to transmit to our shaders | ||
float x; | ||
float y; | ||
|
@@ -55,8 +55,9 @@ GLuint nodeSamplerLocation; //shader sampler address | |
GLuint indicesAttributeLocation; //shader attribute address | ||
GLuint indicesVBO; //Vertex Buffer Object Id; | ||
const int nbNodes = 512; | ||
NodeInfo * data = new NodeInfo[nbNodes]; //our data that will be transmitted using float texture. | ||
NodeInfo data[nbNodes]; //our data that will be transmitted using float texture. | ||
double alpha = 0; //use to make a simple funny effect; | ||
|
||
static void updateFloatTexture() { | ||
int count = 0; | ||
for (float x=0; x < nbNodes; ++x ) { | ||
|
@@ -79,7 +80,9 @@ static void updateFloatTexture() { | |
glBindTexture(GL_TEXTURE_2D, 0); | ||
alpha -= 0.001; | ||
} | ||
|
||
static void glut_draw_callback(void) { | ||
printf("glut_draw_callback\n"); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. do we want to keep these printfs in the test? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sure, I think it better overall to have more print statements in the test. |
||
glDisable(GL_CULL_FACE); | ||
glDisable(GL_DEPTH_TEST); | ||
glEnable(GL_BLEND); | ||
|
@@ -96,6 +99,7 @@ static void glut_draw_callback(void) { | |
glDrawArrays(GL_POINTS, 0, nbNodes); | ||
glutSwapBuffers(); | ||
} | ||
|
||
GLuint createShader(const char source[], int type) { | ||
GLint status; | ||
char msg[512]; | ||
|
@@ -110,6 +114,7 @@ GLuint createShader(const char source[], int type) { | |
assert(status == GL_TRUE); | ||
return shader; | ||
} | ||
|
||
static void gl_init(void) { | ||
GLuint program = glCreateProgram(); | ||
glAttachShader(program, createShader(vertex_shader , GL_VERTEX_SHADER)); | ||
|
@@ -145,6 +150,7 @@ static void gl_init(void) { | |
glEnable(GL_POINT_SPRITE); | ||
#endif | ||
} | ||
|
||
int main(int argc, char *argv[]) { | ||
glutInit(&argc, argv); | ||
glutInitWindowSize(640, 480); | ||
|
@@ -153,6 +159,7 @@ int main(int argc, char *argv[]) { | |
/* Set up glut callback functions */ | ||
glutDisplayFunc(glut_draw_callback ); | ||
gl_init(); | ||
printf("done setup\n"); | ||
glutMainLoop(); | ||
return 0; | ||
} | ||
|
Uh oh!
There was an error while loading. Please reload this page.