opengl – Rendering a quad using VAOs and VBOs in LWJGL 3 doesn’t work

So, I just started learning LWJGL 3 and I used a mixture of a couple of tutorials and example code to make something that should render a rectangle to a magenta screen using VAOs and VBOs. There are no errors but the rectangle doesn’t appear on screen (all I can see is a magenta screen). I tried using the old LWJGL pipeline (glBegin() and glEnd()) and it does work so I tried changing random things in the rendering code and the loading to VAOs and VBOs. I also tried to bind the VBO too but it didn’t change anything. I also tried debugging and it seems like there is a VAO and a VBO that is created.

Can someone take a look at my code and see if something looks wrong? Here it is (sorry if its a bit messy):

import org.lwjgl.*;
import org.lwjgl.glfw.*;
import org.lwjgl.opengl.*;
import org.lwjgl.system.*;

import engine.io.Loader;
import engine.io.RawModel;
import engine.io.Renderer;
import engine.io.Window;

import java.nio.*;

import static org.lwjgl.glfw.Callbacks.*;
import static org.lwjgl.glfw.GLFW.*;
import static org.lwjgl.opengl.GL11.*;
import static org.lwjgl.system.MemoryStack.*;
import static org.lwjgl.system.MemoryUtil.*;

public class Main {

private Window window;

Loader loader = new Loader();
Renderer renderer = new Renderer();

float() vertices = {
        // Left bottom triangle
        -0.5f, 0.5f, 0f,
        -0.5f, -0.5f, 0f,
        0.5f, -0.5f, 0f,
        // Right top triangle
        0.5f, -0.5f, 0f,
        0.5f, 0.5f, 0f,
        -0.5f, 0.5f, 0f
};

RawModel model;


public void run() {
    setup();
    loop();
    
    loader.cleanUp();

    glfwFreeCallbacks(window.getWindowNum());
    glfwDestroyWindow(window.getWindowNum());
    
    glfwTerminate();
    glfwSetErrorCallback(null).free();
}

private void loop() {
    while ( !glfwWindowShouldClose(window.getWindowNum()) ) {
        glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // clear the framebuffer
        
        renderer.render(model);
        
        glfwSwapBuffers(window.getWindowNum()); // swap the color buffers
        
        glfwPollEvents();
    }
}


public void setup() {
    window = new Window(900, 300, "Flappy Bird");
    window.create();
    
    GL.createCapabilities();
    GLFW.glfwMakeContextCurrent(window.getWindowNum());

    model = loader.loadToVAO(vertices);
    renderer.prepare();
    
    GL11.glViewport(0, 0, 900, 300);
    
}


public static void main(String() args) {
    new Main().run();
}

}

Here is the window class:

package engine.io;

import static org.lwjgl.glfw.GLFW.*;
import static org.lwjgl.opengl.GL11.*;
import static org.lwjgl.system.MemoryStack.stackPush;
import static org.lwjgl.system.MemoryUtil.*;

import java.nio.IntBuffer;

//import static org.lwjgl.glfw.GLFW.*;
import org.lwjgl.glfw.GLFW;
import org.lwjgl.glfw.GLFWErrorCallback;
import org.lwjgl.glfw.GLFWVidMode;
import org.lwjgl.system.MemoryStack;

