Jump to content
  • Home
  • Files
  • Docs
Topics
  • All Content

  • This Topic
  • This Forum

  • Advanced Search
  • Existing user? Sign In  

    Sign In



    • Not recommended on shared computers


    • Forgot your password?

  • Sign Up
  • All Activity
  • Home
  • Mod Developer Central
  • Modder Support
  • [1.7.10] Problem with Fullbright Quads
Currently Supported: 1.16.X (Latest) and 1.15.X (LTS)
Sign in to follow this  
Followers 0
Draco18s

[1.7.10] Problem with Fullbright Quads

By Draco18s, August 13, 2015 in Modder Support

  • Reply to this topic
  • Start new topic

Recommended Posts

Draco18s    2416

Draco18s

Draco18s    2416

  • Reality Controller
  • Draco18s
  • Members
  • 2416
  • 16012 posts
Posted August 13, 2015

I'm trying to draw some world-information as an overlay (so 3D quads, not 2D HUD things) and I'm having two problems:

 

1) I can't get the quads to be full-bright.  They flicker between various lighting values as the camera moves. Pic

2) The block outline's outline color changes. Pic

 

@SubscribeEvent
public void renderEvent(DrawBlockHighlightEvent event) {
	...
		GL11.glPushMatrix();
		GL11.glTranslated(-event.player.posX, -event.player.posY, -event.player.posZ);
		GL11.glDisable(GL11.GL_LIGHTING);
		drawLine(thisBlock, points[i]);
	...
}

private void drawLine(Vec3 blockA, Vec3 blockB) {
	Tessellator tess = Tessellator.instance;
	tess.setBrightness(15728880);
	tess.startDrawing(7);
	int d = Math.round((float)blockA.distanceTo(blockB)+0.2f);

	tess.setColorOpaque_F(1F, 0F, 0F);

	float ox = (blockA.xCoord - blockB.xCoord == 0?-1f/16f:0);
	float oz = (blockA.zCoord - blockB.zCoord == 0?1f/16f:0);

	if(blockA.xCoord - blockB.xCoord > 0 || blockA.zCoord - blockB.zCoord > 0) {
		tess.addVertex(blockA.xCoord + 0.5 + ox, blockA.yCoord - 0.01, blockA.zCoord + 0.5 + oz);
		tess.addVertex(blockB.xCoord + 0.5 + ox, blockB.yCoord + 0.99, blockB.zCoord + 0.5 + oz);
		tess.addVertex(blockB.xCoord + 0.5 - ox, blockB.yCoord + 0.99, blockB.zCoord + 0.5 - oz);
		tess.addVertex(blockA.xCoord + 0.5 - ox, blockA.yCoord - 0.01, blockA.zCoord + 0.5 - oz);
	}
	else {
		tess.addVertex(blockA.xCoord + 0.5 - ox, blockA.yCoord - 0.01, blockA.zCoord + 0.5 - oz);
		tess.addVertex(blockB.xCoord + 0.5 - ox, blockB.yCoord + 0.99, blockB.zCoord + 0.5 - oz);
		tess.addVertex(blockB.xCoord + 0.5 + ox, blockB.yCoord + 0.99, blockB.zCoord + 0.5 + oz);
		tess.addVertex(blockA.xCoord + 0.5 + ox, blockA.yCoord - 0.01, blockA.zCoord + 0.5 + oz);
	}

	tess.draw();
}

 

What've I missed?

  • Quote

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Share this post


Link to post
Share on other sites

larsgerrits    514

larsgerrits

larsgerrits    514

  • Reality Controller
  • larsgerrits
  • Members
  • 514
  • 3462 posts
Posted August 13, 2015

1) Where do  you pop your matrix?

2) Maybe using

glPushAttrib

and

glPopAttrib

will help.

  • Quote

Don't PM me with questions. They will be ignored! Make a thread on the appropriate board for support.

 

