java – Rendering to BufferStrategy gives absolutely no output despite following instructions

I am following the tutorials by TheCherno in YouTube to make 3D graphics using Java Standard Library.

Display.java

package aritro;

import java.awt.Canvas;
import java.awt.Graphics;
import java.awt.image.BufferStrategy;
import java.awt.image.BufferedImage;
import java.awt.image.DataBufferInt;

import javax.swing.JFrame;

//import aritro.graphics.Render;
import aritro.graphics.Screen;

public class Display extends Canvas implements Runnable {

    private static final long serialVersionUID = -1545751462933395031L;
    static int HEIGHT = 500, WIDTH = 800;
    static String title = "Minefront Pre-Alpha 0.0.1";
    private Thread thread;
    private boolean running = false;
    //private Render render;
    private Screen screen;
    private BufferedImage img;
    private int pixels();

    public Display() {
        screen = new Screen(WIDTH, HEIGHT);
        img = new BufferedImage(WIDTH, HEIGHT, BufferedImage.TYPE_INT_RGB);
        pixels = ((DataBufferInt) img.getRaster().getDataBuffer()).getData();
    }

    private void start() {
        if (running)
            return;
        running = false;
        this.thread = new Thread(this);
        System.out.println("Working...");
    }

    @Override
    public void run() {
        while (running) {
            tick();
            render();
        }
    }

    private void render() {
        BufferStrategy bs = getBufferStrategy();
        if (bs == null) {
            createBufferStrategy(3);
            return;
        }
        
        screen.render();
        
        for (int i = 0; i < WIDTH * HEIGHT; i++) {
            pixels(i) = screen.pixels(i);
        }
        Graphics g = bs.getDrawGraphics();
        g.drawImage(img, 0, 0, WIDTH, HEIGHT, null);
        g.dispose();
        bs.show();
    }

    private void tick() {

    }

    public void stop() {
        if (!running)
            return;
        running = false;
        try {
            thread.join();
        } catch (Exception e) {
            e.printStackTrace();
            System.exit(0);
        }
    }

    public static void main(String() args) {
        Display game = new Display();
        JFrame frame = new JFrame(title);
        frame.add(game);
        frame.setResizable(false);
        frame.pack();
        frame.setSize(WIDTH, HEIGHT);
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.setLocationRelativeTo(null);
        frame.setVisible(true);
        game.start();
    }

}

This class is the main class which renders to the JFrame. The two helper classes Render.java and Screen.java.

Render.java

package aritro.graphics;

public class Render {
    public int height, width;
    public int pixels();

    public Render(int _width, int _height) {
        width = _width;
        height = _height;
        pixels = new int(width * height);
    }

    public void draw(Render render, int xOffset, int yOffset) {
        for (int y = 0; y < render.height; y++) {
            int yPix = y + yOffset;
            for (int x = 0; x < render.width; x++) {
                int xPix = x + xOffset;
                pixels(xPix + yPix * width) = render.pixels(x + y * width);
            }
        }
    }
}

Screen.java

package aritro.graphics;

import java.util.Random;

public class Screen extends Render {
    private Render test;

    public Screen(int _width, int _height) {
        super(_width, _height);
        Random random = new Random();
        test = new Render(256, 256);
        for (int i = 0; i < 256 * 256; i++) {
            test.pixels(i) = random.nextInt();
        }
    }

    public void render() {
        draw(test, 0, 0);
    }
}

But unlike the the end of the video, I just get the blank grey screen instead of a black one with a pitch of randomly colored pixels.

Can someone point the mistake in the code which is causing the problems ?

Link to video : https://www.youtube.com/watch?v=bKbZECPjQs0

Java version used – Java14.0.0.1

cpu – Processor with a higher IPC vs Processor with lower IPC but specific instructions

Intel and AMD have long been fierce competitors in the CPU industry. As of late, AMD seems to have managed to make processors with a higher IPC on a single core than Intel (e.g. the Ryzen 5000 series).

Say we have the following scenario (the numbers are obviously just for demonstration)

