Jump to content

Recommended Posts

Posted

Hello!
I am unable to load the texture from the IntBuffer.


Sequencing:
I create a texture with a certain size and write it to the IntBuffer. Then I load it into GL using the method: GL11.glTexSubImage2D()
At certain points, the texture size changes...
Then, I recreate the IntBuffer, re-bind the texture and load it again.

static int offset;
static int size;

// offset changes at some point
// after that I call prepareImage()

public static void prepareImage() {
    size = (offset * 2 + 1) << 4;
    buf = BufferUtils.createIntBuffer(size * size);
    TextureUtil.prepareImage(textureId, size, size);
    ... // create a texture again and write to the buffer
    upload(0, 0, size, size);
}

private static void upload(int xOffset, int yOffset, int width, int height) {
    if (RenderSystem.isOnRenderThreadOrInit()) uploadImage(xOffset, yOffset, width, height);
    else RenderSystem.recordRenderCall(() -> uploadImage(xOffset, yOffset, width, height));
}

private static void uploadImage(int xOffset, int yOffset, int width, int height) {
    bindTexture();
    boolean offset = xOffset > 0 || yOffset > 0;
    if (offset) {
        setPosition(xOffset, yOffset);
        GL11.glPixelStorei(GL11.GL_UNPACK_ROW_LENGTH, size);
    }
    GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_S, GL12.GL_CLAMP_TO_EDGE);
    GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_T, GL12.GL_CLAMP_TO_EDGE);
    GL11.glTexSubImage2D(GL11.GL_TEXTURE_2D, 0, xOffset, yOffset, width, height, GL11.GL_RGBA, GL12.GL_UNSIGNED_INT_8_8_8_8_REV, buf); // crash here
    if (offset) {
        setPosition(0, 0);
        GL11.glPixelStorei(GL11.GL_UNPACK_ROW_LENGTH, 0);
    }
}

private static void setPosition(int x, int y) {
    buf.position(y * size + x);
}

Crash doesn't always happen. Sometimes it works and sometimes it doesn't.
Also, if I load only a part of the texture with an offset, the loaded piece eventually jumps and turns out to be in a different position each time. As if the parameter GL11.GL_UNPACK_ROW_LENGTH changes every time.
A very strange message is displayed in the console:

#
# A fatal error has been detected by the Java Runtime Environment:
#
#  EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x000000005f4749e0, pid=7740, tid=0x0000000000001c38
#
# JRE version: Java(TM) SE Runtime Environment (8.0_131-b11) (build 1.8.0_131-b11)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (25.131-b11 mixed mode windows-amd64 compressed oops)
# Problematic frame:
# C  [nvoglv64.DLL+0xaf49e0]
#
# Failed to write core dump. Minidumps are not enabled by default on client versions of Windows
#
# An error report file with more information is saved as:
# E:\Mod\1.16.5\run\hs_err_pid7740.log
#
# If you would like to submit a bug report, please visit:
#   http://bugreport.java.com/bugreport/crash.jsp
# The crash happened outside the Java Virtual Machine in native code.
# See problematic frame for where to report the bug.
#

This is what is in this file:

#
# A fatal error has been detected by the Java Runtime Environment:
#
#  EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x000000005f4749e0, pid=7740, tid=0x0000000000001c38
#
# JRE version: Java(TM) SE Runtime Environment (8.0_131-b11) (build 1.8.0_131-b11)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (25.131-b11 mixed mode windows-amd64 compressed oops)
# Problematic frame:
# C  [nvoglv64.DLL+0xaf49e0]
#
# Failed to write core dump. Minidumps are not enabled by default on client versions of Windows
#
# If you would like to submit a bug report, please visit:
#   http://bugreport.java.com/bugreport/crash.jsp
# The crash happened outside the Java Virtual Machine in native code.
# See problematic frame for where to report the bug.
#

---------------  T H R E A D  ---------------

Current thread (0x00000000021ec000):  JavaThread "Render thread" [_thread_in_native, id=7224, stack(0x0000000002440000,0x0000000002540000)]

siginfo: ExceptionCode=0xc0000005, reading address 0x000000003d5b1000

Registers:
RAX=0x000000003d5b1020, RBX=0x000000003d5b0c80, RCX=0x000000003d6cbd60, RDX=0x000000003d5b0c80
RSP=0x000000000253d0d8, RBP=0x0000000000000840, RSI=0x0000000000000000, RDI=0x000000003d6cb9c0
R8 =0x0000000000000013, R9 =0x0000000000000000, R10=0x0000000026a7ee94, R11=0x0000000000000002
R12=0x0000000000000000, R13=0x0000000000000000, R14=0x000000000253d330, R15=0x0000000000000000
RIP=0x000000005f4749e0, EFLAGS=0x0000000000010202