1.12 -> 1.13 primer by williewillus.

 

1.7.10 and older versions of Minecraft are no longer supported due to it's age! Update to the latest version for support.

 

http://www.howoldisminecraft1710.today/

Share this post


Link to post
Share on other sites

Draco18s    2416

Draco18s

Draco18s    2416

  • Reality Controller
  • Draco18s
  • Members
  • 2416
  • 16012 posts
Posted August 13, 2015

1) Where do  you pop your matrix?

2) Maybe using

glPushAttrib

and

glPopAttrib

will help.

 

1) I trimmed it (there's about 12 lines I removed, checking for various things).  I know about push/pop.  In retrospect I should have left that in.

2)

GL11.glPushAttrib(GL11.GL_ENABLE_BIT)

fixed the block outline color though, thanks!

 

But I still have an issue with the lighting on the quads being incorrect.

  • Quote

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Share this post


Link to post
Share on other sites

SanAndreasP    402

SanAndreasP

SanAndreasP    402

  • World Shaper
  • SanAndreasP
  • Forge Modder
  • 402
  • 1689 posts
Posted August 13, 2015

1) Where do  you pop your matrix?

2) Maybe using

glPushAttrib

and

glPopAttrib

will help.

 

1) I trimmed it (there's about 12 lines I removed, checking for various things).  I know about push/pop.  In retrospect I should have left that in.

2)

GL11.glPushAttrib(GL11.GL_ENABLE_BIT)

fixed the block outline color though, thanks!

 

But I still have an issue with the lighting on the quads being incorrect.

 

For the light I'd suggest using

OpenGlHelper.setLightmapTextureCoords()

:

// save the previous lighting brightness
            float prevBrightX = OpenGlHelper.lastBrightnessX;
            float prevBrightY = OpenGlHelper.lastBrightnessY;
// declare new brightness (0xF0 is the max. possible)
            int bright = 0xF0;
            int brightX = bright % 65536;
            int brightY = bright / 65536;
// set new brightness
            OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, brightX / 1.0F, brightY / 1.0F);

// do rendering here


// reset original brightness, so it doesn't mess up anything post-rendered
            OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, prevBrightX, prevBrightY);

  • Quote

Don't ask for support per PM! They'll get ignored! | If a post helped you, click the "Thank You" button at the top right corner of said post! |

mah twitter

This thread makes me sad because people just post copy-paste-ready code when it's obvious that the OP has little to no programming experience. This is not how learning works.

Share this post


Link to post
Share on other sites

Draco18s    2416

Draco18s

Draco18s    2416

  • Reality Controller
  • Draco18s
  • Members
  • 2416
  • 16012 posts
Posted August 13, 2015

Nope, didn't help. :\

 

I'm using the Tessellator for drawing, btw.  And I've already got

tess.setBrightness(15728880)

, but it hasn't made a difference either.

  • Quote

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Share this post


Link to post
Share on other sites

TheGreyGhost    819

TheGreyGhost

TheGreyGhost    819

  • Reality Controller
  • TheGreyGhost
  • Members
  • 819
  • 3280 posts
Posted August 14, 2015

Hi Draco

 

You could try calling             

GL11.glColor4f(colour.R, colour.G, colour.B, colour.A);

instead of

tess.setColorOpaque_F(1F, 0F, 0F);

 

That fixed a similar problem I had once before.

 

-TGG

 

  • Quote

Share this post


Link to post
Share on other sites

Draco18s    2416

Draco18s

Draco18s    2416

  • Reality Controller
  • Draco18s
  • Members
  • 2416
  • 16012 posts
Posted August 14, 2015

You could try calling             

GL11.glColor4f(colour.R, colour.G, colour.B, colour.A);

instead of

tess.setColorOpaque_F(1F, 0F, 0F);

 

Calling tess.setColor...no good

Calling tess.setColor and GL11.glColor...no good

Calling GL11.glColor...no good

 