The workload: 1000 instructions doing X
Intel CPU IPC: 10, but Intel CPU is good at specifically doing instruction X (<- Is this even possible?)
AMD CPU IPC: 20

I was wondering, will the AMD CPU always complete this workload faster? Can a CPU with a lower IPC actually complete certain workloads faster than a CPU with a higher IPC if the instructions that comprise the workload run faster on a given CPU?

Or do CPU instructions run at the same speed across Intel/AMD CPU’s?

Please improve installation instructions

I’m trying to create a bootable USB stick for Ubuntu. I am following the directions given on this page https://ubuntu.com/tutorials/create-a-usb-stick-on-windows#6-write-the-iso .
When I get the following popup when I click start while using Rufus. ‘The image you have selected is an IOSHybird image. …" The message gives me a option (pre-selected) "Write in IOS image mode (recommended) or 2) write in DD image mode. The instruction on the linked page (above) did not mention this popup and gives no advice. Can this site be updated to include advice on this popup? Thanks.

linux – Should I use the manufacturer instructions for installing Griddb on Ubuntu or use Quick intall from deb?

I am following the instructions of https://github.com/griddb/.
But I am experiencing difficulties with it:

~/griddb$ sudo make
Making all in 3rd_party/MessagePack
make(1): Entering directory '/home/abc/griddb/3rd_party/MessagePack'
gcc -DPACKAGE_NAME="GridDB" -DPACKAGE_TARNAME="griddb" -DPACKAGE_VERSION="4.6.0" -DPACKAGE_STRING="GridDB 4.6.0" -DPACKAGE_BUGREPORT="" -DPACKAGE_URL="" -DPACKAGE="griddb" -DVERSION="4.6.0" -I.  -I./include   -O3 -fno-tree-vectorize -DNDEBUG -MT libmsgpack_a-objectc.o -MD -MP -MF .deps/libmsgpack_a-objectc.Tpo -c -o libmsgpack_a-objectc.o `test -f './src/objectc.c' || echo './'`./src/objectc.c
mv -f .deps/libmsgpack_a-objectc.Tpo .deps/libmsgpack_a-objectc.Po
gcc -DPACKAGE_NAME="GridDB" -DPACKAGE_TARNAME="griddb" -DPACKAGE_VERSION="4.6.0" -DPACKAGE_STRING="GridDB 4.6.0" -DPACKAGE_BUGREPORT="" -DPACKAGE_URL="" -DPACKAGE="griddb" -DVERSION="4.6.0" -I.  -I./include   -O3 -fno-tree-vectorize -DNDEBUG -MT libmsgpack_a-unpack.o -MD -MP -MF .deps/libmsgpack_a-unpack.Tpo -c -o libmsgpack_a-unpack.o `test -f './src/unpack.c' || echo './'`./src/unpack.c
mv -f .deps/libmsgpack_a-unpack.Tpo .deps/libmsgpack_a-unpack.Po
gcc -DPACKAGE_NAME="GridDB" -DPACKAGE_TARNAME="griddb" -DPACKAGE_VERSION="4.6.0" -DPACKAGE_STRING="GridDB 4.6.0" -DPACKAGE_BUGREPORT="" -DPACKAGE_URL="" -DPACKAGE="griddb" -DVERSION="4.6.0" -I.  -I./include   -O3 -fno-tree-vectorize -DNDEBUG -MT libmsgpack_a-version.o -MD -MP -MF .deps/libmsgpack_a-version.Tpo -c -o libmsgpack_a-version.o `test -f './src/version.c' || echo './'`./src/version.c
mv -f .deps/libmsgpack_a-version.Tpo .deps/libmsgpack_a-version.Po
gcc -DPACKAGE_NAME="GridDB" -DPACKAGE_TARNAME="griddb" -DPACKAGE_VERSION="4.6.0" -DPACKAGE_STRING="GridDB 4.6.0" -DPACKAGE_BUGREPORT="" -DPACKAGE_URL="" -DPACKAGE="griddb" -DVERSION="4.6.0" -I.  -I./include   -O3 -fno-tree-vectorize -DNDEBUG -MT libmsgpack_a-vrefbuffer.o -MD -MP -MF .deps/libmsgpack_a-vrefbuffer.Tpo -c -o libmsgpack_a-vrefbuffer.o `test -f './src/vrefbuffer.c' || echo './'`./src/vrefbuffer.c
mv -f .deps/libmsgpack_a-vrefbuffer.Tpo .deps/libmsgpack_a-vrefbuffer.Po
gcc -DPACKAGE_NAME="GridDB" -DPACKAGE_TARNAME="griddb" -DPACKAGE_VERSION="4.6.0" -DPACKAGE_STRING="GridDB 4.6.0" -DPACKAGE_BUGREPORT="" -DPACKAGE_URL="" -DPACKAGE="griddb" -DVERSION="4.6.0" -I.  -I./include   -O3 -fno-tree-vectorize -DNDEBUG -MT libmsgpack_a-zone.o -MD -MP -MF .deps/libmsgpack_a-zone.Tpo -c -o libmsgpack_a-zone.o `test -f './src/zone.c' || echo './'`./src/zone.c
mv -f .deps/libmsgpack_a-zone.Tpo .deps/libmsgpack_a-zone.Po
rm -f libmsgpack.a
ar cru libmsgpack.a libmsgpack_a-objectc.o libmsgpack_a-unpack.o libmsgpack_a-version.o libmsgpack_a-vrefbuffer.o libmsgpack_a-zone.o
ar: `u' modifier ignored since `D' is the default (see `U')
ranlib libmsgpack.a
make(1): Leaving directory '/home/abc/griddb/3rd_party/MessagePack'
Making all in utility
make(1): Entering directory '/home/abc/griddb/utility'
g++ -DPACKAGE_NAME="GridDB" -DPACKAGE_TARNAME="griddb" -DPACKAGE_VERSION="4.6.0" -DPACKAGE_STRING="GridDB 4.6.0" -DPACKAGE_BUGREPORT="" -DPACKAGE_URL="" -DPACKAGE="griddb" -DVERSION="4.6.0" -I.  -I../utility   -Wall -finput-charset=UTF-8 -Wpointer-arith -Wno-unused-variable -Wno-unused-but-set-variable -Wno-unused-function -Wno-unused-parameter -std=gnu++0x -O3 -fno-tree-vectorize -DNDEBUG -MT libutil_a-allocator.o -MD -MP -MF .deps/libutil_a-allocator.Tpo -c -o libutil_a-allocator.o `test -f './util/allocator.cpp' || echo './'`./util/allocator.cpp
mv -f .deps/libutil_a-allocator.Tpo .deps/libutil_a-allocator.Po
g++ -DPACKAGE_NAME="GridDB" -DPACKAGE_TARNAME="griddb" -DPACKAGE_VERSION="4.6.0" -DPACKAGE_STRING="GridDB 4.6.0" -DPACKAGE_BUGREPORT="" -DPACKAGE_URL="" -DPACKAGE="griddb" -DVERSION="4.6.0" -I.  -I../utility   -Wall -finput-charset=UTF-8 -Wpointer-arith -Wno-unused-variable -Wno-unused-but-set-variable -Wno-unused-function -Wno-unused-parameter -std=gnu++0x -O3 -fno-tree-vectorize -DNDEBUG -MT libutil_a-code.o -MD -MP -MF .deps/libutil_a-code.Tpo -c -o libutil_a-code.o `test -f './util/code.cpp' || echo './'`./util/code.cpp
In file included from ./util/code.cpp:43:0:
./util/code.h: In function ‘int32_t util::varIntDecode64(const uint8_t*, uint64_t&)’:
./util/code.h:3476:14: warning: result of ‘(127 << 28)’ requires 36 bits to represent, but ‘int’ only has 32 bits (-Wshift-overflow=)
   a &= (0x7f << 28) | (0x7f << 14) | (0x7f);
         ~~~~~^~~~~