Top of Stack: (sp=0x000000000253d0d8)
0x000000000253d0d8:   000000005f474650 000000000000001e
0x000000000253d0e8:   0000000400000000 0000000000000000
0x000000000253d0f8:   0000021000000800 0000000000000001
0x000000000253d108:   000000005f0bbf00 000000003d6cb9c0
0x000000000253d118:   0000000000000210 000000003d5b0c80
0x000000000253d128:   000000005efc2b83 000000001c620000
0x000000000253d138:   0000000000000000 0000000000000000
0x000000000253d148:   000000005efc2953 000000005f48b040
0x000000000253d158:   0000000000000000 000000005efc2b00
0x000000000253d168:   000000005efcc6d4 00000000242f24d0
0x000000000253d178:   000000005ee45c22 000000000253d330
0x000000000253d188:   0000000000000009 000000005efcc680
0x000000000253d198:   000000001c620000 0000000000000001
0x000000000253d1a8:   000000005efcec7d 000000000253d330
0x000000000253d1b8:   0000000000000001 00000000241392e0
0x000000000253d1c8:   0000000000000004 0000005200000052 

Instructions: (pc=0x000000005f4749e0)
0x000000005f4749c0:   11 49 c0 0f 11 41 d0 49 83 e8 01 75 d3 c3 4d 85
0x000000005f4749d0:   c0 74 3a 48 83 c1 20 48 8d 42 20 0f 1f 44 00 00
0x000000005f4749e0:   0f 10 58 e0 48 8d 49 40 0f 10 50 f0 0f 10 08 0f
0x000000005f4749f0:   10 40 10 48 8d 40 40 0f 11 59 a0 0f 11 51 b0 0f 


Register to memory mapping:

RAX=0x000000003d5b1020 is an unknown value
RBX=0x000000003d5b0c80 is an unknown value
RCX=0x000000003d6cbd60 is an unknown value
RDX=0x000000003d5b0c80 is an unknown value
RSP=0x000000000253d0d8 is pointing into the stack for thread: 0x00000000021ec000
RBP=0x0000000000000840 is an unknown value
RSI=0x0000000000000000 is an unknown value
RDI=0x000000003d6cb9c0 is an unknown value
R8 =0x0000000000000013 is an unknown value
R9 =0x0000000000000000 is an unknown value
R10=0x0000000026a7ee94 is an unknown value
R11=0x0000000000000002 is an unknown value
R12=0x0000000000000000 is an unknown value
R13=0x0000000000000000 is an unknown value
R14=0x000000000253d330 is pointing into the stack for thread: 0x00000000021ec000
R15=0x0000000000000000 is an unknown value


Stack: [0x0000000002440000,0x0000000002540000],  sp=0x000000000253d0d8,  free space=1012k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
C  [nvoglv64.DLL+0xaf49e0]