public class Window {
private int width, height;
private String title;
private long window;

public Window(int width, int height, String title) {
    this.width = width;
    this.height = height;
    this.title = title;
}

public void create() {
    GLFWErrorCallback.createPrint(System.err).set();

    if (!glfwInit())
        throw new IllegalStateException("Unable to initialize GLFW");

    // Configure GLFW
    glfwDefaultWindowHints(); // optional, the current window hints are already the default
    glfwWindowHint(GLFW_VISIBLE, GLFW_FALSE); // the window will stay hidden after creation
    glfwWindowHint(GLFW_RESIZABLE, GLFW_TRUE); // the window will be resizable

    // Create the window
    window = glfwCreateWindow(width, height, "Flappy Bird", NULL, NULL);
    if (window == NULL)
        throw new RuntimeException("Failed to create the GLFW window");

    // Get the thread stack and push a new frame
    try (MemoryStack stack = stackPush()) {
        IntBuffer pWidth = stack.mallocInt(1); // int*
        IntBuffer pHeight = stack.mallocInt(1); // int*

        // Get the window size passed to glfwCreateWindow
        glfwGetWindowSize(window, pWidth, pHeight);

        // Get the resolution of the primary monitor
        GLFWVidMode vidmode = glfwGetVideoMode(glfwGetPrimaryMonitor());

        // Center the window
        glfwSetWindowPos(window, (vidmode.width() - pWidth.get(0)) / 2, (vidmode.height() - pHeight.get(0)) / 2);
    } // the stack frame is popped automatically
        // Setup a key callback. It will be called every time a key is pressed, repeated
        // or released.
    glfwSetKeyCallback(window, (window, key, scancode, action, mods) -> {
        if (key == GLFW_KEY_ESCAPE && action == GLFW_RELEASE)
            glfwSetWindowShouldClose(window, true); // We will detect this in the rendering loop
    });

    // Make the OpenGL context current
    glfwMakeContextCurrent(window);
    // Enable v-sync
    glfwSwapInterval(1);

    // Make the window visible
    glfwShowWindow(window);

}



public long getWindowNum() {
    return window;
}

}

And the Raw Model class:

package engine.io;

public class RawModel {
private int vaoID;
private int vertexCount;


public RawModel(int vaoID, int vertexCount) {
    this.vaoID = vaoID;
    this.vertexCount = vertexCount;
}


public int getVaoID() {
    return vaoID;
}


public int getVertexCount() {
    return vertexCount;
}

}

The loader class:

package engine.io;

import java.nio.FloatBuffer;
import java.util.ArrayList;
import java.util.List;

import org.lwjgl.BufferUtils;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL15;
import org.lwjgl.opengl.GL20;
import org.lwjgl.opengl.GL30;
import org.lwjgl.system.MemoryUtil;

public class Loader {
    
private List<Integer> vaos = new ArrayList<Integer>();
private List<Integer> vbos = new ArrayList<Integer>();



public RawModel loadToVAO(float() positions) {
    int vaoID = createVAO();
    storeDataInAttributeList(0, positions);
    unbindVAO();
    return new RawModel(vaoID, positions.length/3);
}

private int createVAO() {
    int vaoID = GL30.glGenVertexArrays();
    vaos.add(vaoID);
    GL30.glBindVertexArray(vaoID);
    return vaoID;
}

private void storeDataInAttributeList(int attributeNumber, float() data) {
    int vboID = GL15.glGenBuffers();
    vbos.add(vboID);
    GL15.glBindBuffer(GL15.GL_ARRAY_BUFFER, vboID);
    FloatBuffer buffer = storeDataInFloatBuffer(data);
    GL15.glBufferData(GL15.GL_ARRAY_BUFFER, buffer, GL15.GL_STATIC_DRAW);
    GL20.glVertexAttribPointer(attributeNumber, 3, GL11.GL_FLOAT, false, 0, 0);
    GL15.glBindBuffer(GL15.GL_ARRAY_BUFFER, 0);
    }

private void unbindVAO() {
    GL30.glBindVertexArray(0);
}

private FloatBuffer storeDataInFloatBuffer(float() data) {
    FloatBuffer buffer = MemoryUtil.memAllocFloat(data.length);
    buffer.put(data);
    buffer.flip();
    return buffer;
}

public void cleanUp() {
    for (int vao : vaos) {
        GL30.glDeleteVertexArrays(vao);
    }
    for (int vbo : vbos) {
        GL15.glDeleteBuffers(vbo);
    }
}

}

And lastly the renderer class:

    package engine.io;

import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL15;
import org.lwjgl.opengl.GL20;
import org.lwjgl.opengl.GL30;

