Why does the triangle rendered by OpenGL ES 2.0 , with SDL 2.0 context, vanishes after a single render, if events are not polled?

I was experimenting with OpenGL ES 2.0 and being new to OpenGL, I was trying to render a simple triangle. But I was shocked to see that, if I do not call SDL_PollEvent(...) after glDrawArrays(...) in the game loop, I see the triangle render on the screen for a split second and then it vanishes altogether ! But, if I call SDL_PollEvent then everything is fine ! Can anyone explain to me the reason for this abnormal behavior???

However, this is the interesting part of my code:

This code works perfectly, if I uncomment the commented block of code:

uint32_t vbo;  glGenBuffers(1, &vbo); glBindBuffer(GL_ARRAY_BUFFER, vbo); glBufferData(GL_ARRAY_BUFFER, sizeof(vertices), vertices, GL_STATIC_DRAW);  glEnableVertexAttribArray(pos); glVertexAttribPointer(pos, 3, GL_FLOAT, GL_FALSE, 3*sizeof(float), (void*)0);  bool run = true; SDL_Event e; while (run) {     glDrawArrays(GL_TRIANGLES, 0, 3);   SDL_GL_SwapWindow(window);   /*while(SDL_PollEvent(&e)) {       switch(e.type)       {            case SDL_QUIT:                 run = false;                 break;        } } */ 


Vertex Shader:

precision mediump float;  attribute vec3 pos; void main() {     gl_Position = vec4(pos.xyz, 1.0);  } 

Fragment Shader:

precision mediump float;  void main() {       gl_FragColor = vec4(0.0, 0.0, 1.0, 1.0);  } 

Every help will be greatly appreciated, Thankyou everyone in advance !

Is it a risk if an html code from a textbox is rendered on the next page but searched string is not shown on the url?

I found a website in which the results are rendered on the next page. From “/search” address, the data is forwarded to “/result” without any trailing characters(searched item) on the address. But the html code from the first page is rendered on the next page, and yes javascript execution can be executed. Is this still a security risk even though the searched string is not on the address url?

PrimeNG – p-dropdown rendered unexpectedly

I’m using PrimeNG in my Angular application. I’m intending to use the p-dropdown component, but it is rendering very strangely in my components.

p-dropdown strange render

This looks nothing like what they demonstrate in their documentation.

Here is package.json:

{   "name": "soar",   "version": "0.0.0",   "scripts": {     "ng": "ng",     "start": "ng serve",     "build": "ng build",     "test": "ng test",     "lint": "ng lint",     "e2e": "ng e2e"   },   "private": true,   "dependencies": {     "@angular/animations": "^7.2.15",     "@angular/cdk": "^8.0.1",     "@angular/common": "~7.2.0",     "@angular/compiler": "~7.2.0",     "@angular/core": "^8.0.2",     "@angular/forms": "~7.2.0",     "@angular/material": "^8.0.1",     "@angular/platform-browser": "~7.2.0",     "@angular/platform-browser-dynamic": "~7.2.0",     "@angular/router": "~7.2.0",     "@ng-bootstrap/ng-bootstrap": "^4.1.3",     "@ngrx/effects": "^7.4.0",     "@ngrx/store": "^7.4.0",     "@ngrx/store-devtools": "^7.4.0",     "bootstrap": "^4.3.1",     "chart.js": "^2.8.0",     "core-js": "^2.5.4",     "font-awesome": "^4.7.0",     "primeng": "^8.0.0",     "quill": "^1.3.6",     "rxjs": "~6.3.3",     "tslib": "^1.9.0",     "zone.js": "~0.8.26"   },   "devDependencies": {     "@angular-devkit/build-angular": "~0.13.0",     "@angular/cli": "~7.3.9",     "@angular/compiler-cli": "~7.2.0",     "@angular/language-service": "~7.2.0",     "@ngrx/schematics": "^7.4.0",     "@types/jasmine": "~2.8.8",     "@types/jasminewd2": "~2.0.3",     "@types/node": "~8.9.4",     "codelyzer": "~4.5.0",     "jasmine-core": "~2.99.1",     "jasmine-spec-reporter": "~4.2.1",     "karma": "~4.0.0",     "karma-chrome-launcher": "~2.2.0",     "karma-coverage-istanbul-reporter": "~2.0.1",     "karma-jasmine": "~1.1.2",     "karma-jasmine-html-reporter": "^0.2.2",     "protractor": "~5.4.0",     "ts-node": "~7.0.0",     "tslint": "~5.11.0",     "typescript": "~3.2.2"   } } 

I am using Bootstrap app-wide, but I wouldn’t imagine that’d be a problem. Full-disclosure: I’m not a UI/UX person, but I think this should instead be rendered as some sort of select element. What may be causing this and how do I fix it?

R plot text: How to add regular text prefix to polynomial rendered in exponent form (not ^)

I’m trying to add this text to a plot: “Model: y = 1 + 2x – 3x^2 + 4x^3” where actual exponents are rendered as such (no ^ chars). (See screenshot)

Below is repro code. The first text() call works fine (no prepended regular text), but the second does not (with prepended text). (Execute soTest() to repro.)

Any suggestions? I guess I don’t know which R keywords to search for to find a solution. Any help would be appreciated! (Please pardon the camel-casing, I’m writing a slide deck for an audience with at least a few non-R coders.)

evalPoly = function( x, coeff ) {     if ( length( coeff ) < 1 ) return( c(0) )        termSum <- 0     for ( i in 1:length(coeff) ) {         termSum <- termSum + coeff[i] * x^(i-1)     }     return( termSum ) }  soTest <- function() {     coeff <- c( 1, 2, -3, 4 )     x <- 1:8     y <- evalPoly( x, coeff )     plot( x, y )     text( 2, 1600, parse( text="1+2*x-3*x^2+4*x^3" ), adj=0 )     text( 2, 1400, parse( text="Model:  y = 1+2*x-3*x^2+4*x^3" ), adj=0 ) } 

resulting plot

Is it possible to send the entire rendered html and css from client to server?

If you hit ctr-s you can save the current website on your hard drive. I want to send exactly the same data directly to the server when hitting a button using javascript. How to do that?

It should later be possible to serve the website data from that server. And it should look and behave the same way.

How to alter rendered and aggregated views values?

I would like to do math on counts of two aggregated fields. In views post render the final results are located under $ view->style_plugin->rendered_fields[0] and they are generated by views aggregator plus.

I wrote a foreach loop that iterate through the results like this

 if ($  view->id() == 'stuff' && $  view->getDisplay()->display['id'] == 'morestuff') { foreach ($  view->result as $  id => $  row) {   $  value = $  view->style_plugin->getField($  id,'field_1');   $  value2 = $  view->style_plugin->getField($  id,'field_2'); 

And there I am stuck because I don’t know how to set a style plugin field value. Maybe I am not supposed to do it there because the hook documentation is confusing about the role of $ output as can be seen here and here.

So, how would you do this?

and tags in a text field of format Full HTML are not rendered

In latest Drupal 8, I’ve got a text field of format Full HTML that contains <form> and <input> tags (It’s a MailChimp subscribe snippet). As long as I am editing the text in CKEditor in the backend, the form is displayed correctly. But as soon as I view tha page in the frontend, both tags are stipped out. I checked my text format/CKEditor settings to see if tags are stripped out there, but “Limit Allowed HTML Tags” is unchecked. Does someone know what’s happening here?

Programmatically get View Field rendered HTML

I need to programmatically read a field output from a View. The field output has been rewritten with extra text and twig. My code:

 foreach($  view->result as $  row){     foreach ($  view->field as $  fieldId => $  field) {       if ($  fieldId = 'Fieled 1') {           $  field_output = $  view->style_plugin->getFieldValue($  row->index, $  fieldId);       }     }   } 

The output is a numeric number, which does not make sense to me. (The field a text field rewritten with a long text paragraph). Any help would be really appreciated!

How do I add a date picker that is rendered from most the browsers?

I am migrating from Drupal 7 to Drupal 8. In forms I use '#type' => 'date_popup' for date fields, which Drupal 8 replaces by '#type' => 'date' and uses HTML 5.

I’m finding it most unsatisfactory because:

  1. It has poor browser support; Internet Explorer 11 doesn’t provide a popup.
  2. I can’t find anyway to change the input format from ‘m/d/yyyy’ to either ‘d/m/yyyy’ or ‘yyyy-mm-dd’.

I have ensured that my browser language setting is English (Australian) which has a default date format of ‘d/m/yyyy’.

Does anyone have a solution that provides a date picker for most the browsers and a text input format that can be controlled by the server, not the client?