Java frames: (J=compiled Java code, j=interpreted, Vv=VM code)
J 12933  org.lwjgl.opengl.GL11C.nglTexSubImage2D(IIIIIIIIJ)V (0 bytes) @ 0x0000000003d749bc [0x0000000003d74940+0x7c]
J 22607 C1 ru.liahim.mist.client.shader.FogTexture.uploadImage(IIII)V (99 bytes) @ 0x0000000003c5eb94 [0x0000000003c5e760+0x434]
j  ru.liahim.mist.client.shader.FogTexture.upload(IIII)V+10
j  ru.liahim.mist.client.shader.FogTexture.createFogTexture(Lnet/minecraft/world/World;II)V+74
J 24664 C1 ru.liahim.mist.handlers.Fog.prepareFogParameters(Lcom/mojang/blaze3d/matrix/MatrixStack;Lnet/minecraft/util/math/vector/Matrix4f;F)V (435 bytes) @ 0x0000000005ff1404 [0x0000000005ff0860+0xba4]
J 24343 C1 ru.liahim.mist.handlers.Fog.prepare(Lcom/mojang/blaze3d/matrix/MatrixStack;Lnet/minecraft/util/math/vector/Matrix4f;F)V (43 bytes) @ 0x0000000005c6c2bc [0x0000000005c6bba0+0x71c]
J 24241 C2 net.minecraft.client.renderer.WorldRenderer.renderLevel(Lcom/mojang/blaze3d/matrix/MatrixStack;FJZLnet/minecraft/client/renderer/ActiveRenderInfo;Lnet/minecraft/client/renderer/GameRenderer;Lnet/minecraft/client/renderer/LightTexture;Lnet/minecraft/util/math/vector/Matrix4f;)V (2872 bytes) @ 0x0000000006259f84 [0x0000000006259f20+0x64]
J 24416 C1 net.minecraft.client.renderer.GameRenderer.renderLevel(FJLcom/mojang/blaze3d/matrix/MatrixStack;)V (614 bytes) @ 0x000000000630762c [0x0000000006302040+0x55ec]
J 13341 C1 net.minecraft.client.renderer.GameRenderer.render(FJZ)V (856 bytes) @ 0x000000000495d52c [0x000000000495bfa0+0x158c]
J 25014 C2 net.minecraft.client.Minecraft.runTick(Z)V (994 bytes) @ 0x000000000658c314 [0x000000000658aa60+0x18b4]
j  net.minecraft.client.Minecraft.run()V+68
j  net.minecraft.client.main.Main.main([Ljava/lang/String;)V+1379
v  ~StubRoutines::call_stub
j  sun.reflect.NativeMethodAccessorImpl.invoke0(Ljava/lang/reflect/Method;Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;+0
j  sun.reflect.NativeMethodAccessorImpl.invoke(Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;+100
J 1863 C1 sun.reflect.DelegatingMethodAccessorImpl.invoke(Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object; (10 bytes) @ 0x0000000002e25c0c [0x0000000002e25b00+0x10c]
J 1862 C1 java.lang.reflect.Method.invoke(Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object; (62 bytes) @ 0x0000000002e26874 [0x0000000002e26480+0x3f4]
j  net.minecraftforge.userdev.FMLUserdevClientLaunchProvider.lambda$launchService$0(Lcpw/mods/modlauncher/api/ITransformingClassLoader;[Ljava/lang/String;)Ljava/lang/Void;+65
j  net.minecraftforge.userdev.FMLUserdevClientLaunchProvider$$Lambda$453.call()Ljava/lang/Object;+12
j  cpw.mods.modlauncher.LaunchServiceHandlerDecorator.launch([Ljava/lang/String;Lcpw/mods/modlauncher/api/ITransformingClassLoader;)V+11
j  cpw.mods.modlauncher.LaunchServiceHandler.launch(Ljava/lang/String;[Ljava/lang/String;Lcpw/mods/modlauncher/TransformingClassLoader;Lcpw/mods/modlauncher/LaunchPluginHandler;)V+57
j  cpw.mods.modlauncher.LaunchServiceHandler.launch(Lcpw/mods/modlauncher/ArgumentHandler;Lcpw/mods/modlauncher/TransformingClassLoader;Lcpw/mods/modlauncher/LaunchPluginHandler;)V+19
j  cpw.mods.modlauncher.Launcher.run([Ljava/lang/String;)V+116
j  cpw.mods.modlauncher.Launcher.main([Ljava/lang/String;)V+37
j  net.minecraftforge.userdev.LaunchTesting.main([Ljava/lang/String;)V+422
v  ~StubRoutines::call_stub

 

Sorry, I don't speak English very well...

Posted

Fixed!

On version 1.16.5, before loading the image, you must reset the following parameters:

GlStateManager._pixelStore(GL11.GL_UNPACK_SKIP_PIXELS, 0);
GlStateManager._pixelStore(GL11.GL_UNPACK_SKIP_ROWS, 0);

 

Sorry, I don't speak English very well...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • So am trying to make a custom 1.19.2 modpack and everything works until I add Oculus. I have tried Oculus+Embedium and Oculus+Rubdium and by themselves they work but as soon as I add anything it crashes no matter what it is. The modpack works fine with just Embedium and Rubdium. Can you help me to see if this is something i can fix or do i just have to deal with not having shaders. Here is the crash log. Thank you for your time. https://paste.ee/p/WXfNZ24K
    • New users at Temureceive a 40 Off discount on orders over 40 Off Use the code [{acx318439}]] during checkout to get TemuDiscount 40 Off For New Users. You n save 40 Off off your first order with the Promo Code available for a limited time only. Extra 30% off for new and existing customers + Up to $40 Off % off & more. Temu Promo Codes for New users- [{acx318439}]] Temudiscount code for New customers- [{acx318439}]] Temu $40 Off Promo Code- [{acx318439}]] what are Temu codes- acx318439 does Temu give you $40 Off - [{acx318439}]] Yes Verified Temu Promo Code january 2025- {acx318439} TemuNew customer offer {acx318439} Temudiscount codejanuary 2025 {acx318439} 40 off Promo Code Temu {acx318439} Temu 40% off any order {acx318439} 40 dollar off Temu code {acx318439} TemuCoupon $40 Off off for New customers There are a number of discounts and deals shoppers n take advantage of with the Teemu Coupon Bundle [{acx318439}]]. TemuCoupon $40 Off off for New customers [{acx318439}]] will save you $40 Off on your order. To get a discount, click on the item to purchase and enter the code. You n think of it as a supercharged savings pack for all your shopping needs Temu Promo Code 80% off – [{acx318439}]] Free Temu codes 50% off – [{acx318439}]] TemuCoupon $40 Off off – [{acx318439}]] Temu buy to get ₱39 – [{acx318439}]] Temu 129 coupon bundle – [{acx318439}]] Temu buy 3 to get €99 – [{acx318439}]] Exclusive $40 Off Off TemuDiscount Code Temu $40 Off Off Promo Code : (acx318439) Temu Discount Code $40 Off Bundle acx318439) acx318439 Temu $40 Off off Promo Code for Exsting users : acx318439) Temu Promo Code $40 Off off Temu 40 Off coupon code (acx318439) will save you 40 Off on your order. To get a discount, click on the item to purchase and enter the code. Yes, Temu offers 40 Off Coupon Code “acx318439” for Existing Customers.  You can get a 40 Off bonus plus 30% off any purchase at Temu with the 40 Off Coupon Bundle at Temu if you sign up with the referral code [{acx318439}]] and make a first purchase of $40 Off or more. Temu Promo Code 40 off-{acx318439} Temu Promo Code -{acx318439} Temu Promo Code $40 Off off-{acx318439} kubonus code -{acx318439} Get ready to unlock a world of savings with our free Temu UK coupons! We’ve got you covered with a wide range of Temu UK coupon code options that will help you maximize your shopping experience.30% Off Temu UK Coupons, Promo Codes + 25% Cash Back [ acx318439]   Yes, Temu offers 40 off coupon code {acx318439} for first-time users. You can get a $40 bonus plus 40% off any purchase at Temu with the $40 Coupon Bundle if you sign up with the referral code [{acx318439}]] and make a first purchase of $40 or more. If you are who wish to join Temu, then you should use this exclusive TemuCoupon code 40 off (acx318439) and get 40 off on your purchase with Temu. You can get a 40% discount with TemuCoupon code {acx318439}. This exclusive offer is for existing customers and can be used for a 40 reduction on your total purchase. Enter coupon code {acx318439} at checkout to avail of the discount. You can use the code {acx318439} to get a 40 off TemuCoupon as a new customer. Apply this TemuCoupon code $40 off (acx318439) to get a $40 discount on your shopping with Temu. If you’re a first-time user and looking for a TemuCoupon code $40 first time user(acx318439) then using this code will give you a flat $40 Off and a 90% discount on your Temu shopping.     •    acx318439: Enjoy flat 40% off on your first Temu order.     •    acx318439: Download the Temu app and get an additional 40% off.     •    acx318439: Celebrate spring with up to 90% discount on selected items.     •    acx318439: Score up to 90% off on clearance items.     •    acx318439: Beat the heat with hot summer savings of up to 90% off.     •    acx318439: Temu UK Coupon Code to 40% off on Appliances at Temu. How to Apply Temu Coupon Code? Using the TemuCoupon code $40 off is a breeze. All you need to do is follow these simple steps:     1    Visit the Temu website or app and browse through the vast collection of products.     2    Once you’ve added the items you wish to purchase to your cart, proceed to the checkout page.     3    During the checkout process, you’ll be prompted to enter a coupon code or promo code.     4    Type in the coupon code: [{acx318439}]] and click “Apply.”     5    Voila! You’ll instantly see the $40 discount reflected in your total purchase amount. Temu New User Coupon: Up To 90% OFF For Existing Customers Temu Existing customer’s coupon codes are designed just for new customers, offering the biggest discounts 90% and the best deals currently available on Temu. To maximize your savings, download the Temu app and apply our Temu new user coupon during checkout.     •    acx318439: New users can get up to 80% extra off.     •    acx318439: Get a massive 40% off your first order!     •    acx318439: Get 20% off on your first order; no minimum spending required.     •    acx318439: Take an extra 15% off your first order on top of existing discounts.     •    acx318439: Temu UK Enjoy a 40% discount on your entire first purchase.  
    • What do I do now when it says "1 error"?
    • Hello everyone new here how are you all?
    • I haven't tested it but under https://minecraft.wiki/w/Items_model_definition it says now:   So I guess the resource location must have changed with 1.24.4, which means you need to move your models/item/ to the new source. But as I said I haven't tested this so it also may be that this wont work. Nevertheless give it a try      EDIT (important) So now I tested it and found out how it works   Let the model files (e.g. the .json from blockbench) within "assets/<your_mod_id>/models/item" In addition to that do the following: Every model you added will need a new file under "assets/<your_mod_id>/items" That file is also a JSON and looks like this: { "model": { "type": "minecraft:model", "model": "your_mod_id:item/custom_item" } } - "type" can be minecraft:model, minecraft:composite, minecraft:condition, minecraft:select, minecraft:range_dispatch, minecraft:empty, minecraft:bundle/selected_item or minecraft:special. (In most cases you would need minecraft:model) - "model" is the path to your actual model for this item. For example the value above would point to "assets/your_mod_id/models/item/custom_item"
  • Topics

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.