:\

  • Quote

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Share this post


Link to post
Share on other sites

TheGreyGhost    819

TheGreyGhost

TheGreyGhost    819

  • Reality Controller
  • TheGreyGhost
  • Members
  • 819
  • 3280 posts
Posted August 14, 2015

Ah... your code triggers a ghost of a memory... let me check...

 

Try this:

		Tessellator tess = Tessellator.instance;
	tess.startDrawing(7);                                        //swap order
                tess.setBrightness(15728880);

    public void startDrawing(int p_78371_1_)
    {
        if (this.isDrawing)
        {
            throw new IllegalStateException("Already tesselating!");
        }
        else
        {
            this.isDrawing = true;
            this.reset();
            this.drawMode = p_78371_1_;
            this.hasNormals = false;
            this.hasColor = false;
            this.hasTexture = false;
            this.hasBrightness = false;
            this.isColorDisabled = false;
        }
    }

-TGG

  • Quote

Share this post


Link to post
Share on other sites

Draco18s    2416

Draco18s

Draco18s    2416

  • Reality Controller
  • Draco18s
  • Members
  • 2416
  • 16012 posts
Posted August 14, 2015

Nope.  And I managed to dredge up an older post of my own that gave me what I needed, albeit in decimal format.

 

glDisable(GL_TEXTURE_2D);

  • Quote

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  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.

    • Insert image from URL
×
  • Desktop
  • Tablet
  • Phone
Sign in to follow this  
Followers 0
Go To Topic Listing



  • Recently Browsing

    No registered users viewing this page.

  • Posts

    • LessyDoggy
      Forge 1.12.2 Installing Bug

      By LessyDoggy · Posted 31 minutes ago

      So I used forge 1.16.5 but now I cant change it too 1.12.2 no mather what. I have tried Installing client, Installing server and extract but nothing works. I even removed forge 1.16.5 from my computer but I still have that verison on and idk how to change it.
    • Yourskillx2
      !!Keeps crashing during launch!!

      By Yourskillx2 · Posted 49 minutes ago

      I have a decent sized mod pack with around 90 mods and every time I go to launch the game, it loads some stuff then crashes with exit code 0, I cannot figure out if its a mod in the pack doing it, like maybe not a release version or if it just doesn't work with Mc like its supposed to.
    • IMaironI
      server error

      By IMaironI · Posted 7 hours ago

      2021-03-06-8.log
    • diesieben07
      server error

      By diesieben07 · Posted 7 hours ago

      Like I already said: The logs folder.
    • prototype204
      Attacking/Hitting issue

      By prototype204 · Posted 7 hours ago

      I am no longer able to attack animals or mobs in the game, however they are still able to attack me. I checked to verify that the mods I downloaded weren't the issue. I think they might be an error code in forge 1.16.5 however if anyone knows what I could do to fix this. P.S. I could still break bricks. 
  • Topics

    • LessyDoggy
      0
      Forge 1.12.2 Installing Bug

      By LessyDoggy
      Started 31 minutes ago

    • Yourskillx2
      0
      !!Keeps crashing during launch!!

      By Yourskillx2
      Started 49 minutes ago

    • IMaironI
      13
      server error

      By IMaironI
      Started 11 hours ago

    • prototype204
      0
      Attacking/Hitting issue

      By prototype204
      Started 7 hours ago

    • BeardlessBrady
      3
      [1.16.5] Adding arguments to DeferredRegister and RegistryObject

      By BeardlessBrady
      Started 11 hours ago

  • Who's Online (See full list)

    • zlappedx3
    • Lachezar Tsvetkov
    • Alex155Hales
  • All Activity
  • Home
  • Mod Developer Central
  • Modder Support
  • [1.7.10] Problem with Fullbright Quads
  • Theme

Copyright © 2019 ForgeDevelopment LLC · Ads by Longitude Ads LLC Powered by Invision Community