./util/code.h:3489:14: warning: result of ‘(127 << 28)’ requires 36 bits to represent, but ‘int’ only has 32 bits (-Wshift-overflow=)
   b &= (0x7f << 28) | (0x7f << 14) | (0x7f);
         ~~~~~^~~~~
./util/code.h: In static member function ‘static void util::ObjectCoder::Impl::decodeInternal(C&, S&, T&, const Attribute&, const Traits&, const util::ObjectCoder::Impl::TypeTag<(util::ObjectCoder::Type)5>&)’:
./util/code.h:4765:43: error: expected primary-expression before ‘>’ token
   value.push_back(coder.create<ElementType>());
                                           ^
./util/code.h:4765:45: error: expected primary-expression before ‘)’ token
   value.push_back(coder.create<ElementType>());
                                             ^
./util/code.h: In static member function ‘static void util::ObjectCoder::Impl::decodeInternal(C&, S&, T&, const Attribute&, const Traits&, const util::ObjectCoder::Impl::TypeTag<(util::ObjectCoder::Type)8>&)’:
./util/code.h:4818:24: error: expected primary-expression before ‘>’ token
  value = coder.create<T>();
                        ^
./util/code.h:4818:26: error: expected primary-expression before ‘)’ token
  value = coder.create<T>();
                          ^