public class Renderer {
    


public void prepare() {
    GL11.glClear(GL11.GL_COLOR_BUFFER_BIT);
    GL11.glClearColor(1f, 0f, 1f, 1f);
}

public void render(RawModel model) {
    GL30.glBindVertexArray(model.getVaoID());
    GL20.glEnableVertexAttribArray(0);
    GL11.glDrawArrays(GL11.GL_TRIANGLES, 0, model.getVertexCount());
    GL20.glDisableVertexAttribArray(0);
    GL30.glBindVertexArray(0);
}

}

dnd 5e – Can an Artificer’s eldritch cannon work with the use of the Rogue’s sneak attack ability?

The eldritch canon would not qualify you to benefit from the second method of using sneak attack.

You don’t need advantage on the attack roll if another enemy of the target is within 5 feet of it, that enemy isn’t incapacitated, and you don’t have disadvantage on the attack roll.

The important part of the eldritch canon in this scenario is

The cannon is a magical object.

The eldritch canon is a magical object. While it has many unique properties that the artificer can activate which may seem like a creature. It is still just a magical object.

It is no more a valid enemy for the target than if you had a magic sword or shield. I do not believe anyone would argue that using a magic sword automatically qualifies you for the sneak attack bonus. (and a sentient magic sword is much closer to a creature as it has its own personality)

Some important tweets on the subject: Enemies and allies While not officially Rules as Written, Jeremy Crawford is the rules designer and his answers are considered official rulings. In this tweet he says that the illusion cannot provide the benefit of sneak attack, because its not a creature, and thus not an enemy or ally.

Spiritual Weapon Sneak Attack Here he confirms that spiritual weapon does not count as an enemy.

Furthermore you can consider on here :What is an Enemy? Where its made abundantly clear that the intent of the developers is that creatures are enemies.

plsql – Oracle PL/SQL does not work — bind variable not allowed

Oracle 12.2 PL/SQL

When running:

s_sql := 'dbms_hs_passthrough.execute_immediate@mylink || '(''exec sp_get_names'')';
execute immediate 'begin :x; end;' using in s_sql;

Fails with:

PLS-00110: bind variable 'X' not allowed in this context

The procedure runs fine as

 dbms_hs_passthrough.execute_immediate@mylink('exec sp_get_names'); 

But I want to make it dynamic.
Any suggestions?

Instructions to Work With Different Types of News Feeds

Here are different choices on the webfor RSS channels that are coordinated inside long range interpersonal communication destinations. Facebook, for instance, has it’s own adaptation of that that with a news page tha o RSS channels when they talk about news sources, there are different ways that term is utilized in various person to person communication destinations.
mobile number list
As we examined before, the two different ways of utilizing RSS channels is to get supporters or to utilize them to give new substance to your site. The main way includes an activity that must be taken by the individual visitin e energize individuals visiting your site to buy in. Since the mechanics of RSS channels are as yet not that notable by the normal Internet

.

Instructions to Work With Different Types of News Feeds

Here are different choices on the webfor RSS channels that are coordinated inside long range interpersonal communication destinations. Facebook, for instance, has it’s own adaptation of that that with a news page tha o RSS channels when they talk about news sources, there are different ways that term is utilized in various person to person communication destinations. mobile number list
As we examined before, the two different ways of utilizing RSS channels is to get supporters or to utilize them to give new substance to your site. The main way includes an activity that must be taken by the individual visitin e energize individuals visiting your site to buy in. Since the mechanics of RSS channels are as yet not that notable by the normal Internet

.

Work From Home Advice and Information

There are numerous things on the Internet that can give you a work from home chance. Work from home business likewise offer adaptability. Indeed, even work from home mothers can fit this open door around their kids’ needs. mobile number list This is a typical slip-up when individuals are truly searching for to telecommute, they tune in to counsel from an inappropriate people, and from individuals who have never prevailing in home working in their carries on with, yet at the same time prefer to offer guidance like they have the information. With an expanding number of rumored organizations currently extending work from home or work from home employment opportunities or business openings, you also can profit a work from home, They help you to turn out to be a piece of their developing work from home or establishment group. Independent composing occupations give you adaptability over your hours while you telecommute, so take the plunge. In spite of the fact that having the option to telecommute is exceptionally engaging, you should make sure to be cautious. Continuously ensure that you secure yourself by figuring out how to perceive the most widely recognized work from home tricks that are on the web.

