• 11
• 9
• 10
• 9
• 10
• ### Similar Content

• By lxjk
Hi guys,
There are many ways to do light culling in tile-based shading. I've been playing with this idea for a while, and just want to throw it out there.
Because tile frustums are general small compared to light radius, I tried using cone test to reduce false positives introduced by commonly used sphere-frustum test.
On top of that, I use distance to camera rather than depth for near/far test (aka. sliced by spheres).
This method can be naturally extended to clustered light culling as well.
The following image shows the general ideas

Performance-wise I get around 15% improvement over sphere-frustum test. You can also see how a single light performs as the following: from left to right (1) standard rendering of a point light; then tiles passed the test of (2) sphere-frustum test; (3) cone test; (4) spherical-sliced cone test

I put the details in my blog post (https://lxjk.github.io/2018/03/25/Improve-Tile-based-Light-Culling-with-Spherical-sliced-Cone.html), GLSL source code included!

Eric

• Good evening everyone!

I was wondering if there is something equivalent of  GL_NV_blend_equation_advanced for AMD?
Basically I'm trying to find more compatible version of it.

Thank you!

• Hello guys,

How do I know? Why does wavefront not show for me?
I already checked I have non errors yet.

And my download (mega.nz) should it is original but I tried no success...
- Add blend source and png file here I have tried tried,.....

PS: Why is our community not active? I wait very longer. Stop to lie me!
Thanks !

• I wasn't sure if this would be the right place for a topic like this so sorry if it isn't.
I'm currently working on a project for Uni using FreeGLUT to make a simple solar system simulation. I've got to the point where I've implemented all the planets and have used a Scene Graph to link them all together. The issue I'm having with now though is basically the planets and moons orbit correctly at their own orbit speeds.
I'm not really experienced with using matrices for stuff like this so It's likely why I can't figure out how exactly to get it working. This is where I'm applying the transformation matrices, as well as pushing and popping them. This is within the Render function that every planet including the sun and moons will have and run.
if (tag != "Sun") { glRotatef(orbitAngle, orbitRotation.X, orbitRotation.Y, orbitRotation.Z); } glPushMatrix(); glTranslatef(position.X, position.Y, position.Z); glRotatef(rotationAngle, rotation.X, rotation.Y, rotation.Z); glScalef(scale.X, scale.Y, scale.Z); glDrawElements(GL_TRIANGLES, mesh->indiceCount, GL_UNSIGNED_SHORT, mesh->indices); if (tag != "Sun") { glPopMatrix(); } The "If(tag != "Sun")" parts are my attempts are getting the planets to orbit correctly though it likely isn't the way I'm meant to be doing it. So I was wondering if someone would be able to help me? As I really don't have an idea on what I would do to get it working. Using the if statement is truthfully the closest I've got to it working but there are still weird effects like the planets orbiting faster then they should depending on the number of planets actually be updated/rendered.

• Hello everyone,
I have problem with texture

# OpenGL Golden Rectangle!

This topic is 1640 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Hello guys.I need help.Really.. I have homework about golden rectangle.I didn't know anything about this homework.If i won't do this i won't pass this lesson just help me please.

I need golden rectangle codes in opengl

I ATTACHED MY HOMEWORK
Edited by sweeneyt0dd

##### Share on other sites

Forum rules are quite clear about homework: Its your job to do it! We may help, but we don't solve it for you. So ... what is your problem in detail? Understanding the golden ratio? Understanding the assignment text? Knowledge of OpenGL? Knowledge of GLUT?

(Is this sentence complete?) What have you done / tried so far?

##### Share on other sites

Forum rules are quite clear about homework: Its your job to do it! We may help, but we don't solve it for you. So ... what is your problem in detail? Understanding the golden ratio? Understanding the assignment text? Knowledge of OpenGL? Knowledge of GLUT?

(Is this sentence complete?) What have you done / tried so far?

dude..I'm new in this lesson in class.Just want golden rectangle codes likes

#include "stdafx.h"
#include <glut.h>
#include <math.h>

GLfloat G = (1 + (sqrt(float (5))))/2;

GLfloat gla1 = 0;
GLfloat glb1 = 0;
GLfloat gla2;
GLfloat glb2;

bool flip = true;

void genNextRect(void)
{
if (flip == false)
{
gla2 = gla2;
glb2 = gla2/G;

}
else
{
glb2 = glb2;
gla2 = gla2/G;

}
}

void init(void)
{
glClearColor(1.0, 1.0, 1.0, 0.0);
glMatrixMode(GL_PROJECTION);
glOrtho(0.0, 600.0, 0.0, 400.0, -15.0, 15.0);

glMatrixMode(GL_MODELVIEW);
}

void display()
{
glClear(GL_COLOR_BUFFER_BIT);
glLineWidth(4.0);

gla2 = glutGet(GLUT_WINDOW_WIDTH) - 10;
glb2 = glutGet(GLUT_WINDOW_HEIGHT) - 10;

glBegin(GL_LINE_LOOP);
glColor3f(0, 0, 1);
glVertex3f(gla1, glb1, 0);
glVertex3f(gla1, glb2, 0);
glVertex3f(gla2, glb2, 0);
glVertex3f(gla2, glb1, 0);
glEnd();
glutSwapBuffers();
}

void myReshape(GLsizei w, GLsizei h)
{
glViewport(0,0,w,h);
glMatrixMode(GL_PROJECTION);
gluOrtho2D(0.0, w, 0.0, h);
}

int main (int argc, char **argv)
{
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB);
glutInitWindowPosition(50, 50);
glutInitWindowSize(600, 500);
glutCreateWindow("");
glutDisplayFunc(display);
glutReshapeFunc(myReshape);
init();
glutMainLoop();

}