Makefile:394: recipe for target 'libutil_a-code.o' failed
make(1): *** (libutil_a-code.o) Error 1
make(1): Leaving directory '/home/abc/griddb/utility'
Makefile:383: recipe for target 'all-recursive' failed
make: *** (all-recursive) Error 1

computer science – How do you metricize instructions per clock and cycles per instruction?

I’ve never seen this question posed before; but, I’m somewhat confused as to how to compare different CPU units in terms of hard performance? I suspect that this is done through analyzing how much ‘information’ can be put through one cycle per logical gates.

Is there any unitary measure other than “clocks” per “cycle” or “instructions” per “clock”, and if there’s no other way to metricize computational performance, then what do those measures of performance mean in real world performance?

How does the assembler translate english assembly to binary machine code instructions?

My assumptions (please correct me if anything in this part is wrong including wrong usages of jargons)

In MIPS instructions, add t1 t2 t3 translates to 00000001010010110100100000100000 . The add, t1, t2, t3 I suppose first of all get translated to some ASCII value implemented on the hardware level. For example, t1 is 116 049 in binary by the ASCII convention. But then, these ASCII values gotta map to the instruction. Per the MIPS op code specification, add corresponds to the last 6 100000 bits, t1 corresponds to the 01001 bits in the middle, etc.

Question

Assuming my assumptions are correct, how exactly does the assembler take the 116 049 and map it to 01001? In this course called nand2tetris, I’ve been writing an assembler in C which is really just a text parser. Obviously, C gets translated to assembly, so the actual assembler has no access to it. Thus came the confusion.

computer science – Why does the cpu store the current instructions into a stack once a system interrupt happens?

computer science – Why does the cpu store the current instructions into a stack once a system interrupt happens? – Software Engineering Stack Exchange

Is there a modern “x86″(64) assembly language resource (book/pdf/datasheet) with all AMD EPYC 7702 (or similar) instructions documented?

Back when I learned 6502, 6809, 8088, 80×86, and a few others – there was always a book that had the entire instruction set clearly documented.

Is there a modern equivalent for multi-core chips like the AMD EPYC 7702 ?

I’m wanting experiment with sophisticated multi-processing – mathematics specifically – so I’m hoping for something that lays out all the latest math-related op codes and anything about inter-core communications.

DreamProxies - Cheapest USA Elite Private Proxies 100 Cheapest USA Private Proxies Buy 200 Cheap USA Private Proxies 400 Best Private Proxies Cheap 1000 USA Private Proxies 2000 USA Private Proxies 5000 Cheap USA Private Proxies ExtraProxies.com - Buy Cheap Private Proxies Buy 50 Private Proxies Buy 100 Private Proxies Buy 200 Private Proxies Buy 500 Private Proxies Buy 1000 Private Proxies Buy 2000 Private Proxies ProxiesLive.com Proxies-free.com New Proxy Lists Every Day Proxies123.com Proxyti.com Buy Quality Private Proxies