.

background process – Renice does not work

I am trying to run two long-running test processes in the background with two processors. Tried to renice them to 19 via top. Top shows me 19 in the column entitled NI, but the processes take resources as ever before. For example, when I run just while :;do :;done this non-nice process gets the same share of CPU as those two. I would expect it to run at 100% and the nice processes at 50% each (I have 2*100% of CPU). Their memory usage is constantly 0.5% each. Nor are there many syscalls involved.

What else may I do to get them running smoothly (kill -STOP/-CONT is not an option).

(I am using 14.04, yes I know …)

multisite – Htaccess file isn’t redirecting http sub-pages to https––they display 404 error instead, tried many solutions and none work

I installed SSL on my Google Compute Engine hosted WordPress Multisite installation, and have been having a hard time getting it working fully. Right now, the main domains for each site redirect properly to their https version, and the sites show that they’re secure, so they seems to be configured correctly. All links/images/etc use dynamic URLs so they’re also updated fine.

However, if I directly visit a sub page of the site in http form, it won’t redirect to the https and instead shows a 404 error. If i manually add the https into the url, it loads correctly, but otherwise it just shows a 404 error.

I have poured over StackOverflow and StackExchange and tried probably 20 different solutions, and none of them work. Most recently I tried the following:

# Redirect HTTP to HTTPS
RewriteEngine On
RewriteCond %{HTTPS} !on
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} (R=302,L)

# BEGIN WordPress
# The directives (lines) between `BEGIN WordPress` and `END WordPress` are
# dynamically generated, and should only be modified via WordPress filters.
# Any changes to the directives between these markers will be overwritten.
<IfModule mod_rewrite.c>
RewriteEngine On

RewriteBase /
RewriteRule ^index.php$ - (L)

# add a trailing slash to /wp-admin
RewriteRule ^wp-admin$ wp-admin/ (R=301,L)

RewriteCond %{REQUEST_FILENAME} -f (OR)
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - (L)
RewriteRule ^(wp-(content|admin|includes).*) $1 (L)
RewriteRule ^(.*.php)$ $1 (L)
RewriteRule . index.php (L)
</IfModule>

# END WordPress

Unfortunately it’s not working. You can see an example of what I mean here:

http://polararealty.com (will redirect properly to https)
http://polararealty.com/listings/ (won’t redirect to https and instead shows 404 error)
https://polararealty.com/listings/ (shows correct page that the above should be redirecting to)

sms – How does Photo Caller ID work?

Sometimes someone will call me and their photo will show as the phone rings. In the cases I’m referring to I’ve never added a photo to the contact—somehow the phone picks up their image over the Internet.

I’d like to register my photo in such a place, but how does it work?

I have had both iPhone and Android users call me and sometimes I get their “Photo Caller ID” for lack of a better term.

My phone is an HTC m8 running LineageOS 14.1.

Thanks for your help!

internet – Where can I find a decent place to do remote work in Addis Ababa?

I will be living in Addis Ababa from the end of February until the end of August. I normally work as a software developer in Sweden and I hope to continue doing that in Ethiopia (albeit remotely).

That means that I am looking for a decent place to work. A place where I can work like that preferrably includes the following, in descending order of priority:

    Reliable outlets
    Reliable and fast internet connection (I know this can be a bit shaky at times)
    Being able to work there for 8h a day
    Comfortable chairs
    An extra display (as I’m only bringing my laptop)
    Near the Old Airport area

An internet café might be an option, if they’re okay with me working there every day of the week. If there’s a place where you can rent office space (something like http://www.instantoffices.com/en/se/office-space/stockholm) that would be very interesting.