##### Share on other sites

If i won't do this i won't pass this lesson just help me please.

... >_>

At this rate, how do you expect to complete the course?

##### Share on other sites

If i won't do this i won't pass this lesson just help me please.

... >_>

At this rate, how do you expect to complete the course?

You are right what u want to say.But you don't know why i don't understand nothing this lesson.I didn't go lessons because my family problems. I'm sorry buti just want a help thats all

##### Share on other sites
Okay, don't panic. It's simpler than it looks. Looking at genNextRect, it takes the width and height of a rectangle as global parameters, gla2 and glb2, and sets them to the next smallest golden rectangle. Note, genNextRect assumes the gla2 and glb are already a golden rectangle. This is done by taking one of the dimensions and dividing by the golden ratio, which will result in a smaller length. The flip flag determine which dimension to shorten. It is the side with the longest length that is shortened. You will need to keep track of flip such that, when genNextRect is called, that the longest length of the rectangle is shortened. Alternatively, you could remove flip entirely and change the condition in genNextRect to select the longer edge. You may want to check that your rectangle's aspect ratio matches (or is close enough to) the golden ratio after calling genNextRect.

After you have called genNextRect you will need to draw it as demonstrated in the glBegin/glEnd block in display. The assignment requires you continue drawing rectangles until the rectangles are too small to display. So, all that's left to complete the assignment is finding the first golden rectangle in the screen and a loop that calls genNextRect and draws the new rectangle until the rectangle is too small to display.

P.S.
Don't panic.
[spoiler]
In pseudo-code, it'd look something like this:
display:
let rectangle be the size of the screen

begin drawing lines
while (area of rectangle) > 1 pixel:
rectangle = genNextRect rectangle

set rectangle color
draw each rectangle edge

end drawing lines

[/spoiler] Edited by fastcall22

##### Share on other sites

Okay, don't panic. It's simpler than it looks. Looking at genNextRect, it takes the width and height of a rectangle as global parameters, gla2 and glb2, and sets them to the next smallest golden rectangle. Note, genNextRect assumes the gla2 and glb are already a golden rectangle. This is done by taking one of the dimensions and dividing by the golden ratio, which will result in a smaller length. The flip flag determine which dimension to shorten. It is the side with the longest length that is shortened. You will need to keep track of flip such that, when genNextRect is called, that the longest length of the rectangle is shortened. Alternatively, you could remove flip entirely and change the condition in genNextRect to select the longer edge. You may want to check that your rectangle's aspect ratio matches (or is close enough to) the golden ratio after calling genNextRect.

After you have called genNextRect you will need to draw it as demonstrated in the glBegin/glEnd block in display. The assignment requires you continue drawing rectangles until the rectangles are too small to display. So, all that's left to complete the assignment is finding the first golden rectangle in the screen and a loop that calls genNextRect and draws the new rectangle until the rectangle is too small to display.

P.S.
Don't panic.
[spoiler]
In pseudo-code, it'd look something like this:

display:
let rectangle be the size of the screen

begin drawing lines
while (area of rectangle) > 1 pixel:
rectangle = genNextRect rectangle

set rectangle color
draw each rectangle edge

end drawing lines

[/spoiler]

thank you very much. I will do this with your help :)