Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

Hi all. I'm testing some ideas i have for a mod. I created a block, assigned a custom renderer for it and it all works. Then, i created a FBO (Frame Buffer Object) and did some code for rendering to it. When i assigned the FBO texture to the custom renderer, it only renders the background but not the quad i'm drawing.

Here´s some of the code:

https://gist.github.com/anonymous/8154703

 

And here is a video of this code in action:

PD: it actually is a block, not a square in the center of the screen, thanks perspective.

Hi

 

Is there some way you can "inspect" your FBO to make sure it contains the correct texture?

 

Apart from that - Although I don't know much about OpenGL, I'm suspicious of this bit in renderBlock

		glBegin(GL_QUADS);
	glVertex3f(1f, 0f, 0f);
	glVertex3f(0f, 0f, 0f);
	glVertex3f(0f, 1f, 0f);
	glVertex3f(1f, 1f, 0f);
	glEnd();

How does OpenGL know that you want to map your entire FBO texture to the size of the quad?

 

i.e. when using the Tessellator you need to tell it both [x,y,z] and [u,v].

http://greyminecraftcoder.blogspot.com.au/2013/08/the-tessellator.html

 

-TGG

  • Author

I edited my code so now it looks like

                glColor3f(1f, 1f, 1f);
	glBegin(GL_QUADS);
	glTexCoord2f(0f, 0f);
	glVertex3f(1f, 0f, 0f);
	glTexCoord2f(1f, 0f);
	glVertex3f(0f, 0f, 0f);
	glTexCoord2f(1f, 1f);
	glVertex3f(0f, 1f, 0f);
	glTexCoord2f(0f, 1f);
	glVertex3f(1f, 1f, 0f);
	glEnd();

but i get the same results. I've also tried with Tessellator.addVertexWithUV() and Tessellator.setTranslation() but with weird results: GUI shifted, slimes flying and my block isnt rendering :$

 

I'm sure it contains the correct texture, because the background is cleared in a rainbow, but over that rainbow there should be a yellow rectangle:

glColor4f(1f, 1f, 0, 0f);
glBegin(GL_QUADS);
    glVertex3f(0.8f, 0.2f, 1f);
    glVertex3f(0.2f, 0.2f, 1f);
    glVertex3f(0.2f, 0.8f, 1f);
    glVertex3f(0.8f, 0.8f, 1f);
    glEnd();

Hi

 

I think it would be worthwhile to try and split the possible causes into two:

(1) your FBO texture is wrong (your background is obviously correct but maybe the yellow rect isn't)

vs

(2) your renderBlock code isn't properly mapping the entire FBO texture to the rect that you're drawing.

 

If you can somehow manually inspect the FBO texture that would be the most direct way, but perhaps you could also test it by drawing the yellow rect over the entire FBO, to see if your rendered rect changes to yellow (i.e. the entire rect is being textured with just one texel).  Perhaps there's something subtle going on with alpha or depth values?

 

Can't really be of much help unfortunately, I haven't got much idea about OpenGL.

 

-TGG

 

 

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...

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.